diff --git a/libc-test/build.rs b/libc-test/build.rs index c6a46e0ae7853..ace0ba82306a1 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3530,6 +3530,8 @@ fn test_linux(target: &str) { // LFS64 types have been removed in musl 1.2.4+ "off64_t" if musl => "off_t".to_string(), + // In some gnu targets `stat64` is a typedef to `stat` + "stat64" if gnu => format!("struct {}", ty), // typedefs don't need any keywords t if t.ends_with("_t") => t.to_string(), diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index 103e7eb423305..f4e3f7828802f 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -56,28 +56,6 @@ s! { __unused2: ::c_ulong } - pub struct stat64 { - pub st_dev: ::dev_t, - __pad1: ::c_uint, - __st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_uint, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino64_t, - } - pub struct statfs64 { pub f_type: ::__fsword_t, pub f_bsize: ::__fsword_t, @@ -871,3 +849,13 @@ pub const SYS_set_mempolicy_home_node: ::c_long = 450; mod align; pub use self::align::*; + +cfg_if! { + if #[cfg(gnu_time64_abi)] { + mod time64; + pub use self::time64::*; + } else { + mod time32; + pub use self::time32::*; + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/arm/time32.rs b/src/unix/linux_like/linux/gnu/b32/arm/time32.rs new file mode 100644 index 0000000000000..cd991bd00e011 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/arm/time32.rs @@ -0,0 +1,24 @@ +s! { + pub struct stat64 { + pub st_dev: ::dev_t, + __pad1: ::c_uint, + __st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_uint, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino64_t, + } + +} diff --git a/src/unix/linux_like/linux/gnu/b32/arm/time64.rs b/src/unix/linux_like/linux/gnu/b32/arm/time64.rs new file mode 100644 index 0000000000000..7facf6ae7f287 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/arm/time64.rs @@ -0,0 +1,2 @@ +use stat; +pub type stat64 = stat; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 8b43ebbdd08d0..98d98e1f56859 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -2,28 +2,6 @@ pub type c_char = i8; pub type wchar_t = i32; s! { - pub struct stat64 { - pub st_dev: ::c_ulong, - st_pad1: [::c_long; 3], - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::c_ulong, - st_pad2: [::c_long; 2], - pub st_size: ::off64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_blksize: ::blksize_t, - st_pad3: ::c_long, - pub st_blocks: ::blkcnt64_t, - st_pad5: [::c_long; 14], - } pub struct statfs { pub f_type: ::c_long, @@ -808,3 +786,13 @@ pub const EHWPOISON: ::c_int = 168; mod align; pub use self::align::*; + +cfg_if! { + if #[cfg(gnu_time64_abi)] { + mod time64; + pub use self::time64::*; + } else { + mod time32; + pub use self::time32::*; + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/mips/time32.rs b/src/unix/linux_like/linux/gnu/b32/mips/time32.rs new file mode 100644 index 0000000000000..b4f37a4e006ff --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/mips/time32.rs @@ -0,0 +1,24 @@ +s! { + pub struct stat64 { + pub st_dev: ::c_ulong, + st_pad1: [::c_long; 3], + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulong, + st_pad2: [::c_long; 2], + pub st_size: ::off64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + st_pad3: ::c_long, + pub st_blocks: ::blkcnt64_t, + st_pad5: [::c_long; 14], + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/mips/time64.rs b/src/unix/linux_like/linux/gnu/b32/mips/time64.rs new file mode 100644 index 0000000000000..7facf6ae7f287 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/mips/time64.rs @@ -0,0 +1,2 @@ +use stat; +pub type stat64 = stat; diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs index 45be39de96e96..58a694514dbe0 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -53,54 +53,6 @@ cfg_if! { } s! { - pub struct stat { - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_dev: ::dev_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_dev: ::c_ulong, - - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad1: ::c_short, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad1: [::c_long; 3], - pub st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_rdev: ::dev_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_rdev: ::c_ulong, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __pad2: ::c_short, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad2: [::c_long; 2], - pub st_size: ::off_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad3: ::c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_blksize: ::blksize_t, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __unused4: ::c_long, - #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] - __unused5: ::c_long, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_blksize: ::blksize_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - pub st_blocks: ::blkcnt_t, - #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] - st_pad5: [::c_long; 14], - } - pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc/mod.rs b/src/unix/linux_like/linux/gnu/b32/powerpc/mod.rs index a8792420583fb..d2bc1cc12ee15 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc/mod.rs @@ -55,28 +55,6 @@ s! { __glibc_reserved2: u64, } - pub struct stat64 { - pub st_dev: ::dev_t, - pub st_ino: ::ino64_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_ushort, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - __glibc_reserved4: ::c_ulong, - __glibc_reserved5: ::c_ulong, - } - pub struct statfs64 { pub f_type: ::__fsword_t, pub f_bsize: ::__fsword_t, diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc/time32.rs b/src/unix/linux_like/linux/gnu/b32/powerpc/time32.rs index f6205b7960a92..74fb67b1d98bf 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc/time32.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc/time32.rs @@ -1,4 +1,26 @@ s! { + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_ushort, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + pub struct shmid_ds { pub shm_perm: ::ipc_perm, __glibc_reserved1: ::c_uint, @@ -15,5 +37,4 @@ s! { __glibc_reserved5: ::c_ulong, __glibc_reserved6: ::c_ulong, } - } diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc/time64.rs b/src/unix/linux_like/linux/gnu/b32/powerpc/time64.rs index cda775183285b..2a1903fd4b429 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc/time64.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc/time64.rs @@ -1,3 +1,6 @@ +use stat; +pub type stat64 = stat; + s! { pub struct shmid_ds { pub shm_perm: ::ipc_perm, diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index a948b0bc5a443..898391c9a68f6 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -100,21 +100,6 @@ s! { __reserved: [::c_long; 2], } - pub struct statfs64 { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: u64, - pub f_bfree: u64, - pub f_bavail: u64, - pub f_files: u64, - pub f_ffree: u64, - pub f_fsid: ::fsid_t, - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - pub f_flags: ::__fsword_t, - pub f_spare: [::__fsword_t; 4], - } - pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -130,21 +115,6 @@ s! { __f_spare: [::c_int; 6], } - 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, - pub f_flag: ::c_ulong, - pub f_namemax: ::c_ulong, - __f_spare: [::c_int; 6], - } - pub struct timex { pub modes: ::c_uint, pub offset: ::c_long, @@ -885,3 +855,12 @@ pub const SYS_set_mempolicy_home_node: ::c_long = 450; mod align; pub use self::align::*; +cfg_if! { + if #[cfg(gnu_time64_abi)] { + mod time64; + pub use self::time64::*; + } else { + mod time32; + pub use self::time32::*; + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/time32.rs b/src/unix/linux_like/linux/gnu/b32/sparc/time32.rs new file mode 100644 index 0000000000000..69a850a81c6f1 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/sparc/time32.rs @@ -0,0 +1,31 @@ +s! { + pub struct statfs64 { + pub f_type: ::__fsword_t, + pub f_bsize: ::__fsword_t, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: u64, + pub f_files: u64, + pub f_ffree: u64, + pub f_fsid: ::fsid_t, + pub f_namelen: ::__fsword_t, + pub f_frsize: ::__fsword_t, + pub f_flags: ::__fsword_t, + pub f_spare: [::__fsword_t; 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, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/time64.rs b/src/unix/linux_like/linux/gnu/b32/sparc/time64.rs new file mode 100644 index 0000000000000..97aa11d949c66 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/sparc/time64.rs @@ -0,0 +1,4 @@ +use statfs; +use statvfs; +pub type statfs64 = statfs; +pub type statvfs64 = statvfs; diff --git a/src/unix/linux_like/linux/gnu/b32/time32.rs b/src/unix/linux_like/linux/gnu/b32/time32.rs index d23149582e8e3..fc2c0c87e824d 100644 --- a/src/unix/linux_like/linux/gnu/b32/time32.rs +++ b/src/unix/linux_like/linux/gnu/b32/time32.rs @@ -1,6 +1,54 @@ //! 32-bit specific definitions for linux-like values when gnu_time64_abi is not set s! { + pub struct stat { + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + pub st_dev: ::dev_t, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + pub st_dev: ::c_ulong, + + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + __pad1: ::c_short, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + st_pad1: [::c_long; 3], + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + pub st_rdev: ::dev_t, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + pub st_rdev: ::c_ulong, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + __pad2: ::c_short, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + st_pad2: [::c_long; 2], + pub st_size: ::off_t, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + st_pad3: ::c_long, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + pub st_blksize: ::blksize_t, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + __unused4: ::c_long, + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))] + __unused5: ::c_long, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + pub st_blksize: ::blksize_t, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + pub st_blocks: ::blkcnt_t, + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] + st_pad5: [::c_long; 14], + } + pub struct timex { pub modes: ::c_uint, diff --git a/src/unix/linux_like/linux/gnu/b32/time64.rs b/src/unix/linux_like/linux/gnu/b32/time64.rs index 5e762b37b8967..5a76f4b652428 100644 --- a/src/unix/linux_like/linux/gnu/b32/time64.rs +++ b/src/unix/linux_like/linux/gnu/b32/time64.rs @@ -1,6 +1,37 @@ //! 32-bit specific definitions for linux-like values when gnu_time64_abi is set s! { + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + #[cfg(target_arch = "powerpc")] + __pad1: i32, + pub st_atime_nsec: ::c_long, + #[cfg(not(target_arch = "powerpc"))] //x86 and arm and ? + __pad1: i32, + pub st_mtime: ::time_t, + #[cfg(target_arch = "powerpc")] + __pad2: i32, + pub st_mtime_nsec: ::c_long, + #[cfg(not(target_arch = "powerpc"))] + __pad2: i32, + pub st_ctime: ::time_t, + #[cfg(target_arch = "powerpc")] + __pad3: i32, + pub st_ctime_nsec: ::c_long, + #[cfg(not(target_arch = "powerpc"))] + __pad3: i32, + } + pub struct timex { pub modes: ::c_uint, diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index c4e99e7b84b78..c3c10daab17ed 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -130,28 +130,6 @@ s! { __unused2: ::c_ulong } - pub struct stat64 { - pub st_dev: ::dev_t, - __pad1: ::c_uint, - __st_ino: ::ino_t, - pub st_mode: ::mode_t, - pub st_nlink: ::nlink_t, - pub st_uid: ::uid_t, - pub st_gid: ::gid_t, - pub st_rdev: ::dev_t, - __pad2: ::c_uint, - pub st_size: ::off64_t, - pub st_blksize: ::blksize_t, - pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_long, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_long, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_long, - pub st_ino: ::ino64_t, - } - pub struct statfs64 { pub f_type: ::__fsword_t, pub f_bsize: ::__fsword_t, @@ -1108,3 +1086,13 @@ extern "C" { mod align; pub use self::align::*; + +cfg_if! { + if #[cfg(gnu_time64_abi)] { + mod time64; + pub use self::time64::*; + } else { + mod time32; + pub use self::time32::*; + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/x86/time32.rs b/src/unix/linux_like/linux/gnu/b32/x86/time32.rs new file mode 100644 index 0000000000000..c8bd6d14deccb --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/x86/time32.rs @@ -0,0 +1,23 @@ +s! { + pub struct stat64 { + pub st_dev: ::dev_t, + __pad1: ::c_uint, + __st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad2: ::c_uint, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt64_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_ino: ::ino64_t, + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/x86/time64.rs b/src/unix/linux_like/linux/gnu/b32/x86/time64.rs new file mode 100644 index 0000000000000..7facf6ae7f287 --- /dev/null +++ b/src/unix/linux_like/linux/gnu/b32/x86/time64.rs @@ -0,0 +1,2 @@ +use stat; +pub type stat64 = stat;