aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/apple/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd/apple/mod.rs')
-rw-r--r--libc/src/unix/bsd/apple/mod.rs105
1 files changed, 65 insertions, 40 deletions
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<H: ::hash::Hasher>(&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;