diff --git a/build.rs b/build.rs index 07df3af2da2a..ddf2e882ca78 100644 --- a/build.rs +++ b/build.rs @@ -177,7 +177,7 @@ fn main() { } if target_env == "gnu" - && matches!(target_os.as_str(), "linux" | "windows") + && matches!(target_os.as_str(), "linux" | "windows" | "hurd") && target_ptr_width == "32" && target_arch != "riscv32" && target_arch != "x86_64" diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs index e706789006db..e56df6d6bf06 100644 --- a/src/unix/hurd/b32.rs +++ b/src/unix/hurd/b32.rs @@ -15,14 +15,14 @@ pub type __u_quad_t = c_ulonglong; pub type __intmax_t = c_longlong; pub type __uintmax_t = c_ulonglong; -pub type __squad_type = crate::__int64_t; -pub type __uquad_type = crate::__uint64_t; +pub type __squad_type = __int64_t; +pub type __uquad_type = __uint64_t; pub type __sword_type = c_int; pub type __uword_type = c_uint; pub type __slong32_type = c_long; pub type __ulong32_type = c_ulong; -pub type __s64_type = crate::__int64_t; -pub type __u64_type = crate::__uint64_t; +pub type __s64_type = __int64_t; +pub type __u64_type = __uint64_t; pub type __ipc_pid_t = c_ushort; diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 4d92aae08e4b..f09460cc5ba9 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -77,7 +77,16 @@ pub type wchar_t = c_int; pub type wint_t = c_uint; pub type gid_t = __gid_t; pub type uid_t = __uid_t; -pub type off_t = __off_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type off_t = __off64_t; + } else { + pub type off_t = __off_t; + } +} + +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type off64_t = __off64_t; pub type useconds_t = __useconds_t; pub type pid_t = __pid_t; @@ -101,7 +110,16 @@ pub type quad_t = __quad_t; pub type u_quad_t = __u_quad_t; pub type fsid_t = __fsid_t; pub type loff_t = __loff_t; -pub type ino_t = __ino_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type ino_t = __ino64_t; + } else { + pub type ino_t = __ino_t; + } +} + +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type ino64_t = __ino64_t; pub type dev_t = __dev_t; pub type mode_t = __mode_t; @@ -129,11 +147,24 @@ pub type sigset_t = __sigset_t; pub type __fd_mask = c_long; pub type fd_mask = __fd_mask; pub type blksize_t = __blksize_t; -pub type blkcnt_t = __blkcnt_t; -pub type fsblkcnt_t = __fsblkcnt_t; -pub type fsfilcnt_t = __fsfilcnt_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type blkcnt_t = __blkcnt64_t; + pub type fsblkcnt_t = __fsblkcnt64_t; + pub type fsfilcnt_t = __fsfilcnt64_t; + } else { + pub type blkcnt_t = __blkcnt_t; + pub type fsblkcnt_t = __fsblkcnt_t; + pub type fsfilcnt_t = __fsfilcnt_t; + } +} + +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type blkcnt64_t = __blkcnt64_t; +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type fsblkcnt64_t = __fsblkcnt64_t; +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type fsfilcnt64_t = __fsfilcnt64_t; pub type __pthread_spinlock_t = c_int; @@ -164,7 +195,16 @@ pub type pthread_once_t = __pthread_once; pub type __rlimit_resource = c_uint; pub type __rlimit_resource_t = __rlimit_resource; -pub type rlim_t = __rlim_t; + +cfg_if! { + if #[cfg(any(target_pointer_width = "64", gnu_file_offset_bits64))] { + pub type rlim_t = __rlim64_t; + } else { + pub type rlim_t = __rlim_t; + } +} + +// FIXME(1.0,deprecate,64): lfs binding to be removed pub type rlim64_t = __rlim64_t; pub type __rusage_who = c_int; @@ -226,6 +266,7 @@ pub type nl_item = c_int; pub type iconv_t = *mut c_void; extern_ty! { + // FIXME(1.0,deprecate,64): lfs binding to be removed pub type fpos64_t; // FIXME(hurd): fill this out with a struct pub type timezone; } @@ -350,13 +391,14 @@ s! { } pub struct dirent { - pub d_ino: __ino_t, + pub d_ino: ino_t, pub d_reclen: c_ushort, pub d_type: c_uchar, pub d_namlen: c_uchar, pub d_name: [c_char; 1usize], } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct dirent64 { pub d_ino: __ino64_t, pub d_reclen: c_ushort, @@ -449,24 +491,39 @@ s! { pub struct stat { pub st_fstype: c_int, pub st_dev: __fsid_t, /* Actually st_fsid */ - pub st_ino: __ino_t, + pub st_ino: ino_t, pub st_gen: c_uint, pub st_rdev: __dev_t, pub st_mode: __mode_t, pub st_nlink: __nlink_t, pub st_uid: __uid_t, pub st_gid: __gid_t, - pub st_size: __off_t, - pub st_atim: crate::timespec, - pub st_mtim: crate::timespec, - pub st_ctim: crate::timespec, + pub st_size: off_t, + pub st_atim: timespec, + pub st_mtim: timespec, + pub st_ctim: timespec, pub st_blksize: __blksize_t, - pub st_blocks: __blkcnt_t, + pub st_blocks: blkcnt_t, pub st_author: __uid_t, pub st_flags: c_uint, - pub st_spare: [c_int; 11usize], + st_spare: Padding< + [c_int; if cfg!(not(gnu_file_offset_bits64)) { + if size_of::<__fsid_t>() == size_of::() { + 12 + } else { + 11 + } + } else { + if size_of::<__fsid_t>() == size_of::() { + 9 + } else { + 8 + } + }], + >, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct stat64 { pub st_fstype: c_int, pub st_dev: __fsid_t, /* Actually st_fsid */ @@ -478,14 +535,20 @@ s! { pub st_uid: __uid_t, pub st_gid: __gid_t, pub st_size: __off64_t, - pub st_atim: crate::timespec, - pub st_mtim: crate::timespec, - pub st_ctim: crate::timespec, + pub st_atim: timespec, + pub st_mtim: timespec, + pub st_ctim: timespec, pub st_blksize: __blksize_t, pub st_blocks: __blkcnt64_t, pub st_author: __uid_t, pub st_flags: c_uint, - pub st_spare: [c_int; 8usize], + st_spare: Padding< + [c_int; if size_of::<__fsid_t>() == size_of::() { + 9 + } else { + 8 + }], + >, } pub struct statx { @@ -521,19 +584,20 @@ s! { pub struct statfs { pub f_type: c_uint, pub f_bsize: c_ulong, - pub f_blocks: __fsblkcnt_t, - pub f_bfree: __fsblkcnt_t, - pub f_bavail: __fsblkcnt_t, - pub f_files: __fsblkcnt_t, - pub f_ffree: __fsblkcnt_t, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsblkcnt_t, + pub f_ffree: fsblkcnt_t, pub f_fsid: __fsid_t, pub f_namelen: c_ulong, - pub f_favail: __fsfilcnt_t, + pub f_favail: fsfilcnt_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct statfs64 { pub f_type: c_uint, pub f_bsize: c_ulong, @@ -547,25 +611,26 @@ s! { pub f_favail: __fsfilcnt64_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct statvfs { pub __f_type: c_uint, pub f_bsize: c_ulong, - pub f_blocks: __fsblkcnt_t, - pub f_bfree: __fsblkcnt_t, - pub f_bavail: __fsblkcnt_t, - pub f_files: __fsfilcnt_t, - pub f_ffree: __fsfilcnt_t, + pub f_blocks: fsblkcnt_t, + pub f_bfree: fsblkcnt_t, + pub f_bavail: fsblkcnt_t, + pub f_files: fsfilcnt_t, + pub f_ffree: fsfilcnt_t, pub f_fsid: __fsid_t, pub f_namemax: c_ulong, - pub f_favail: __fsfilcnt_t, + pub f_favail: fsfilcnt_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct statvfs64 { pub __f_type: c_uint, pub f_bsize: c_ulong, @@ -579,7 +644,7 @@ s! { pub f_favail: __fsfilcnt64_t, pub f_frsize: c_ulong, pub f_flag: c_ulong, - pub f_spare: [c_uint; 3usize], + f_spare: Padding<[c_uint; 3usize]>, } pub struct aiocb { @@ -628,6 +693,7 @@ s! { pub __pshared: __pthread_process_shared, pub __mutex_type: __pthread_mutex_type, } + pub struct __pthread_mutex { pub __lock: c_uint, pub __owner_id: c_uint, @@ -866,6 +932,7 @@ s! { pub domainname: [c_char; _UTSNAME_LENGTH], } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -893,25 +960,30 @@ s! { pub l_type: c_int, #[cfg(target_pointer_width = "32")] pub l_whence: c_int, + #[cfg(target_pointer_width = "64")] pub l_type: c_short, #[cfg(target_pointer_width = "64")] pub l_whence: c_short, - pub l_start: __off_t, - pub l_len: __off_t, + + pub l_start: off_t, + pub l_len: off_t, pub l_pid: __pid_t, } + // FIXME(1.0,deprecate,64): lfs binding to be removed pub struct flock64 { #[cfg(target_pointer_width = "32")] pub l_type: c_int, #[cfg(target_pointer_width = "32")] pub l_whence: c_int, + #[cfg(target_pointer_width = "64")] pub l_type: c_short, #[cfg(target_pointer_width = "64")] pub l_whence: c_short, - pub l_start: __off_t, + + pub l_start: __off64_t, pub l_len: __off64_t, pub l_pid: __pid_t, } @@ -929,6 +1001,10 @@ s! { __unused5: Padding<*mut c_void>, } + #[deprecated( + since = "0.2.187", + note = "Use `glob_t` instead. The definitions are equivalent." + )] pub struct glob64_t { pub gl_pathc: size_t, pub gl_pathv: *mut *mut c_char, @@ -954,10 +1030,7 @@ s! { } pub struct cpu_set_t { - #[cfg(all(target_pointer_width = "32", not(target_arch = "x86_64")))] - bits: [u32; 32], - #[cfg(not(all(target_pointer_width = "32", not(target_arch = "x86_64"))))] - bits: [u64; 16], + __bits: [__cpu_mask; __CPU_SETSIZE / __NCPUBITS], } pub struct if_nameindex { @@ -1068,6 +1141,23 @@ impl siginfo_t { } } +s_no_extra_traits! { + pub struct fpos_t { + __pos: off_t, + __state: __mbstate_t, + } + + struct __mbstate_t { + __count: c_int, + __value: __c_anonymous___mbstate_t___value, + } + + union __c_anonymous___mbstate_t___value { + __wch: c_int, + __wchb: [c_char; 4], + } +} + // const // aio.h @@ -1189,10 +1279,18 @@ pub const __PTHREAD_SPIN_LOCK_INITIALIZER: c_int = 0; pub const PTHREAD_MUTEX_NORMAL: c_int = 0; // sys/resource.h -pub const RLIM_INFINITY: crate::rlim_t = 2147483647; -pub const RLIM64_INFINITY: crate::rlim64_t = 9223372036854775807; -pub const RLIM_SAVED_MAX: crate::rlim_t = RLIM_INFINITY; -pub const RLIM_SAVED_CUR: crate::rlim_t = RLIM_INFINITY; +cfg_if! { + if #[cfg(gnu_file_offset_bits64)] { + pub const RLIM_INFINITY: rlim64_t = 0x7fffffffffffffff; + } else { + pub const RLIM_INFINITY: rlim_t = -1_isize as rlim_t; + } +} + +// FIXME(1.0,deprecate,64): lfs binding to be removed +pub const RLIM64_INFINITY: rlim64_t = 0x7fffffffffffffff; +pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY; +pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY; pub const PRIO_MIN: c_int = -20; pub const PRIO_MAX: c_int = 20; @@ -2481,6 +2579,7 @@ pub const SCHED_FIFO: c_int = 1; pub const SCHED_RR: c_int = 2; pub const _BITS_TYPES_STRUCT_SCHED_PARAM: usize = 1; pub const __CPU_SETSIZE: usize = 1024; +pub const __NCPUBITS: usize = 8 * size_of::<__cpu_mask>(); pub const CPU_SETSIZE: usize = 1024; // pthread.h @@ -3416,36 +3515,36 @@ f! { pub unsafe fn CPU_ALLOC_SIZE(count: c_int) -> size_t { let _dummy: cpu_set_t = mem::zeroed(); - let size_in_bits = 8 * size_of_val(&_dummy.bits[0]); + let size_in_bits = 8 * size_of_val(&_dummy.__bits[0]); ((count as size_t + size_in_bits - 1) / 8) as size_t } pub unsafe fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { - cpuset.bits.fill(0); + cpuset.__bits.fill(0); } pub unsafe fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] |= 1 << offset; + cpuset.__bits[idx] |= 1 << offset; } pub unsafe fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); // 32, 64 etc + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); // 32, 64 etc let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - cpuset.bits[idx] &= !(1 << offset); + cpuset.__bits[idx] &= !(1 << offset); } pub unsafe fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { - let size_in_bits = 8 * size_of_val(&cpuset.bits[0]); + let size_in_bits = 8 * size_of_val(&cpuset.__bits[0]); let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); - 0 != (cpuset.bits[idx] & (1 << offset)) + 0 != (cpuset.__bits[idx] & (1 << offset)) } pub unsafe fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int { let mut s: u32 = 0; - let size_of_mask = size_of_val(&cpuset.bits[0]); - for i in cpuset.bits[..(size / size_of_mask)].iter() { + let size_of_mask = size_of_val(&cpuset.__bits[0]); + for i in cpuset.__bits[..(size / size_of_mask)].iter() { s += i.count_ones(); } s as c_int @@ -3456,7 +3555,7 @@ f! { } pub unsafe fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { - set1.bits == set2.bits + set1.__bits == set2.__bits } pub unsafe fn IPTOS_TOS(tos: u8) -> u8 { @@ -3545,27 +3644,33 @@ extern "C" { pub fn dup3(oldfd: c_int, newfd: c_int, flags: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off64_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pwrite64(fd: c_int, buf: *const c_void, count: size_t, offset: off64_t) -> ssize_t; pub fn readv(__fd: c_int, __iovec: *const crate::iovec, __count: c_int) -> ssize_t; pub fn writev(__fd: c_int, __iovec: *const crate::iovec, __count: c_int) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "preadv64")] pub fn preadv( __fd: c_int, __iovec: *const crate::iovec, __count: c_int, - __offset: __off_t, + __offset: off_t, ) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "pwritev64")] pub fn pwritev( __fd: c_int, __iovec: *const crate::iovec, __count: c_int, - __offset: __off_t, + __offset: off_t, ) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn preadv64(fd: c_int, iov: *const crate::iovec, iovcnt: c_int, offset: off64_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn pwritev64( fd: c_int, iov: *const crate::iovec, @@ -3634,13 +3739,18 @@ extern "C" { oldattr: *mut crate::mq_attr, ) -> c_int; - pub fn lseek64(__fd: c_int, __offset: __off64_t, __whence: c_int) -> __off64_t; - - pub fn lseek(__fd: c_int, __offset: __off_t, __whence: c_int) -> __off_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn lseek64(__fd: c_int, __offset: off64_t, __whence: c_int) -> off64_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed + #[allow(clashing_extern_declarations)] pub fn fgetpos64(stream: *mut crate::FILE, ptr: *mut fpos64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fseeko64(stream: *mut crate::FILE, offset: off64_t, whence: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + #[allow(clashing_extern_declarations)] pub fn fsetpos64(stream: *mut crate::FILE, ptr: *const fpos64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn ftello64(stream: *mut crate::FILE) -> off64_t; pub fn bind(__fd: c_int, __addr: *const sockaddr, __len: crate::socklen_t) -> c_int; @@ -3672,7 +3782,9 @@ extern "C" { addrlen: *mut crate::socklen_t, ) -> ssize_t; + #[cfg_attr(gnu_file_offset_bits64, link_name = "sendfile64")] pub fn sendfile(out_fd: c_int, in_fd: c_int, offset: *mut off_t, count: size_t) -> ssize_t; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn sendfile64(out_fd: c_int, in_fd: c_int, offset: *mut off64_t, count: size_t) -> ssize_t; pub fn shutdown(__fd: c_int, __how: c_int) -> c_int; @@ -4013,10 +4125,10 @@ extern "C" { old_value: *mut crate::itimerspec, ) -> c_int; - pub fn fstat(__fd: c_int, __buf: *mut stat) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstat64(__fd: c_int, __buf: *mut stat64) -> c_int; - pub fn fstatat(__fd: c_int, __file: *const c_char, __buf: *mut stat, __flag: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatat64( __fd: c_int, __file: *const c_char, @@ -4032,41 +4144,50 @@ extern "C" { statxbuf: *mut statx, ) -> c_int; - pub fn ftruncate(__fd: c_int, __length: __off_t) -> c_int; - pub fn ftruncate64(__fd: c_int, __length: __off64_t) -> c_int; - pub fn truncate64(__file: *const c_char, __length: __off64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn ftruncate64(__fd: c_int, __length: off64_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn truncate64(__file: *const c_char, __length: off64_t) -> c_int; - pub fn lstat(__file: *const c_char, __buf: *mut stat) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn lstat64(__file: *const c_char, __buf: *mut stat64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "statfs64")] pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn statfs64(__file: *const c_char, __buf: *mut statfs64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatfs64")] pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatfs64(__fildes: c_int, __buf: *mut statfs64) -> c_int; - pub fn statvfs(__file: *const c_char, __buf: *mut statvfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn statvfs64(__file: *const c_char, __buf: *mut statvfs64) -> c_int; - pub fn fstatvfs(__fildes: c_int, __buf: *mut statvfs) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fstatvfs64(__fildes: c_int, __buf: *mut statvfs64) -> c_int; - pub fn open(__file: *const c_char, __oflag: c_int, ...) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn open64(__file: *const c_char, __oflag: c_int, ...) -> c_int; - pub fn openat(__fd: c_int, __file: *const c_char, __oflag: c_int, ...) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn openat64(__fd: c_int, __file: *const c_char, __oflag: c_int, ...) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut crate::FILE; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn freopen64( filename: *const c_char, mode: *const c_char, file: *mut crate::FILE, ) -> *mut crate::FILE; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn creat64(path: *const c_char, mode: mode_t) -> c_int; pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int; pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int; pub fn mkstemps(template: *mut c_char, suffixlen: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn tmpfile64() -> *mut crate::FILE; pub fn popen(command: *const c_char, mode: *const c_char) -> *mut crate::FILE; @@ -4219,20 +4340,16 @@ extern "C" { pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; - pub fn stat(__file: *const c_char, __buf: *mut stat) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn stat64(__file: *const c_char, __buf: *mut stat64) -> c_int; - pub fn readdir(dirp: *mut crate::DIR) -> *mut crate::dirent; - pub fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64; - pub fn readdir_r( - dirp: *mut crate::DIR, - entry: *mut crate::dirent, - result: *mut *mut crate::dirent, - ) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn readdir64(dirp: *mut crate::DIR) -> *mut dirent64; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn readdir64_r( dirp: *mut crate::DIR, - entry: *mut crate::dirent64, - result: *mut *mut crate::dirent64, + entry: *mut dirent64, + result: *mut *mut dirent64, ) -> c_int; pub fn seekdir(dirp: *mut crate::DIR, loc: c_long); pub fn telldir(dirp: *mut crate::DIR) -> c_long; @@ -4244,13 +4361,14 @@ extern "C" { pub fn __errno_location() -> *mut c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn mmap64( __addr: *mut c_void, __len: size_t, __prot: c_int, __flags: c_int, __fd: c_int, - __offset: __off64_t, + __offset: off64_t, ) -> *mut c_void; pub fn mremap( @@ -4268,23 +4386,31 @@ extern "C" { pub fn syncfs(fd: c_int) -> c_int; pub fn fdatasync(fd: c_int) -> c_int; + #[deprecated(since = "0.2.187", note = "This routine doesn't exist upstream.")] pub fn fallocate64(fd: c_int, mode: c_int, offset: off64_t, len: off64_t) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fallocate64")] pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn posix_fallocate64(fd: c_int, offset: off64_t, len: off64_t) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fadvise64")] pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed pub fn posix_fadvise64(fd: c_int, offset: off64_t, len: off64_t, advise: c_int) -> c_int; pub fn madvise(__addr: *mut c_void, __len: size_t, __advice: c_int) -> c_int; pub fn posix_madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; - pub fn getrlimit(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; - pub fn getrlimit64(resource: crate::__rlimit_resource_t, rlim: *mut crate::rlimit64) -> c_int; - pub fn setrlimit(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; - pub fn setrlimit64(resource: crate::__rlimit_resource_t, rlim: *const crate::rlimit64) - -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "getrlimit64")] + pub fn getrlimit(resource: __rlimit_resource_t, rlim: *mut crate::rlimit) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn getrlimit64(resource: __rlimit_resource_t, rlim: *mut rlimit64) -> c_int; + #[cfg_attr(gnu_file_offset_bits64, link_name = "setrlimit64")] + pub fn setrlimit(resource: __rlimit_resource_t, rlim: *const crate::rlimit) -> c_int; + // FIXME(1.0,deprecate,64): lfs binding to be removed + pub fn setrlimit64(resource: __rlimit_resource_t, rlim: *const rlimit64) -> c_int; pub fn getpriority(which: crate::__priority_which, who: crate::id_t) -> c_int; pub fn setpriority(which: crate::__priority_which, who: crate::id_t, prio: c_int) -> c_int; @@ -4377,20 +4503,48 @@ extern "C" { pub fn regfree(preg: *mut crate::regex_t); + #[cfg_attr( + all(gnu_file_offset_bits64, gnu_time_bits64), + link_name = "__glob64_time64" + )] + #[cfg_attr( + all(gnu_file_offset_bits64, not(gnu_time_bits64)), + link_name = "glob64" + )] pub fn glob( pattern: *const c_char, flags: c_int, errfunc: Option c_int>, - pglob: *mut crate::glob_t, + pglob: *mut glob_t, ) -> c_int; - pub fn globfree(pglob: *mut crate::glob_t); - + #[cfg_attr( + all(gnu_file_offset_bits64, gnu_time_bits64), + link_name = "__globfree64_time64" + )] + #[cfg_attr( + all(gnu_file_offset_bits64, not(gnu_time_bits64)), + link_name = "globfree64" + )] + pub fn globfree(pglob: *mut glob_t); + + #[cfg_attr(gnu_time_bits64, link_name = "__glob64_time64")] + #[deprecated( + since = "0.2.187", + note = "Use `glob` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn glob64( pattern: *const c_char, flags: c_int, errfunc: Option c_int>, pglob: *mut glob64_t, ) -> c_int; + #[cfg_attr(gnu_time_bits64, link_name = "__globfree64_time64")] + #[deprecated( + since = "0.2.187", + note = "Use `globfree` instead. Their definitions are equivalent." + )] + #[allow(deprecated)] pub fn globfree64(pglob: *mut glob64_t); pub fn getxattr( diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 1f30ed060cb2..ea7055d16335 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -625,7 +625,10 @@ cfg_if! { } cfg_if! { - if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] { + if #[cfg(not(any( + target_os = "hurd", + all(target_os = "linux", target_env = "gnu") + )))] { extern_ty! { pub type fpos_t; // FIXME(unix): fill this out with a struct }