aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd/freebsdlike/freebsd/mod.rs')
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs374
1 files changed, 129 insertions, 245 deletions
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<H: ::hash::Hasher>(&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<H: ::hash::Hasher>(&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<H: ::hash::Hasher>(&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);
@@ -1452,6 +1326,16 @@ extern {
}
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;
pub use self::x86::*;