From c883cf66994f3e75853658d0ecb1ae2f2a6ca1a3 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Wed, 10 Jun 2026 19:04:15 +0200 Subject: [PATCH] refactor: change file off bindings in linux uclibc The currently exposed bindings to file offset types and routines are often found to be either lacking or incorrect in the current worktree. This has been fixed by means of changing multiple type definitions across child modules of the uClibc module under Linux, such that a more cohesive interface is exposed. Among those changes, the patch also switches the default definition of types with LFS64 "variants," such that they use that definition by default. This affects types such as `off_t` and `ino_t`, for which support varied between platforms to either the regular definition upstream or the LFS64 definition. Beyond that, a few LFS64-specific routines have been deprecated in favor of their unsuffixed variants. Much in the same vein as the prior changes, this follows the trend towards supporting a single unsuffixed type whose bitwidth is 64-bits. It has been assumed that this extends as well to routines making use of such types. Lastly, it must be noted that all changes submitted in this patch match the definition of upstream uclibc-ng, but not necessarily of the original uClibc (now unmaintained.) This was done by performing a regex search through all header files under `**/{platform}/bits/*.h`, where `{platform}` is replaced by one of: `common`, `common-generic`, `arm`, `x86_64` or `mips`. The search term in question included any uses of the `__USE_FILE_OFFSET64` or `__USE_LARGEFILE64` feature test macros. The latter gates functionality that exposes 64-bit types, while the former ensures the unsuffixed variants are defined in terms of the suffixed types/routines. By default, upstream builds of uclibc-ng will have LFS support added by default lest otherwise configured. This is shown in the make configuration script generated by running make defconfig in the root worktree. --- src/unix/linux_like/linux/uclibc/arm/mod.rs | 103 ++++---------- .../linux/uclibc/mips/mips32/mod.rs | 132 ++++++------------ .../linux/uclibc/mips/mips64/mod.rs | 75 +++------- src/unix/linux_like/linux/uclibc/mips/mod.rs | 20 +++ src/unix/linux_like/linux/uclibc/mod.rs | 52 ++++++- .../linux_like/linux/uclibc/x86_64/mod.rs | 96 ++++--------- 6 files changed, 172 insertions(+), 306 deletions(-) diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs index 26dd49b24465b..03ead6ab2ebcc 100644 --- a/src/unix/linux_like/linux/uclibc/arm/mod.rs +++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs @@ -1,22 +1,31 @@ -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 statfs64 = statfs; +pub type stat64 = stat; + +#[deprecated( + since = "0.2.187", + note = "Use `fsblkcnt_t` instead. The unsuffixed type is defined in terms of the suffixed type \ + in default builds of upstream uclibc-ng, and the `libc` crate is itself phasing out \ + support for suffixed variants in favor of a single fixed-width unsuffixed type." +)] pub type fsblkcnt64_t = u64; +#[deprecated( + since = "0.2.187", + note = "Use `fsfilcnt_t` instead. The unsuffixed type is defined in terms of the suffixed type \ + in default builds of upstream uclibc-ng, and the `libc` crate is itself phasing out \ + support for suffixed variants in favor of a single fixed-width unsuffixed type." +)] pub type fsfilcnt64_t = u64; pub type __u64 = c_ulonglong; pub type __s64 = c_longlong; @@ -43,56 +52,25 @@ s! { } pub struct stat { - pub st_dev: c_ulonglong, - __pad1: Padding, - 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, - __pad2: Padding, - pub st_size: 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_mtime: crate::time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: crate::time_t, - pub st_ctime_nsec: c_long, - __unused4: Padding, - __unused5: Padding, - } - - pub struct stat64 { - pub st_dev: c_ulonglong, - pub __pad1: c_uint, + pub st_dev: crate::dev_t, + __pad1: Padding, 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, + pub st_size: crate::off_t, pub st_blksize: crate::blksize_t, - pub st_blocks: crate::blkcnt64_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, - 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 st_ctime_nsec: c_ulong, + pub st_ino: crate::ino_t, } pub struct sysinfo { @@ -128,37 +106,6 @@ s! { pub f_spare: [c_int; 4], } - pub struct statfs64 { - pub f_type: c_int, - pub f_bsize: c_int, - 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_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, - pub f_flag: c_ulong, - pub f_namemax: c_ulong, - __f_spare: [c_int; 6], - } - pub struct sigset_t { __val: [c_ulong; 2], } diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs index 93ed7ab213335..cea401d7801a7 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs @@ -1,22 +1,30 @@ -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; +#[deprecated( + since = "0.2.187", + note = "Use `fsblkcnt_t` instead. The unsuffixed type is defined in terms of the unsuffixed \ + type in all default builds of upstream uClibc, and the `libc` crate is phasing out \ + support for suffixed variants in favor of a single fixed-width suffixed variant." +)] pub type fsblkcnt64_t = u64; +#[deprecated( + since = "0.2.187", + note = "Use `fsfilcnt_t` instead. The unsuffixed type is defined in terms of the unsuffixed \ + type in all default builds of upstream uClibc, and the `libc` crate is phasing out \ + support for suffixed variants in favor of a single fixed-width suffixed variant." +)] pub type fsfilcnt64_t = u64; +pub type stat64 = stat; + s! { pub struct stat { pub st_dev: crate::dev_t, @@ -27,59 +35,20 @@ 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, - st_pad3: Padding, + st_pad2: [c_long; 2], + pub st_size: crate::off_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_pad4: Padding, pub st_blocks: crate::blkcnt_t, st_pad5: Padding<[c_long; 14]>, } - pub struct stat64 { - pub st_dev: crate::dev_t, - st_pad1: Padding<[c_long; 2]>, - pub st_ino: crate::ino64_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: crate::dev_t, - st_pad2: Padding<[c_long; 2]>, - pub st_size: off64_t, - pub st_atime: crate::time_t, - pub st_atime_nsec: c_long, - pub st_mtime: crate::time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: crate::time_t, - pub st_ctime_nsec: c_long, - pub st_blksize: crate::blksize_t, - st_pad3: Padding, - 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], - } - pub struct pthread_attr_t { __size: [u32; 9], } @@ -108,6 +77,12 @@ s! { pub _pad: [c_int; 29], } + #[deprecated( + since = "0.2.187", + note = "Use `glob` instead. The suffixed variant exposed in `libc` has no differences \ + whatsoever with the unsuffixed variant because we don't expose the fields that are \ + function pointers." + )] pub struct glob64_t { pub gl_pathc: size_t, pub gl_pathv: *mut *mut c_char, @@ -173,36 +148,6 @@ s! { __glibc_reserved5: Padding, } - 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, @@ -228,16 +173,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], @@ -665,7 +600,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, @@ -675,12 +609,26 @@ extern "C" { newp: *mut c_void, newlen: size_t, ) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `glob` instead. The suffixed variant exposed in `libc` has no differences \ + whatsoever with the unsuffixed variant because we don't expose the fields that are \ + function pointers." + )] + #[allow(deprecated)] pub fn glob64( pattern: *const c_char, flags: c_int, errfunc: Option c_int>, pglob: *mut glob64_t, ) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `glob` instead. The suffixed variant exposed in `libc` has no differences \ + whatsoever with the unsuffixed variant because we don't expose the fields that are \ + function pointers." + )] + #[allow(deprecated)] pub fn globfree64(pglob: *mut glob64_t); pub fn pthread_attr_getaffinity_np( attr: *const crate::pthread_attr_t, diff --git a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs index 4495181400d48..d15cb1bb68782 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs @@ -1,63 +1,35 @@ -use crate::off64_t; use crate::prelude::*; -pub type blkcnt_t = i64; pub type blksize_t = i64; -pub type fsblkcnt_t = c_ulong; -pub type fsfilcnt_t = c_ulong; -pub type ino_t = u64; pub type nlink_t = u64; -pub type off_t = i64; pub type suseconds_t = i64; pub type time_t = i64; pub type wchar_t = i32; +pub type stat64 = stat; + s! { pub struct stat { - pub st_dev: c_ulong, - st_pad1: Padding<[c_long; 2]>, + pub st_dev: c_uint, + st_pad1: Padding<[c_int; 3]>, 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_ulong, - st_pad2: Padding<[c_ulong; 1]>, - pub st_size: off_t, - st_pad3: Padding, - pub st_atime: crate::time_t, - pub st_atime_nsec: c_long, - pub st_mtime: crate::time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: crate::time_t, - pub st_ctime_nsec: c_long, - pub st_blksize: crate::blksize_t, - st_pad4: Padding, + pub st_rdev: c_uint, + st_pad2: Padding<[c_uint; 3]>, + pub st_size: crate::off_t, + pub st_atime: c_int, + pub st_atime_nsec: c_int, + pub st_mtime: c_int, + pub st_mtime_nsec: c_int, + pub st_ctime: c_int, + pub st_ctime_nsec: c_int, + pub st_blksize: c_int, + st_pad3: Padding, pub st_blocks: crate::blkcnt_t, - st_pad5: Padding<[c_long; 7]>, - } - - pub struct stat64 { - pub st_dev: c_ulong, - st_pad1: Padding<[c_long; 2]>, - pub st_ino: crate::ino64_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_ulong, - st_pad2: Padding<[c_long; 2]>, - pub st_size: off64_t, - pub st_atime: crate::time_t, - pub st_atime_nsec: c_long, - pub st_mtime: crate::time_t, - pub st_mtime_nsec: c_long, - pub st_ctime: crate::time_t, - pub st_ctime_nsec: c_long, - pub st_blksize: crate::blksize_t, - st_pad3: Padding, - pub st_blocks: crate::blkcnt64_t, - st_pad5: Padding<[c_long; 7]>, + st_pad4: Padding<[c_int; 14]>, } pub struct pthread_attr_t { @@ -129,21 +101,6 @@ s! { __glibc_reserved5: Padding, } - 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 msghdr { pub msg_name: *mut c_void, pub msg_namelen: crate::socklen_t, diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs index 8d17aa8e98e9a..abd155312721a 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs @@ -2,6 +2,26 @@ use crate::prelude::*; pub type pthread_t = c_ulong; +pub type statfs64 = statfs; + +s! { + 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, + pub f_flags: c_long, + f_spare: [c_long; 5], + } +} + pub const SFD_CLOEXEC: c_int = 0x080000; pub const NCCS: usize = 32; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 7da0779d4dd70..cb993b97e51bc 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -1,16 +1,23 @@ // FIXME(ulibc): this module has definitions that are redundant with the parent #![allow(dead_code)] -use crate::off64_t; use crate::prelude::*; pub type shmatt_t = c_ulong; pub type msgqnum_t = c_ulong; pub type msglen_t = c_ulong; pub type regoff_t = c_int; -pub type rlim_t = c_ulong; pub type __rlimit_resource_t = c_ulong; pub type __priority_which_t = c_uint; +pub type ino_t = u64; +pub type off_t = i64; +pub type rlim_t = u64; +pub type blkcnt_t = i64; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; + +pub type flock64 = flock; +pub type statvfs64 = statvfs; cfg_if! { if #[cfg(doc)] { @@ -23,6 +30,14 @@ cfg_if! { } 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 statvfs { // Different than GNU! pub f_bsize: c_ulong, @@ -33,12 +48,9 @@ s! { pub f_files: crate::fsfilcnt_t, pub f_ffree: crate::fsfilcnt_t, pub f_favail: crate::fsfilcnt_t, - #[cfg(target_endian = "little")] pub f_fsid: c_ulong, #[cfg(target_pointer_width = "32")] __f_unused: Padding, - #[cfg(target_endian = "big")] - pub f_fsid: c_ulong, pub f_flag: c_ulong, pub f_namemax: c_ulong, __f_spare: [c_int; 6], @@ -472,8 +484,18 @@ extern "C" { flags: c_int, ) -> c_int; - pub fn pwritev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t) -> ssize_t; - pub fn preadv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t) -> ssize_t; + pub fn pwritev( + fd: c_int, + iov: *const crate::iovec, + iovcnt: c_int, + offset: crate::off64_t, + ) -> ssize_t; + pub fn preadv( + fd: c_int, + iov: *const crate::iovec, + iovcnt: c_int, + offset: crate::off64_t, + ) -> ssize_t; pub fn sethostid(hostid: c_long) -> c_int; pub fn fanotify_mark( @@ -483,7 +505,23 @@ extern "C" { dirfd: c_int, path: *const c_char, ) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `getrlimit` instead. The unsuffixed routine is defined upstream in terms of \ + the suffixed routine under default builds of uclibc-ng, and the `libc` crate is \ + itself phasing out support for suffixed variants in favor of a single fixed-width \ + unsuffixed variant. The `rlimit` type is also defined in terms of its 64-bit \ + suffixed type." + )] pub fn getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int; + #[deprecated( + since = "0.2.187", + note = "Use `setrlimit` instead. The unsuffixed routine is defined upstream in terms of \ + the suffixed routine under default builds of uclibc-ng, and the `libc` crate is \ + itself phasing out support for suffixed variants in favor of a single fixed-width \ + unsuffixed variant. The `rlimit` type is also defined in terms of its 64-bit \ + suffixed type." + )] pub fn setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) -> c_int; pub fn getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 510b90b599108..d46666a658cf7 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -1,25 +1,32 @@ //! Definitions for uclibc on 64bit systems -use crate::off64_t; use crate::prelude::*; -pub type blkcnt_t = i64; pub type blksize_t = i64; pub type clock_t = i64; -pub type fsblkcnt_t = c_ulong; -pub type fsfilcnt_t = c_ulong; -pub type fsword_t = c_long; -pub type ino_t = c_ulong; pub type nlink_t = c_uint; -pub type off_t = c_long; -// [uClibc docs] Note stat64 has the same shape as stat for x86-64. -pub type stat64 = stat; pub type suseconds_t = c_long; pub type time_t = c_int; pub type wchar_t = c_int; pub type pthread_t = c_ulong; +// [uClibc docs] Note stat64 has the same shape as stat for x86-64. +pub type stat64 = stat; +pub type statfs64 = statfs; + +#[deprecated( + since = "0.2.187", + note = "Use `fsblkcnt_t` instead. The unsuffixed type is defined in terms of the suffixed type \ + in all default builds of upstream uClibc, and the `libc` crate is itself phasing out \ + support for suffixed variants in favor of a single unsuffixed, fixed-width type." +)] pub type fsblkcnt64_t = u64; +#[deprecated( + since = "0.2.187", + note = "Use `fsfilcnt_t` instead. The unsuffixed type is defined in terms of the suffixed type \ + in all default builds of upstream uClibc, and the `libc` crate is itself phasing out \ + support for suffixed variants in favor of a single unsuffixed, fixed-width type." +)] pub type fsfilcnt64_t = u64; pub type __u64 = c_ulong; pub type __s64 = c_long; @@ -119,8 +126,9 @@ s! { pub st_mode: crate::mode_t, pub st_uid: crate::uid_t, pub st_gid: crate::gid_t, - pub st_rdev: c_ulong, // dev_t - pub st_size: off_t, // file size + __pad0: Padding, + pub st_rdev: crate::dev_t, // dev_t + pub st_size: crate::off_t, // file size pub st_blksize: crate::blksize_t, pub st_blocks: crate::blkcnt_t, pub st_atime: crate::time_t, @@ -129,7 +137,7 @@ s! { pub st_mtime_nsec: c_ulong, pub st_ctime: crate::time_t, pub st_ctime_nsec: c_ulong, - st_pad4: Padding<[c_long; 3]>, + __uclibc_unused: Padding<[c_long; 3]>, } // FIXME(1.0): This should not implement `PartialEq` @@ -150,48 +158,19 @@ s! { pub struct statfs { // FIXME(ulibc) - pub f_type: fsword_t, - pub f_bsize: fsword_t, + pub f_type: c_long, + pub f_bsize: c_long, pub f_blocks: crate::fsblkcnt_t, pub f_bfree: crate::fsblkcnt_t, pub f_bavail: crate::fsblkcnt_t, pub f_files: crate::fsfilcnt_t, pub f_ffree: crate::fsfilcnt_t, - pub f_fsid: crate::fsid_t, - pub f_namelen: fsword_t, - pub f_frsize: fsword_t, - f_spare: [fsword_t; 5], - } - pub struct statfs64 { - pub f_type: c_int, - pub f_bsize: c_int, - 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_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, - pub f_flag: c_ulong, - pub f_namemax: c_ulong, - __f_spare: [c_int; 6], + pub f_namelen: c_long, + pub f_frsize: c_long, + pub f_flags: c_long, + f_spare: [c_long; 4], } pub struct msghdr { @@ -238,19 +217,6 @@ s! { pub _f: [c_char; 0], } - pub struct glob_t { - // FIXME(ulibc) - pub gl_pathc: size_t, - pub gl_pathv: *mut *mut c_char, - pub gl_offs: size_t, - pub gl_flags: c_int, - __unused1: Padding<*mut c_void>, - __unused2: Padding<*mut c_void>, - __unused3: Padding<*mut c_void>, - __unused4: Padding<*mut c_void>, - __unused5: Padding<*mut c_void>, - } - pub struct cpu_set_t { // FIXME(ulibc) #[cfg(target_pointer_width = "32")] @@ -280,16 +246,6 @@ s! { } } -s_no_extra_traits! { - pub struct dirent { - pub d_ino: crate::ino64_t, - pub d_off: off64_t, - pub d_reclen: u16, - pub d_type: u8, - pub d_name: [c_char; 256], - } -} - // constants pub const ENAMETOOLONG: c_int = 36; // File name too long pub const ENOTEMPTY: c_int = 39; // Directory not empty