aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/freebsdlike
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd/freebsdlike')
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs12
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs83
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs2
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs9
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs89
-rw-r--r--libc/src/unix/bsd/freebsdlike/mod.rs22
6 files changed, 136 insertions, 81 deletions
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<H: ::hash::Hasher>(&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<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_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,