Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const ALLOWED_CFGS: &[&str] = &[
// Corresponds to `_REDIR_TIME64` in musl: symbol redirects to __*_time64
"musl_redir_time64",
"vxworks_lt_25_09",
// Corresponds with `__USE_FILE_OFFSET64` in uClibc.
"uclibc_file_offset_bits64",
];

// Extra values to allow for check-cfg.
Expand Down Expand Up @@ -175,6 +177,11 @@ fn main() {
}
}

if target_env == "uclibc" && env::var("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_FILE_OFFSET_BITS").is_ok()
{
set_cfg("uclibc_file_offset_bits64");
}

// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
Expand Down
98 changes: 48 additions & 50 deletions src/unix/linux_like/linux/uclibc/arm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
use crate::off64_t;
use crate::prelude::*;

pub type wchar_t = c_uint;
pub type time_t = c_long;

pub type clock_t = c_long;
pub type fsblkcnt_t = c_ulong;
pub type fsfilcnt_t = c_ulong;
pub type ino_t = c_ulong;
pub type off_t = c_long;
pub type pthread_t = c_ulong;
pub type suseconds_t = c_long;

pub type nlink_t = c_uint;
pub type blksize_t = c_long;
pub type blkcnt_t = c_long;

pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;

s! {
pub struct flock {
pub l_type: c_short,
pub l_whence: c_short,
pub l_start: crate::off_t,
pub l_len: crate::off_t,
pub l_pid: crate::pid_t,
}

pub struct cmsghdr {
pub cmsg_len: size_t,
pub cmsg_level: c_int,
Expand All @@ -43,58 +43,71 @@ s! {
}

pub struct stat {
pub st_dev: c_ulonglong,
pub st_dev: crate::dev_t,

#[cfg(not(uclibc_file_offset_bits64))]
__pad1: Padding<c_ushort>,
#[cfg(not(uclibc_file_offset_bits64))]
pub st_ino: crate::ino_t,

#[cfg(uclibc_file_offset_bits64)]
__pad1: Padding<c_uint>,
#[cfg(uclibc_file_offset_bits64)]
pub __st_ino: crate::ino_t,

pub st_mode: crate::mode_t,
pub st_nlink: crate::nlink_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: c_ulonglong,
pub st_rdev: crate::dev_t,

#[cfg(not(uclibc_file_offset_bits64))]
__pad2: Padding<c_ushort>,
pub st_size: off_t,

#[cfg(uclibc_file_offset_bits64)]
__pad2: Padding<c_uint>,

pub st_size: crate::off_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atime_nsec: c_ulong,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtime_nsec: c_ulong,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
__unused4: Padding<c_ulong>,
__unused5: Padding<c_ulong>,
pub st_ctime_nsec: c_ulong,

#[cfg(not(uclibc_file_offset_bits64))]
__uclibc_unused4: Padding<c_ulong>,
#[cfg(not(uclibc_file_offset_bits64))]
__uclibc_unused5: Padding<c_ulong>,

#[cfg(uclibc_file_offset_bits64)]
pub st_ino: crate::ino_t,
}

pub struct stat64 {
pub st_dev: c_ulonglong,
pub __pad1: c_uint,
pub st_dev: crate::dev_t,
__pad1: Padding<c_uint>,
pub __st_ino: crate::ino_t,
pub st_mode: crate::mode_t,
pub st_nlink: crate::nlink_t,
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: c_ulonglong,
pub __pad2: c_uint,
pub st_size: off64_t,
pub st_rdev: crate::dev_t,
__pad2: Padding<c_uint>,
pub st_size: crate::off64_t,
pub st_blksize: crate::blksize_t,
pub st_blocks: crate::blkcnt64_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atime_nsec: c_ulong,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtime_nsec: c_ulong,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctime_nsec: c_ulong,
pub st_ino: crate::ino64_t,
}

pub struct flock {
pub l_type: c_short,
pub l_whence: c_short,
pub l_start: off_t,
pub l_len: off_t,
pub l_pid: crate::pid_t,
}

pub struct sysinfo {
pub uptime: c_long,
pub loads: [c_ulong; 3],
Expand Down Expand Up @@ -125,7 +138,7 @@ s! {
pub f_namelen: c_int,
pub f_frsize: c_int,
pub f_flags: c_int,
pub f_spare: [c_int; 4],
pub f_spare: Padding<[c_int; 4]>,
}

pub struct statfs64 {
Expand All @@ -136,27 +149,12 @@ s! {
pub f_bavail: crate::fsblkcnt64_t,
pub f_files: crate::fsfilcnt64_t,
pub f_ffree: crate::fsfilcnt64_t,

pub f_fsid: crate::fsid_t,
pub f_namelen: c_int,
pub f_frsize: c_int,
pub f_flags: c_int,
pub f_spare: [c_int; 4],
}

pub struct statvfs64 {
pub f_bsize: c_ulong,
pub f_frsize: c_ulong,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
pub f_favail: u64,
pub f_fsid: c_ulong,
__f_unused: Padding<c_int>,
pub f_flag: c_ulong,
pub f_namemax: c_ulong,
__f_spare: [c_int; 6],
pub f_spare: Padding<[c_int; 4]>,
}

pub struct sigset_t {
Expand Down
98 changes: 23 additions & 75 deletions src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
use crate::off64_t;
use crate::prelude::*;

pub type clock_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
pub type wchar_t = i32;
pub type off_t = i32;
pub type ino_t = u32;
pub type blkcnt_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = c_ulong;
pub type fsfilcnt_t = c_ulong;
pub type __u64 = c_ulonglong;
pub type __s64 = c_longlong;
pub type fsblkcnt64_t = u64;
pub type fsfilcnt64_t = u64;

s! {
pub struct stat {
Expand All @@ -27,16 +19,29 @@ s! {
pub st_uid: crate::uid_t,
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
pub st_pad2: [c_long; 1],
pub st_size: off_t,

#[cfg(not(uclibc_file_offset_bits64))]
st_pad2: Padding<[c_long; 1]>,

#[cfg(uclibc_file_offset_bits64)]
st_pad2: Padding<[c_long; 2]>,

pub st_size: crate::off_t,

#[cfg(not(uclibc_file_offset_bits64))]
st_pad3: Padding<c_long>,

pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atime_nsec: c_ulong,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtime_nsec: c_ulong,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctime_nsec: c_ulong,
pub st_blksize: crate::blksize_t,

#[cfg(uclibc_file_offset_bits64)]
st_pad4: Padding<c_long>,

pub st_blocks: crate::blkcnt_t,
st_pad5: Padding<[c_long; 14]>,
}
Expand All @@ -51,33 +56,17 @@ s! {
pub st_gid: crate::gid_t,
pub st_rdev: crate::dev_t,
st_pad2: Padding<[c_long; 2]>,
pub st_size: off64_t,
pub st_size: crate::off64_t,
pub st_atime: crate::time_t,
pub st_atime_nsec: c_long,
pub st_atime_nsec: c_ulong,
pub st_mtime: crate::time_t,
pub st_mtime_nsec: c_long,
pub st_mtime_nsec: c_ulong,
pub st_ctime: crate::time_t,
pub st_ctime_nsec: c_long,
pub st_ctime_nsec: c_ulong,
pub st_blksize: crate::blksize_t,
st_pad3: Padding<c_long>,
pub st_blocks: crate::blkcnt64_t,
st_pad5: Padding<[c_long; 14]>,
}

pub struct statvfs64 {
pub f_bsize: c_ulong,
pub f_frsize: c_ulong,
pub f_blocks: crate::fsblkcnt64_t,
pub f_bfree: crate::fsblkcnt64_t,
pub f_bavail: crate::fsblkcnt64_t,
pub f_files: crate::fsfilcnt64_t,
pub f_ffree: crate::fsfilcnt64_t,
pub f_favail: crate::fsfilcnt64_t,
pub f_fsid: c_ulong,
pub __f_unused: c_int,
pub f_flag: c_ulong,
pub f_namemax: c_ulong,
pub __f_spare: [c_int; 6],
st_pad4: Padding<[c_long; 14]>,
}

pub struct pthread_attr_t {
Expand Down Expand Up @@ -173,36 +162,6 @@ s! {
__glibc_reserved5: Padding<c_ulong>,
}

pub struct statfs {
pub f_type: c_long,
pub f_bsize: c_long,
pub f_frsize: c_long,
pub f_blocks: crate::fsblkcnt_t,
pub f_bfree: crate::fsblkcnt_t,
pub f_files: crate::fsblkcnt_t,
pub f_ffree: crate::fsblkcnt_t,
pub f_bavail: crate::fsblkcnt_t,
pub f_fsid: crate::fsid_t,

pub f_namelen: c_long,
f_spare: [c_long; 6],
}

pub struct statfs64 {
pub f_type: c_long,
pub f_bsize: c_long,
pub f_frsize: c_long,
pub f_blocks: crate::fsblkcnt64_t,
pub f_bfree: crate::fsblkcnt64_t,
pub f_files: crate::fsblkcnt64_t,
pub f_ffree: crate::fsblkcnt64_t,
pub f_bavail: crate::fsblkcnt64_t,
pub f_fsid: crate::fsid_t,
pub f_namelen: c_long,
pub f_flags: c_long,
pub f_spare: [c_long; 5],
}

pub struct msghdr {
pub msg_name: *mut c_void,
pub msg_namelen: crate::socklen_t,
Expand All @@ -228,16 +187,6 @@ s! {
pub c_cc: [crate::cc_t; crate::NCCS],
}

pub struct flock {
pub l_type: c_short,
pub l_whence: c_short,
pub l_start: off_t,
pub l_len: off_t,
pub l_sysid: c_long,
pub l_pid: crate::pid_t,
pad: Padding<[c_long; 4]>,
}

pub struct sysinfo {
pub uptime: c_long,
pub loads: [c_ulong; 3],
Expand Down Expand Up @@ -665,7 +614,6 @@ pub const SYS_process_mrelease: c_long = 4000 + 448;
pub const SYS_futex_waitv: c_long = 4000 + 449;
pub const SYS_set_mempolicy_home_node: c_long = 4000 + 450;

#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut c_int,
Expand Down
Loading
Loading