From 61f2baa0af6b2a54e0c109e5f73c8ff25f9f2ca6 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sat, 1 Jun 2019 11:46:58 -0700 Subject: Update libc crate to 0.2.57 This change updates the libc crate to version 0.2.57. Import subrepo libc/:libc at cdc48ea36d8d2890dba38e8f779001e6855339a2 --- libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 148 ++++---- libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 4 +- libc/src/unix/bsd/freebsdlike/freebsd/arm.rs | 4 +- .../unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs | 214 ++++++++++++ .../bsd/freebsdlike/freebsd/freebsd11/x86_64.rs | 30 ++ .../unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 207 ++++++++++++ .../bsd/freebsdlike/freebsd/freebsd12/x86_64.rs | 32 ++ libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 374 +++++++-------------- libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 4 +- libc/src/unix/bsd/freebsdlike/freebsd/x86.rs | 4 +- libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs | 26 -- libc/src/unix/bsd/freebsdlike/mod.rs | 27 +- 12 files changed, 723 insertions(+), 351 deletions(-) create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs (limited to 'libc/src/unix/bsd/freebsdlike') diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs index e91b351..26faffe 100644 --- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1,3 +1,4 @@ +pub type dev_t = u32; pub type c_char = i8; pub type clock_t = u64; pub type ino_t = u64; @@ -27,6 +28,15 @@ impl ::Clone for sem { } s! { + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + } + pub struct exit_status { pub e_termination: u16, pub e_exit: u16 @@ -100,7 +110,7 @@ s! { pub st_nlink: ::nlink_t, pub st_dev: ::dev_t, pub st_mode: ::mode_t, - pub st_padding1: ::uint16_t, + pub st_padding1: u16, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::dev_t, @@ -111,13 +121,13 @@ s! { pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, pub st_size: ::off_t, - pub st_blocks: ::int64_t, - pub st_blksize: ::uint32_t, - pub st_flags: ::uint32_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, - pub st_qspare1: ::int64_t, - pub st_qspare2: ::int64_t, + pub st_blocks: i64, + pub st_blksize: u32, + pub st_flags: u32, + pub st_gen: u32, + pub st_lspare: i32, + pub st_qspare1: i64, + pub st_qspare2: i64, } pub struct if_data { @@ -214,8 +224,8 @@ s_no_extra_traits! { pub f_ffree: ::c_long, pub f_fsid: ::fsid_t, pub f_owner: ::uid_t, - pub f_type: ::int32_t, - pub f_flags: ::int32_t, + pub f_type: i32, + pub f_flags: i32, pub f_syncwrites: ::c_long, pub f_asyncwrites: ::c_long, pub f_fstypename: [::c_char; 16], @@ -567,55 +577,55 @@ pub const CTL_P1003_1B_SIGQUEUE_MAX: ::c_int = 24; pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25; pub const CTL_P1003_1B_MAXID: ::c_int = 26; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_WRITE: ::int16_t = -2; -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_EXCEPT: ::int16_t = -8; -pub const EVFILT_USER: ::int16_t = -9; -pub const EVFILT_FS: ::int16_t = -10; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_NODATA: ::uint16_t = 0x1000; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; -pub const NOTE_FFNOP: ::uint32_t = 0x00000000; -pub const NOTE_FFAND: ::uint32_t = 0x40000000; -pub const NOTE_FFOR: ::uint32_t = 0x80000000; -pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; -pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; -pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_OOB: ::uint32_t = 0x00000002; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_EXCEPT: i16 = -8; +pub const EVFILT_USER: i16 = -9; +pub const EVFILT_FS: i16 = -10; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_NODATA: u16 = 0x1000; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_OOB: u32 = 0x00000002; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; pub const SO_SNDSPACE: ::c_int = 0x100a; pub const SO_CPUHINT: ::c_int = 0x1030; @@ -881,9 +891,22 @@ pub const TCP_FASTKEEP: ::c_int = 128; pub const AF_BLUETOOTH: ::c_int = 33; pub const AF_MPLS: ::c_int = 34; pub const AF_IEEE80211: ::c_int = 35; +#[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] pub const AF_MAX: ::c_int = 36; pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; +#[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] +#[allow(deprecated)] pub const PF_MAX: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; @@ -894,6 +917,12 @@ pub const NET_RT_MAXID: ::c_int = 4; pub const SOMAXOPT_SIZE: ::c_int = 65536; #[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] +#[allow(deprecated)] pub const NET_MAXID: ::c_int = AF_MAX; pub const MSG_UNUSED09: ::c_int = 0x00000200; @@ -1008,6 +1037,7 @@ f! { } extern { + pub fn setgrent(); pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs index 996abc5..22fd2b8 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs @@ -23,8 +23,8 @@ s! { pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, } diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs b/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs index 945aca9..b7480aa 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -26,8 +26,8 @@ s! { pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, pub st_birthtime_pad: ::c_long, diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs new file mode 100644 index 0000000..7d7dc2c --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -0,0 +1,214 @@ +// APIs that had breaking changes after FreeBSD 11 + +// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12: +pub type nlink_t = u16; +// Type of `dev_t` changed from `u32` to `u64` in FreeBSD 12: +pub type dev_t = u32; +// Type of `ino_t` changed from `unsigned int` to `unsigned long` in FreeBSD 12: +pub type ino_t = u32; + +s! { + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + } + + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + // Type of shm_nattc changed from `int` to `shmatt_t` (aka `unsigned + // int`) in FreeBSD 12: + pub shm_nattch: ::c_int, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_fileno: ::ino_t, + pub d_reclen: u16, + pub d_type: u8, + // Type of `d_namlen` changed from `char` to `u16` in FreeBSD 12: + pub d_namlen: u8, + pub d_name: [::c_char; 256], + } + + pub struct statfs { + pub f_version: u32, + pub f_type: u32, + pub f_flags: u64, + pub f_bsize: u64, + pub f_iosize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: i64, + pub f_files: u64, + pub f_ffree: i64, + pub f_syncwrites: u64, + pub f_asyncwrites: u64, + pub f_syncreads: u64, + pub f_asyncreads: u64, + f_spare: [u64; 10], + pub f_namemax: u32, + pub f_owner: ::uid_t, + pub f_fsid: ::fsid_t, + f_charspare: [::c_char; 80], + pub f_fstypename: [::c_char; 16], + // Array length changed from 88 to 1024 in FreeBSD 12: + pub f_mntfromname: [::c_char; 88], + // Array length changed from 88 to 1024 in FreeBSD 12: + pub f_mntonname: [::c_char; 88], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_version == other.f_version + && self.f_type == other.f_type + && self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_syncwrites == other.f_syncwrites + && self.f_asyncwrites == other.f_asyncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncreads == other.f_asyncreads + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_fsid == other.f_fsid + && self.f_fstypename == other.f_fstypename + && self + .f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self + .f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for statfs {} + impl ::fmt::Debug for statfs { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("statfs") + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_fsid", &self.f_fsid) + .field("f_fstypename", &self.f_fstypename) + .field("f_mntfromname", &&self.f_mntfromname[..]) + .field("f_mntonname", &&self.f_mntonname[..]) + .finish() + } + } + impl ::hash::Hash for statfs { + fn hash(&self, state: &mut H) { + self.f_version.hash(state); + self.f_type.hash(state); + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_syncwrites.hash(state); + self.f_asyncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncreads.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_fsid.hash(state); + self.f_fstypename.hash(state); + self.f_mntfromname.hash(state); + self.f_mntonname.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name[..self.d_namlen as _] + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent {} + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + .field("d_name", &&self.d_name[..self.d_namlen as _]) + .finish() + } + } + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name[..self.d_namlen as _].hash(state); + } + } + } +} + +extern { + // Return type ::c_int was removed in FreeBSD 12 + pub fn setgrent() -> ::c_int; + + // Type of `addr` argument changed from `const void*` to `void*` + // in FreeBSD 12 + pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + + // Return type ::c_int was removed in FreeBSD 12 + pub fn freelocale(loc: ::locale_t) -> ::c_int; + + // Return type ::c_int changed to ::ssize_t in FreeBSD 12: + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs new file mode 100644 index 0000000..bba277e --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs @@ -0,0 +1,30 @@ +#[repr(C)] +#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] +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_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_size: ::off_t, + pub st_blocks: ::blkcnt_t, + pub st_blksize: ::blksize_t, + pub st_flags: ::fflags_t, + pub st_gen: u32, + pub st_lspare: i32, + pub st_birthtime: ::time_t, + pub st_birthtime_nsec: ::c_long, +} + +impl ::Copy for ::stat {} +impl ::Clone for ::stat { + fn clone(&self) -> ::stat { *self } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs new file mode 100644 index 0000000..ab1b8d9 --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -0,0 +1,207 @@ +// APIs that changed in FreeBSD12 + +pub type nlink_t = u64; +pub type dev_t = u64; +pub type ino_t = ::c_ulong; +pub type shmatt_t = ::c_uint; + +s! { + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + } + + pub struct kevent { + pub ident: ::uintptr_t, + pub filter: ::c_short, + pub flags: ::c_ushort, + pub fflags: ::c_uint, + pub data: ::intptr_t, + pub udata: *mut ::c_void, + pub ext: [u64; 4], + } +} + +s_no_extra_traits! { + pub struct dirent { + pub d_fileno: ::ino_t, + pub d_off: ::off_t, + pub d_reclen: u16, + pub d_type: u8, + d_pad0: u8, + pub d_namlen: u16, + d_pad1: u16, + pub d_name: [::c_char; 256], + } + + pub struct statfs { + pub f_version: u32, + pub f_type: u32, + pub f_flags: u64, + pub f_bsize: u64, + pub f_iosize: u64, + pub f_blocks: u64, + pub f_bfree: u64, + pub f_bavail: i64, + pub f_files: u64, + pub f_ffree: i64, + pub f_syncwrites: u64, + pub f_asyncwrites: u64, + pub f_syncreads: u64, + pub f_asyncreads: u64, + f_spare: [u64; 10], + pub f_namemax: u32, + pub f_owner: ::uid_t, + pub f_fsid: ::fsid_t, + f_charspare: [::c_char; 80], + pub f_fstypename: [::c_char; 16], + pub f_mntfromname: [::c_char; 1024], + pub f_mntonname: [::c_char; 1024], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for statfs { + fn eq(&self, other: &statfs) -> bool { + self.f_version == other.f_version + && self.f_type == other.f_type + && self.f_flags == other.f_flags + && self.f_bsize == other.f_bsize + && self.f_iosize == other.f_iosize + && self.f_blocks == other.f_blocks + && self.f_bfree == other.f_bfree + && self.f_bavail == other.f_bavail + && self.f_files == other.f_files + && self.f_ffree == other.f_ffree + && self.f_syncwrites == other.f_syncwrites + && self.f_asyncwrites == other.f_asyncwrites + && self.f_syncreads == other.f_syncreads + && self.f_asyncreads == other.f_asyncreads + && self.f_namemax == other.f_namemax + && self.f_owner == other.f_owner + && self.f_fsid == other.f_fsid + && self.f_fstypename == other.f_fstypename + && self + .f_mntfromname + .iter() + .zip(other.f_mntfromname.iter()) + .all(|(a,b)| a == b) + && self + .f_mntonname + .iter() + .zip(other.f_mntonname.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for statfs {} + impl ::fmt::Debug for statfs { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("statfs") + .field("f_bsize", &self.f_bsize) + .field("f_iosize", &self.f_iosize) + .field("f_blocks", &self.f_blocks) + .field("f_bfree", &self.f_bfree) + .field("f_bavail", &self.f_bavail) + .field("f_files", &self.f_files) + .field("f_ffree", &self.f_ffree) + .field("f_syncwrites", &self.f_syncwrites) + .field("f_asyncwrites", &self.f_asyncwrites) + .field("f_syncreads", &self.f_syncreads) + .field("f_asyncreads", &self.f_asyncreads) + .field("f_namemax", &self.f_namemax) + .field("f_owner", &self.f_owner) + .field("f_fsid", &self.f_fsid) + .field("f_fstypename", &self.f_fstypename) + .field("f_mntfromname", &&self.f_mntfromname[..]) + .field("f_mntonname", &&self.f_mntonname[..]) + .finish() + } + } + impl ::hash::Hash for statfs { + fn hash(&self, state: &mut H) { + self.f_version.hash(state); + self.f_type.hash(state); + self.f_flags.hash(state); + self.f_bsize.hash(state); + self.f_iosize.hash(state); + self.f_blocks.hash(state); + self.f_bfree.hash(state); + self.f_bavail.hash(state); + self.f_files.hash(state); + self.f_ffree.hash(state); + self.f_syncwrites.hash(state); + self.f_asyncwrites.hash(state); + self.f_syncreads.hash(state); + self.f_asyncreads.hash(state); + self.f_namemax.hash(state); + self.f_owner.hash(state); + self.f_fsid.hash(state); + self.f_charspare.hash(state); + self.f_fstypename.hash(state); + self.f_mntfromname.hash(state); + self.f_mntonname.hash(state); + } + } + + impl PartialEq for dirent { + fn eq(&self, other: &dirent) -> bool { + self.d_fileno == other.d_fileno + && self.d_off == other.d_off + && self.d_reclen == other.d_reclen + && self.d_type == other.d_type + && self.d_namlen == other.d_namlen + && self + .d_name[..self.d_namlen as _] + .iter() + .zip(other.d_name.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for dirent {} + impl ::fmt::Debug for dirent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("dirent") + .field("d_fileno", &self.d_fileno) + .field("d_off", &self.d_off) + .field("d_reclen", &self.d_reclen) + .field("d_type", &self.d_type) + .field("d_namlen", &self.d_namlen) + .field("d_name", &&self.d_name[..self.d_namlen as _]) + .finish() + } + } + impl ::hash::Hash for dirent { + fn hash(&self, state: &mut H) { + self.d_fileno.hash(state); + self.d_off.hash(state); + self.d_reclen.hash(state); + self.d_type.hash(state); + self.d_namlen.hash(state); + self.d_name[..self.d_namlen as _].hash(state); + } + } + } +} + +extern { + pub fn setgrent(); + pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) + -> ::c_int; + pub fn freelocale(loc: ::locale_t); + pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, + msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; +} + +cfg_if! { + if #[cfg(target_arch = "x86_64")] { + mod x86_64; + pub use self::x86_64::*; + } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs new file mode 100644 index 0000000..dbaa4ae --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs @@ -0,0 +1,32 @@ +#[repr(C)] +#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] +pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_nlink: ::nlink_t, + pub st_mode: ::mode_t, + st_padding0: i16, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + st_padding1: i32, + pub st_rdev: ::dev_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_birthtime: ::time_t, + pub st_birthtime_nsec: ::c_long, + pub st_size: ::off_t, + pub st_blocks: ::blkcnt_t, + pub st_blksize: ::blksize_t, + pub st_flags: ::fflags_t, + pub st_gen: u64, + pub st_spare: [u64; 10], +} + +impl ::Copy for ::stat {} +impl ::Clone for ::stat { + fn clone(&self) -> ::stat { *self } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index 3ce96e8..e594551 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1,14 +1,13 @@ pub type fflags_t = u32; pub type clock_t = i32; -pub type ino_t = u32; + pub type lwpid_t = i32; -pub type nlink_t = u16; pub type blksize_t = i32; pub type clockid_t = ::c_int; pub type sem_t = _sem; -pub type fsblkcnt_t = ::uint64_t; -pub type fsfilcnt_t = ::uint64_t; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; pub type idtype_t = ::c_uint; pub type key_t = ::c_long; @@ -47,14 +46,6 @@ s! { pub ip6: *mut ::in6_addr, } - pub struct mq_attr { - pub mq_flags: ::c_long, - pub mq_maxmsg: ::c_long, - pub mq_msgsize: ::c_long, - pub mq_curmsgs: ::c_long, - __reserved: [::c_long; 4] - } - pub struct sigevent { pub sigev_notify: ::c_int, pub sigev_signo: ::c_int, @@ -110,17 +101,6 @@ s! { pub msg_ctime: ::time_t, } - pub struct shmid_ds { - pub shm_perm: ::ipc_perm, - pub shm_segsz: ::size_t, - pub shm_lpid: ::pid_t, - pub shm_cpid: ::pid_t, - pub shm_nattch: ::c_int, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - } - pub struct xucred { pub cr_version: ::c_uint, pub cr_uid: ::uid_t, @@ -153,39 +133,6 @@ s_no_extra_traits! { pub __ut_spare: [::c_char; 64], } - pub struct dirent { - pub d_fileno: u32, - pub d_reclen: u16, - pub d_type: u8, - pub d_namlen: u8, - pub d_name: [::c_char; 256], - } - - pub struct statfs { - pub f_version: ::uint32_t, - pub f_type: ::uint32_t, - pub f_flags: ::uint64_t, - pub f_bsize: ::uint64_t, - pub f_iosize: ::uint64_t, - pub f_blocks: ::uint64_t, - pub f_bfree: ::uint64_t, - pub f_bavail: ::int64_t, - pub f_files: ::uint64_t, - pub f_ffree: ::int64_t, - pub f_syncwrites: ::uint64_t, - pub f_asyncwrites: ::uint64_t, - pub f_syncreads: ::uint64_t, - pub f_asyncreads: ::uint64_t, - f_spare: [::uint64_t; 10], - pub f_namemax: ::uint32_t, - pub f_owner: ::uid_t, - pub f_fsid: ::fsid_t, - f_charspare: [::c_char; 80], - pub f_fstypename: [::c_char; 16], - pub f_mntfromname: [::c_char; 88], - pub f_mntonname: [::c_char; 88], - } - pub struct sockaddr_dl { pub sdl_len: ::c_uchar, pub sdl_family: ::c_uchar, @@ -196,6 +143,14 @@ s_no_extra_traits! { pub sdl_slen: ::c_uchar, pub sdl_data: [::c_char; 46], } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + __reserved: [::c_long; 4] + } } cfg_if! { @@ -248,132 +203,6 @@ cfg_if! { } } - impl PartialEq for dirent { - fn eq(&self, other: &dirent) -> bool { - self.d_fileno == other.d_fileno - && self.d_reclen == other.d_reclen - && self.d_type == other.d_type - && self.d_namlen == other.d_namlen - && self - .d_name - .iter() - .zip(other.d_name.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for dirent {} - impl ::fmt::Debug for dirent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("dirent") - .field("d_fileno", &self.d_fileno) - .field("d_reclen", &self.d_reclen) - .field("d_type", &self.d_type) - .field("d_namlen", &self.d_namlen) - // FIXME: .field("d_name", &self.d_name) - .finish() - } - } - impl ::hash::Hash for dirent { - fn hash(&self, state: &mut H) { - self.d_fileno.hash(state); - self.d_reclen.hash(state); - self.d_type.hash(state); - self.d_namlen.hash(state); - self.d_name.hash(state); - } - } - - impl PartialEq for statfs { - fn eq(&self, other: &statfs) -> bool { - self.f_version == other.f_version - && self.f_type == other.f_type - && self.f_flags == other.f_flags - && self.f_bsize == other.f_bsize - && self.f_iosize == other.f_iosize - && self.f_blocks == other.f_blocks - && self.f_bfree == other.f_bfree - && self.f_bavail == other.f_bavail - && self.f_files == other.f_files - && self.f_ffree == other.f_ffree - && self.f_syncwrites == other.f_syncwrites - && self.f_asyncwrites == other.f_asyncwrites - && self.f_syncreads == other.f_syncreads - && self.f_asyncreads == other.f_asyncreads - && self.f_spare == other.f_spare - && self.f_namemax == other.f_namemax - && self.f_owner == other.f_owner - && self.f_fsid == other.f_fsid - && self - .f_charspare - .iter() - .zip(other.f_charspare.iter()) - .all(|(a,b)| a == b) - && self.f_fstypename == other.f_fstypename - && self - .f_mntfromname - .iter() - .zip(other.f_mntfromname.iter()) - .all(|(a,b)| a == b) - && self - .f_mntonname - .iter() - .zip(other.f_mntonname.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for statfs {} - impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("statfs") - .field("f_bsize", &self.f_bsize) - .field("f_iosize", &self.f_iosize) - .field("f_blocks", &self.f_blocks) - .field("f_bfree", &self.f_bfree) - .field("f_bavail", &self.f_bavail) - .field("f_files", &self.f_files) - .field("f_ffree", &self.f_ffree) - .field("f_syncwrites", &self.f_syncwrites) - .field("f_asyncwrites", &self.f_asyncwrites) - .field("f_syncreads", &self.f_syncreads) - .field("f_asyncreads", &self.f_asyncreads) - .field("f_spare", &self.f_spare) - .field("f_namemax", &self.f_namemax) - .field("f_owner", &self.f_owner) - .field("f_fsid", &self.f_fsid) - // FIXME: .field("f_charspare", &self.f_charspare) - .field("f_fstypename", &self.f_fstypename) - // FIXME: .field("f_mntfromname", &self.f_mntfromname) - // FIXME: .field("f_mntonname", &self.f_mntonname) - .finish() - } - } - impl ::hash::Hash for statfs { - fn hash(&self, state: &mut H) { - self.f_version.hash(state); - self.f_type.hash(state); - self.f_flags.hash(state); - self.f_bsize.hash(state); - self.f_iosize.hash(state); - self.f_blocks.hash(state); - self.f_bfree.hash(state); - self.f_bavail.hash(state); - self.f_files.hash(state); - self.f_ffree.hash(state); - self.f_syncwrites.hash(state); - self.f_asyncwrites.hash(state); - self.f_syncreads.hash(state); - self.f_asyncreads.hash(state); - self.f_spare.hash(state); - self.f_namemax.hash(state); - self.f_owner.hash(state); - self.f_fsid.hash(state); - self.f_charspare.hash(state); - self.f_fstypename.hash(state); - self.f_mntfromname.hash(state); - self.f_mntonname.hash(state); - } - } - impl PartialEq for sockaddr_dl { fn eq(&self, other: &sockaddr_dl) -> bool { self.sdl_len == other.sdl_len @@ -417,6 +246,34 @@ cfg_if! { self.sdl_data.hash(state); } } + + impl PartialEq for mq_attr { + fn eq(&self, other: &mq_attr) -> bool { + self.mq_flags == other.mq_flags && + self.mq_maxmsg == other.mq_maxmsg && + self.mq_msgsize == other.mq_msgsize && + self.mq_curmsgs == other.mq_curmsgs + } + } + impl Eq for mq_attr {} + impl ::fmt::Debug for mq_attr { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mq_attr") + .field("mq_flags", &self.mq_flags) + .field("mq_maxmsg", &self.mq_maxmsg) + .field("mq_msgsize", &self.mq_msgsize) + .field("mq_curmsgs", &self.mq_curmsgs) + .finish() + } + } + impl ::hash::Hash for mq_attr { + fn hash(&self, state: &mut H) { + self.mq_flags.hash(state); + self.mq_maxmsg.hash(state); + self.mq_msgsize.hash(state); + self.mq_curmsgs.hash(state); + } + } } } @@ -465,61 +322,61 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const POLLINIGNEOF: ::c_short = 0x2000; -pub const EVFILT_READ: ::int16_t = -1; -pub const EVFILT_WRITE: ::int16_t = -2; -pub const EVFILT_AIO: ::int16_t = -3; -pub const EVFILT_VNODE: ::int16_t = -4; -pub const EVFILT_PROC: ::int16_t = -5; -pub const EVFILT_SIGNAL: ::int16_t = -6; -pub const EVFILT_TIMER: ::int16_t = -7; -pub const EVFILT_PROCDESC: ::int16_t = -8; -pub const EVFILT_FS: ::int16_t = -9; -pub const EVFILT_LIO: ::int16_t = -10; -pub const EVFILT_USER: ::int16_t = -11; -pub const EVFILT_SENDFILE: ::int16_t = -12; -pub const EVFILT_EMPTY: ::int16_t = -13; - -pub const EV_ADD: ::uint16_t = 0x1; -pub const EV_DELETE: ::uint16_t = 0x2; -pub const EV_ENABLE: ::uint16_t = 0x4; -pub const EV_DISABLE: ::uint16_t = 0x8; -pub const EV_ONESHOT: ::uint16_t = 0x10; -pub const EV_CLEAR: ::uint16_t = 0x20; -pub const EV_RECEIPT: ::uint16_t = 0x40; -pub const EV_DISPATCH: ::uint16_t = 0x80; -pub const EV_DROP: ::uint16_t = 0x1000; -pub const EV_FLAG1: ::uint16_t = 0x2000; -pub const EV_ERROR: ::uint16_t = 0x4000; -pub const EV_EOF: ::uint16_t = 0x8000; -pub const EV_SYSFLAGS: ::uint16_t = 0xf000; - -pub const NOTE_TRIGGER: ::uint32_t = 0x01000000; -pub const NOTE_FFNOP: ::uint32_t = 0x00000000; -pub const NOTE_FFAND: ::uint32_t = 0x40000000; -pub const NOTE_FFOR: ::uint32_t = 0x80000000; -pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000; -pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000; -pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff; -pub const NOTE_LOWAT: ::uint32_t = 0x00000001; -pub const NOTE_DELETE: ::uint32_t = 0x00000001; -pub const NOTE_WRITE: ::uint32_t = 0x00000002; -pub const NOTE_EXTEND: ::uint32_t = 0x00000004; -pub const NOTE_ATTRIB: ::uint32_t = 0x00000008; -pub const NOTE_LINK: ::uint32_t = 0x00000010; -pub const NOTE_RENAME: ::uint32_t = 0x00000020; -pub const NOTE_REVOKE: ::uint32_t = 0x00000040; -pub const NOTE_EXIT: ::uint32_t = 0x80000000; -pub const NOTE_FORK: ::uint32_t = 0x40000000; -pub const NOTE_EXEC: ::uint32_t = 0x20000000; -pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff; -pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000; -pub const NOTE_TRACK: ::uint32_t = 0x00000001; -pub const NOTE_TRACKERR: ::uint32_t = 0x00000002; -pub const NOTE_CHILD: ::uint32_t = 0x00000004; -pub const NOTE_SECONDS: ::uint32_t = 0x00000001; -pub const NOTE_MSECONDS: ::uint32_t = 0x00000002; -pub const NOTE_USECONDS: ::uint32_t = 0x00000004; -pub const NOTE_NSECONDS: ::uint32_t = 0x00000008; +pub const EVFILT_READ: i16 = -1; +pub const EVFILT_WRITE: i16 = -2; +pub const EVFILT_AIO: i16 = -3; +pub const EVFILT_VNODE: i16 = -4; +pub const EVFILT_PROC: i16 = -5; +pub const EVFILT_SIGNAL: i16 = -6; +pub const EVFILT_TIMER: i16 = -7; +pub const EVFILT_PROCDESC: i16 = -8; +pub const EVFILT_FS: i16 = -9; +pub const EVFILT_LIO: i16 = -10; +pub const EVFILT_USER: i16 = -11; +pub const EVFILT_SENDFILE: i16 = -12; +pub const EVFILT_EMPTY: i16 = -13; + +pub const EV_ADD: u16 = 0x1; +pub const EV_DELETE: u16 = 0x2; +pub const EV_ENABLE: u16 = 0x4; +pub const EV_DISABLE: u16 = 0x8; +pub const EV_ONESHOT: u16 = 0x10; +pub const EV_CLEAR: u16 = 0x20; +pub const EV_RECEIPT: u16 = 0x40; +pub const EV_DISPATCH: u16 = 0x80; +pub const EV_DROP: u16 = 0x1000; +pub const EV_FLAG1: u16 = 0x2000; +pub const EV_ERROR: u16 = 0x4000; +pub const EV_EOF: u16 = 0x8000; +pub const EV_SYSFLAGS: u16 = 0xf000; + +pub const NOTE_TRIGGER: u32 = 0x01000000; +pub const NOTE_FFNOP: u32 = 0x00000000; +pub const NOTE_FFAND: u32 = 0x40000000; +pub const NOTE_FFOR: u32 = 0x80000000; +pub const NOTE_FFCOPY: u32 = 0xc0000000; +pub const NOTE_FFCTRLMASK: u32 = 0xc0000000; +pub const NOTE_FFLAGSMASK: u32 = 0x00ffffff; +pub const NOTE_LOWAT: u32 = 0x00000001; +pub const NOTE_DELETE: u32 = 0x00000001; +pub const NOTE_WRITE: u32 = 0x00000002; +pub const NOTE_EXTEND: u32 = 0x00000004; +pub const NOTE_ATTRIB: u32 = 0x00000008; +pub const NOTE_LINK: u32 = 0x00000010; +pub const NOTE_RENAME: u32 = 0x00000020; +pub const NOTE_REVOKE: u32 = 0x00000040; +pub const NOTE_EXIT: u32 = 0x80000000; +pub const NOTE_FORK: u32 = 0x40000000; +pub const NOTE_EXEC: u32 = 0x20000000; +pub const NOTE_PDATAMASK: u32 = 0x000fffff; +pub const NOTE_PCTRLMASK: u32 = 0xf0000000; +pub const NOTE_TRACK: u32 = 0x00000001; +pub const NOTE_TRACKERR: u32 = 0x00000002; +pub const NOTE_CHILD: u32 = 0x00000004; +pub const NOTE_SECONDS: u32 = 0x00000001; +pub const NOTE_MSECONDS: u32 = 0x00000002; +pub const NOTE_USECONDS: u32 = 0x00000004; +pub const NOTE_NSECONDS: u32 = 0x00000008; pub const MADV_PROTECT: ::c_int = 10; pub const RUSAGE_THREAD: ::c_int = 1; @@ -768,6 +625,11 @@ pub const AF_IEEE80211: ::c_int = 37; pub const AF_INET_SDP: ::c_int = 40; pub const AF_INET6_SDP: ::c_int = 42; #[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] pub const AF_MAX: ::c_int = 42; // https://github.com/freebsd/freebsd/blob/master/sys/net/if.h#L140 @@ -779,14 +641,20 @@ pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link // 0x20 was IFF_SMART pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated #[doc(hidden)] -// IFF_DRV_RUNNING is deprecated. Use the portable `IFF_RUNNING` instead +#[deprecated( + since="0.2.54", + note="IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead" +)] pub const IFF_DRV_RUNNING: ::c_int = 0x40; pub const IFF_NOARP: ::c_int = 0x80; // (n) no address resolution protocol pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full #[doc(hidden)] -// IFF_DRV_OACTIVE is deprecated. Use the portable `IFF_OACTIVE` instead +#[deprecated( + since = "0.2.54", + note = "Use the portable `IFF_OACTIVE` instead", +)] pub const IFF_DRV_OACTIVE: ::c_int = 0x400; pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit @@ -1070,6 +938,12 @@ pub const PF_IEEE80211: ::c_int = AF_IEEE80211; pub const PF_INET_SDP: ::c_int = AF_INET_SDP; pub const PF_INET6_SDP: ::c_int = AF_INET6_SDP; #[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] +#[allow(deprecated)] pub const PF_MAX: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; @@ -1106,14 +980,20 @@ pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char; // they were all removed in svn r262489. They remain here for backwards // compatibility only, and are scheduled to be removed in libc 1.0.0. #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] +#[allow(deprecated)] pub const NET_MAXID: ::c_int = AF_MAX; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const CTL_MAXID: ::c_int = 10; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const KERN_MAXID: ::c_int = 38; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const HW_MAXID: ::c_int = 13; #[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const USER_MAXID: ::c_int = 21; #[doc(hidden)] pub const CTL_P1003_1B_MAXID: ::c_int = 26; @@ -1251,9 +1131,6 @@ f! { extern { pub fn __error() -> *mut ::c_int; - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; - pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; @@ -1335,7 +1212,6 @@ extern { timeout: *mut ::timespec) -> ::ssize_t; pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int; - pub fn freelocale(loc: ::locale_t) -> ::c_int; pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; @@ -1349,8 +1225,6 @@ extern { pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int; pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int; - pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, - msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int; pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, msgflg: ::c_int) -> ::c_int; pub fn cfmakesane(termios: *mut ::termios); @@ -1451,6 +1325,16 @@ extern { attrnamespace: *mut ::c_int) -> ::c_int; } +cfg_if! { + if #[cfg(freebsd12)] { + mod freebsd12; + pub use self::freebsd12::*; + } else { + mod freebsd11; + pub use self::freebsd11::*; + } +} + cfg_if! { if #[cfg(target_arch = "x86")] { mod x86; diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index 9d893b6..5c0c6e7 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -23,8 +23,8 @@ s! { pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, } diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs index 845124d..adec88c 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -23,8 +23,8 @@ s! { pub st_blocks: ::blkcnt_t, pub st_blksize: ::blksize_t, pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, + pub st_gen: u32, + pub st_lspare: i32, pub st_birthtime: ::time_t, pub st_birthtime_nsec: ::c_long, __unused: [u8; 8], diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs index 323d1ab..5220cde 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs @@ -4,32 +4,6 @@ pub type c_ulong = u64; pub type time_t = i64; pub type suseconds_t = i64; -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_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_size: ::off_t, - pub st_blocks: ::blkcnt_t, - pub st_blksize: ::blksize_t, - pub st_flags: ::fflags_t, - pub st_gen: ::uint32_t, - pub st_lspare: ::int32_t, - pub st_birthtime: ::time_t, - pub st_birthtime_nsec: ::c_long, - } -} - // should be pub(crate), but that requires Rust 1.18.0 cfg_if! { if #[cfg(libc_const_size_of)] { diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs index 7a82a45..64168eb 100644 --- a/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/mod.rs @@ -1,4 +1,3 @@ -pub type dev_t = u32; pub type mode_t = u16; pub type pthread_attr_t = *mut ::c_void; pub type rlim_t = i64; @@ -46,15 +45,6 @@ s! { __unused8: *mut ::c_void, } - pub struct kevent { - pub ident: ::uintptr_t, - pub filter: ::c_short, - pub flags: ::c_ushort, - pub fflags: ::c_uint, - pub data: ::intptr_t, - pub udata: *mut ::c_void, - } - pub struct addrinfo { pub ai_flags: ::c_int, pub ai_family: ::c_int, @@ -758,7 +748,11 @@ pub const LOCK_NB: ::c_int = 4; pub const LOCK_UN: ::c_int = 8; pub const MAP_COPY: ::c_int = 0x0002; +#[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const MAP_RENAME: ::c_int = 0x0020; +#[doc(hidden)] +#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] pub const MAP_NORESERVE: ::c_int = 0x0040; pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; pub const MAP_STACK: ::c_int = 0x0400; @@ -1095,7 +1089,8 @@ extern { -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - + pub fn gettimeofday(tp: *mut ::timeval, + tz: *mut ::timezone) -> ::c_int; pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; @@ -1140,7 +1135,10 @@ extern { pub fn getutxid(ut: *const utmpx) -> *mut utmpx; pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; - #[cfg_attr(target_os = "freebsd", link_name = "kevent@FBSD_1.0")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "kevent@FBSD_1.0" + )] pub fn kevent(kq: ::c_int, changelist: *const ::kevent, nchanges: ::c_int, @@ -1156,7 +1154,10 @@ extern { n: ::size_t) -> *mut ::c_void; pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; - #[cfg_attr(target_os = "freebsd", link_name = "mknodat@FBSD_1.1")] + #[cfg_attr( + all(target_os = "freebsd", not(freebsd12)), + link_name = "mknodat@FBSD_1.1" + )] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t, dev: dev_t) -> ::c_int; pub fn mq_close(mqd: ::mqd_t) -> ::c_int; -- cgit v1.2.1