From 99234b3e77889e370a24657aee729d43ff457156 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Thu, 15 Aug 2019 08:11:13 -0700 Subject: Update libc crate to 0.2.62 This change updates the libc crate to version 0.2.62. Import subrepo libc/:libc at 37f8f8dc233a79ea9cc89b102aa30ff6e402fe94 --- libc/src/unix/bsd/apple/b32.rs | 4 + libc/src/unix/bsd/apple/b64.rs | 4 + libc/src/unix/bsd/apple/mod.rs | 105 +++++++++++++-------- libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs | 12 +++ libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 83 ++++++++-------- .../unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs | 2 + .../unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 9 ++ libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 89 +++++++++-------- libc/src/unix/bsd/freebsdlike/mod.rs | 22 ++++- libc/src/unix/bsd/mod.rs | 9 +- libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 92 ++++++++++-------- libc/src/unix/bsd/netbsdlike/openbsd/mod.rs | 42 ++++----- 12 files changed, 287 insertions(+), 186 deletions(-) create mode 100644 libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs (limited to 'libc/src/unix/bsd') diff --git a/libc/src/unix/bsd/apple/b32.rs b/libc/src/unix/bsd/apple/b32.rs index 859809d..c05de30 100644 --- a/libc/src/unix/bsd/apple/b32.rs +++ b/libc/src/unix/bsd/apple/b32.rs @@ -81,6 +81,10 @@ cfg_if! { } } +#[doc(hidden)] +#[deprecated(since = "0.2.55")] +pub const NET_RT_MAXID: ::c_int = 10; + pub const __PTHREAD_MUTEX_SIZE__: usize = 40; pub const __PTHREAD_COND_SIZE__: usize = 24; pub const __PTHREAD_CONDATTR_SIZE__: usize = 4; diff --git a/libc/src/unix/bsd/apple/b64.rs b/libc/src/unix/bsd/apple/b64.rs index 7b89fc6..2749260 100644 --- a/libc/src/unix/bsd/apple/b64.rs +++ b/libc/src/unix/bsd/apple/b64.rs @@ -86,6 +86,10 @@ cfg_if! { } } +#[doc(hidden)] +#[deprecated(since = "0.2.55")] +pub const NET_RT_MAXID: ::c_int = 11; + pub const __PTHREAD_MUTEX_SIZE__: usize = 56; pub const __PTHREAD_COND_SIZE__: usize = 40; pub const __PTHREAD_CONDATTR_SIZE__: usize = 8; diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs index af28dba..24ad12b 100644 --- a/libc/src/unix/bsd/apple/mod.rs +++ b/libc/src/unix/bsd/apple/mod.rs @@ -144,6 +144,8 @@ s! { pub si_uid: ::uid_t, pub si_status: ::c_int, pub si_addr: *mut ::c_void, + //Requires it to be union for tests + //pub si_value: ::sigval, _pad: [usize; 9], } @@ -287,14 +289,6 @@ s! { pub int_n_sign_posn: ::c_char, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::pthread_attr_t - } - pub struct proc_taskinfo { pub pti_virtual_size: u64, pub pti_resident_size: u64, @@ -612,6 +606,36 @@ s_no_extra_traits!{ pub ut_host: [::c_char; _UTX_HOSTSIZE], ut_pad: [u32; 16], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::pthread_attr_t + } +} + +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + self.si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _si_pid: ::pid_t, + _si_uid: ::uid_t, + _si_status: ::c_int, + _si_addr: *mut ::c_void, + si_value: ::sigval, + } + + (*(self as *const siginfo_t as *const siginfo_timer)).si_value + } } cfg_if! { @@ -1159,6 +1183,39 @@ cfg_if! { self.ut_pad.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + + impl Eq for sigevent {} + + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -1704,11 +1761,6 @@ pub const TIOCPTYGRANT: ::c_uint = 0x20007454; pub const TIOCPTYGNAME: ::c_uint = 0x40807453; pub const TIOCPTYUNLK: ::c_uint = 0x20007452; -pub const FIONCLEX: ::c_uint = 0x20006602; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const FIODTYPE: ::c_ulong = 0x4004667a; pub const B0: speed_t = 0; @@ -2082,13 +2134,6 @@ pub const AF_SYSTEM: ::c_int = 32; pub const AF_NETBIOS: ::c_int = 33; pub const AF_PPP: ::c_int = 34; pub const pseudo_AF_HDRCMPLT: ::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 = 40; pub const AF_SYS_CONTROL: ::c_int = 2; pub const SYSPROTO_EVENT: ::c_int = 1; @@ -2129,30 +2174,10 @@ pub const PF_NATM: ::c_int = AF_NATM; pub const PF_SYSTEM: ::c_int = AF_SYSTEM; pub const PF_NETBIOS: ::c_int = AF_NETBIOS; pub const PF_PPP: ::c_int = AF_PPP; -#[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; - -#[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 NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; pub const NET_RT_IFLIST: ::c_int = 3; -#[doc(hidden)] -#[deprecated(since = "0.2.55")] -pub const NET_RT_MAXID: ::c_int = 10; pub const SOMAXCONN: ::c_int = 128; diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs new file mode 100644 index 0000000..e18036a --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs @@ -0,0 +1,12 @@ +// DragonFlyBSD's __error function is declared with "static inline", so it must +// be implemented in the libc crate, as a pointer to a static thread_local. +f! { + pub fn __error() -> *mut ::c_int { + &mut errno + } +} + +extern { + #[thread_local] + pub static mut errno: ::c_int; +} diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 26faffe..fc94fd3 100644 --- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -70,19 +70,6 @@ s! { pub mq_curmsgs: ::c_long, } - pub struct sigevent { - pub sigev_notify: ::c_int, - // The union is 8-byte in size, so it is aligned at a 8-byte offset. - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - pub sigev_signo: ::c_int, //actually a union - // pad the union - #[cfg(target_pointer_width = "64")] - __unused2: ::c_int, - pub sigev_value: ::sigval, - __unused3: *mut ::c_void //actually a function pointer - } - pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -234,6 +221,20 @@ s_no_extra_traits! { pub f_asyncreads: ::c_long, pub f_mntfromname: [::c_char; 90], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + // The union is 8-byte in size, so it is aligned at a 8-byte offset. + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + pub sigev_signo: ::c_int, //actually a union + // pad the union + #[cfg(target_pointer_width = "64")] + __unused2: ::c_int, + pub sigev_value: ::sigval, + __unused3: *mut ::c_void //actually a function pointer + } + } cfg_if! { @@ -408,6 +409,31 @@ cfg_if! { self.f_mntfromname.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + } + } } } @@ -891,23 +917,8 @@ 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; pub const NET_RT_FLAGS: ::c_int = 2; @@ -916,15 +927,6 @@ 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; pub const MSG_NOSIGNAL: ::c_int = 0x00000400; pub const MSG_SYNC: ::c_int = 0x00000800; @@ -1058,3 +1060,10 @@ extern { pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; } + +cfg_if! { + if #[cfg(libc_thread_local)] { + mod errno; + pub use self::errno::*; + } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 7d7dc2c..b71b284 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -189,6 +189,8 @@ cfg_if! { } } +pub const ELAST: ::c_int = 96; + extern { // Return type ::c_int was removed in FreeBSD 12 pub fn setgrent() -> ::c_int; diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index ab1b8d9..464744d 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -190,6 +190,15 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(freebsd13))] { + pub const ELAST: ::c_int = 96; + } else { + pub const EINTEGRITY: ::c_int = 97; + pub const ELAST: ::c_int = 97; + } +} + extern { pub fn setgrent(); pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index e594551..fea680d 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -46,18 +46,6 @@ s! { pub ip6: *mut ::in6_addr, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - //The rest of the structure is actually a union. We expose only - //sigev_notify_thread_id because it's the most useful union member. - pub sigev_notify_thread_id: ::lwpid_t, - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - __unused2: [::c_long; 7] - } - pub struct statvfs { pub f_bavail: ::fsblkcnt_t, pub f_bfree: ::fsblkcnt_t, @@ -151,6 +139,18 @@ s_no_extra_traits! { pub mq_curmsgs: ::c_long, __reserved: [::c_long; 4] } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + //The rest of the structure is actually a union. We expose only + //sigev_notify_thread_id because it's the most useful union member. + pub sigev_notify_thread_id: ::lwpid_t, + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + __unused2: [::c_long; 7] + } } cfg_if! { @@ -274,6 +274,36 @@ cfg_if! { self.mq_curmsgs.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_thread_id + == other.sigev_notify_thread_id + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_thread_id", + &self.sigev_notify_thread_id) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_thread_id.hash(state); + } + } } } @@ -303,7 +333,6 @@ pub const ENOTCAPABLE: ::c_int = 93; pub const ECAPMODE: ::c_int = 94; pub const ENOTRECOVERABLE: ::c_int = 95; pub const EOWNERDEAD: ::c_int = 96; -pub const ELAST: ::c_int = 96; pub const RLIMIT_NPTS: ::c_int = 11; pub const RLIMIT_SWAP: ::c_int = 12; pub const RLIMIT_KQUEUES: ::c_int = 13; @@ -540,14 +569,6 @@ pub const TIOCSIG: ::c_uint = 0x2004745f; pub const TIOCM_DCD: ::c_int = 0x40; pub const H4DISC: ::c_int = 0x7; -pub const FIONCLEX: ::c_ulong = 0x20006602; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; -pub const FIODTYPE: ::c_ulong = 0x4004667a; -pub const FIOGETLBA: ::c_ulong = 0x40046679; -pub const FIODGNAME: ::c_ulong = 0x80106678; pub const FIONWRITE: ::c_ulong = 0x40046677; pub const FIONSPACE: ::c_ulong = 0x40046676; pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; @@ -624,13 +645,6 @@ pub const AF_BLUETOOTH: ::c_int = 36; 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 pub const IFF_UP: ::c_int = 0x1; // (n) interface is up @@ -937,14 +951,6 @@ pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; 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; pub const NET_RT_FLAGS: ::c_int = 2; @@ -981,10 +987,6 @@ pub const SHM_ANON: *mut ::c_char = 1 as *mut ::c_char; // 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")] @@ -1329,9 +1331,14 @@ cfg_if! { if #[cfg(freebsd12)] { mod freebsd12; pub use self::freebsd12::*; - } else { + } else if #[cfg(freebsd13)] { + mod freebsd12; + pub use self::freebsd12::*; + } else if #[cfg(freebsd11)] { mod freebsd11; pub use self::freebsd11::*; + } else { + // Unknown freebsd version } } diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs index 64168eb..f937d77 100644 --- a/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/mod.rs @@ -21,6 +21,16 @@ impl ::Clone for timezone { fn clone(&self) -> timezone { *self } } +impl siginfo_t { + pub unsafe fn si_addr(&self) -> *mut ::c_void { + self.si_addr + } + + pub unsafe fn si_value(&self) -> ::sigval { + self.si_value + } +} + s! { pub struct in_addr { pub s_addr: ::in_addr_t, @@ -68,7 +78,9 @@ s! { pub si_uid: ::uid_t, pub si_status: ::c_int, pub si_addr: *mut ::c_void, - _pad: [::c_int; 12], + pub si_value: ::sigval, + _pad1: ::c_long, + _pad2: [::c_int; 7], } pub struct sigaction { @@ -997,6 +1009,10 @@ pub const SLIPDISC: ::c_int = 0x4; pub const PPPDISC: ::c_int = 0x5; pub const NETGRAPHDISC: ::c_int = 0x6; +pub const FIODTYPE: ::c_ulong = 0x4004667a; +pub const FIOGETLBA: ::c_ulong = 0x40046679; +pub const FIODGNAME: ::c_ulong = 0x80106678; + pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; @@ -1136,7 +1152,7 @@ extern { pub fn getutxline(ut: *const utmpx) -> *mut utmpx; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "kevent@FBSD_1.0" )] pub fn kevent(kq: ::c_int, @@ -1155,7 +1171,7 @@ extern { pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int; #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "mknodat@FBSD_1.1" )] pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs index 8bc6c7c..ee64411 100644 --- a/libc/src/unix/bsd/mod.rs +++ b/libc/src/unix/bsd/mod.rs @@ -233,7 +233,12 @@ pub const LC_TIME: ::c_int = 5; pub const LC_MESSAGES: ::c_int = 6; pub const FIOCLEX: ::c_ulong = 0x20006601; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONREAD: ::c_ulong = 0x4004667f; pub const FIONBIO: ::c_ulong = 0x8004667e; +pub const FIOASYNC: ::c_ulong = 0x8004667d; +pub const FIOSETOWN: ::c_ulong = 0x8004667c; +pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const PATH_MAX: ::c_int = 1024; @@ -531,7 +536,7 @@ extern { #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")] #[cfg_attr(target_os = "netbsd", link_name = "__glob30")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "glob@FBSD_1.0" )] pub fn glob(pattern: *const ::c_char, @@ -541,7 +546,7 @@ extern { pglob: *mut ::glob_t) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__globfree30")] #[cfg_attr( - all(target_os = "freebsd", not(freebsd12)), + all(target_os = "freebsd", freebsd11), link_name = "globfree@FBSD_1.0" )] pub fn globfree(pglob: *mut ::glob_t); diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs index 9d710eb..893b157 100644 --- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -9,6 +9,22 @@ pub type mqd_t = ::c_int; type __pthread_spin_t = __cpu_simple_lock_nv_t; pub type vm_size_t = ::uintptr_t; +impl siginfo_t { + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + __pad1: ::c_int, + _pid: ::pid_t, + _uid: ::uid_t, + value: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).value + } +} + s! { pub struct aiocb { pub aio_offset: ::off_t, @@ -46,14 +62,6 @@ s! { pub mq_curmsgs: ::c_long, } - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::c_void - } - pub struct sigset_t { __bits: [u32; 4], } @@ -356,6 +364,14 @@ s_no_extra_traits! { __ss_pad2: i64, __ss_pad3: [u8; 112], } + + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::c_void + } } cfg_if! { @@ -658,6 +674,36 @@ cfg_if! { self.__ss_pad3.hash(state); } } + + impl PartialEq for sigevent { + fn eq(&self, other: &sigevent) -> bool { + self.sigev_notify == other.sigev_notify + && self.sigev_signo == other.sigev_signo + && self.sigev_value == other.sigev_value + && self.sigev_notify_attributes + == other.sigev_notify_attributes + } + } + impl Eq for sigevent {} + impl ::fmt::Debug for sigevent { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigevent") + .field("sigev_notify", &self.sigev_notify) + .field("sigev_signo", &self.sigev_signo) + .field("sigev_value", &self.sigev_value) + .field("sigev_notify_attributes", + &self.sigev_notify_attributes) + .finish() + } + } + impl ::hash::Hash for sigevent { + fn hash(&self, state: &mut H) { + self.sigev_notify.hash(state); + self.sigev_signo.hash(state); + self.sigev_value.hash(state); + self.sigev_notify_attributes.hash(state); + } + } } } @@ -853,22 +899,6 @@ pub const AF_BLUETOOTH: ::c_int = 31; pub const AF_IEEE80211: ::c_int = 32; pub const AF_MPLS: ::c_int = 33; pub const AF_ROUTE: ::c_int = 34; -#[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; - -#[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 NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; pub const NET_RT_OOOIFLIST: ::c_int = 3; @@ -884,15 +914,6 @@ pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; pub const PF_MPLS: ::c_int = AF_MPLS; pub const PF_ROUTE: ::c_int = AF_ROUTE; -#[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 MSG_NBIO: ::c_int = 0x1000; pub const MSG_WAITFORONE: ::c_int = 0x2000; pub const MSG_NOTIFICATION: ::c_int = 0x4000; @@ -1347,14 +1368,9 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS; pub const SOCK_CLOEXEC: ::c_int = 0x10000000; pub const SOCK_NONBLOCK: ::c_int = 0x20000000; -pub const FIONCLEX: ::c_ulong = 0x20006602; // Uncomment on next NetBSD release // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662; -pub const FIONREAD: ::c_ulong = 0x4004667f; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const OFIOGETBMAP: ::c_ulong = 0xc004667a; pub const FIOGETBMAP: ::c_ulong = 0xc008667a; pub const FIONWRITE: ::c_ulong = 0x40046679; diff --git a/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs index 09739cb..a397d58 100644 --- a/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -308,6 +308,21 @@ s! { } } +impl siginfo_t { + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + _pid: ::pid_t, + _uid: ::uid_t, + value: ::sigval, + } + (*(self as *const siginfo_t as *const siginfo_timer)).value + } +} + s_no_extra_traits! { pub struct dirent { pub d_fileno: ::ino_t, @@ -834,22 +849,6 @@ pub const AF_BLUETOOTH: ::c_int = 32; pub const AF_MPLS: ::c_int = 33; pub const pseudo_AF_PFLOW: ::c_int = 34; pub const pseudo_AF_PIPEX: ::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; - -#[doc(hidden)] -#[allow(deprecated)] -#[deprecated( - since = "0.2.55", - note = "If you are using this report to: \ - https://github.com/rust-lang/libc/issues/665" -)] -pub const NET_MAXID: ::c_int = AF_MAX; pub const NET_RT_DUMP: ::c_int = 1; pub const NET_RT_FLAGS: ::c_int = 2; pub const NET_RT_IFLIST: ::c_int = 3; @@ -872,14 +871,6 @@ pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH; pub const PF_MPLS: ::c_int = AF_MPLS; pub const PF_PFLOW: ::c_int = pseudo_AF_PFLOW; pub const PF_PIPEX: ::c_int = pseudo_AF_PIPEX; -#[doc(hidden)] -#[allow(deprecated)] -#[deprecated( - since = "0.2.55", - note = "If you are using this report to: \ - https://github.com/rust-lang/libc/issues/665" -)] -pub const PF_MAX: ::c_int = AF_MAX; pub const SCM_TIMESTAMP: ::c_int = 0x04; @@ -1192,7 +1183,8 @@ pub const KERN_CONSBUF: ::c_int = 83; pub const KERN_AUDIO: ::c_int = 84; pub const KERN_CPUSTATS: ::c_int = 85; pub const KERN_PFSTATUS: ::c_int = 86; -pub const KERN_MAXID: ::c_int = 87; +pub const KERN_TIMEOUT_STATS: ::c_int = 87; +pub const KERN_MAXID: ::c_int = 88; pub const KERN_PROC_ALL: ::c_int = 0; pub const KERN_PROC_PID: ::c_int = 1; -- cgit v1.2.1