From 155f9b7e7f36975240ef93f3daf983b228592a11 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/freebsdlike/dragonfly/errno.rs | 12 ++++ libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 83 +++++++++++++----------- 2 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs (limited to 'libc/src/unix/bsd/freebsdlike/dragonfly') 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::*; + } +} -- cgit v1.2.1