diff options
Diffstat (limited to 'libc/src/unix/bsd/freebsdlike')
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs | 2 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 79 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs | 18 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs | 4 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs | 18 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs | 4 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 428 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs | 7 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs (renamed from libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs) | 7 | ||||
-rw-r--r-- | libc/src/unix/bsd/freebsdlike/mod.rs | 540 |
10 files changed, 712 insertions, 395 deletions
diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs index e18036a..e9ad63b 100644 --- a/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs +++ b/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs @@ -6,7 +6,7 @@ f! { } } -extern { +extern "C" { #[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 fc94fd3..63ca4db 100644 --- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -24,7 +24,9 @@ pub type sem_t = *mut sem; pub enum sem {} impl ::Copy for sem {} impl ::Clone for sem { - fn clone(&self) -> sem { *self } + fn clone(&self) -> sem { + *self + } } s! { @@ -451,6 +453,7 @@ pub const ENOMEDIUM: ::c_int = 93; pub const EASYNC: ::c_int = 99; pub const ELAST: ::c_int = 99; pub const RLIMIT_POSIXLOCKS: ::c_int = 11; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::rlim_t = 12; pub const Q_GETQUOTA: ::c_int = 0x300; @@ -676,7 +679,7 @@ pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast -// was interface is in polling mode + // was interface is in polling mode pub const IFF_POLLING_COMPAT: ::c_int = 0x10000; pub const IFF_PPROMISC: ::c_int = 0x20000; // user-requested promisc mode pub const IFF_MONITOR: ::c_int = 0x40000; // user-requested monitor mode @@ -910,9 +913,9 @@ pub const IPPROTO_DONE: ::c_int = 257; pub const IPPROTO_UNKNOWN: ::c_int = 258; // sys/netinet/tcp.h -pub const TCP_SIGNATURE_ENABLE: ::c_int = 16; -pub const TCP_KEEPINIT: ::c_int = 32; -pub const TCP_FASTKEEP: ::c_int = 128; +pub const TCP_SIGNATURE_ENABLE: ::c_int = 16; +pub const TCP_KEEPINIT: ::c_int = 32; +pub const TCP_FASTKEEP: ::c_int = 128; pub const AF_BLUETOOTH: ::c_int = 33; pub const AF_MPLS: ::c_int = 34; @@ -935,6 +938,7 @@ pub const MSG_FBLOCKING: ::c_int = 0x00010000; pub const MSG_FNONBLOCKING: ::c_int = 0x00020000; pub const MSG_FMASK: ::c_int = 0xFFFF0000; +// utmpx entry types pub const EMPTY: ::c_short = 0; pub const RUN_LVL: ::c_short = 1; pub const BOOT_TIME: ::c_short = 2; @@ -944,6 +948,13 @@ pub const INIT_PROCESS: ::c_short = 5; pub const LOGIN_PROCESS: ::c_short = 6; pub const USER_PROCESS: ::c_short = 7; pub const DEAD_PROCESS: ::c_short = 8; +pub const ACCOUNTING: ::c_short = 9; +pub const SIGNATURE: ::c_short = 10; +pub const DOWNTIME: ::c_short = 11; +// utmpx database types +pub const UTX_DB_UTMPX: ::c_uint = 0; +pub const UTX_DB_WTMPX: ::c_uint = 1; +pub const UTX_DB_LASTLOG: ::c_uint = 2; pub const LC_COLLATE_MASK: ::c_int = (1 << 0); pub const LC_CTYPE_MASK: ::c_int = (1 << 1); @@ -952,11 +963,11 @@ pub const LC_NUMERIC_MASK: ::c_int = (1 << 3); pub const LC_TIME_MASK: ::c_int = (1 << 4); pub const LC_MESSAGES_MASK: ::c_int = (1 << 5); pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK - | LC_CTYPE_MASK - | LC_MESSAGES_MASK - | LC_MONETARY_MASK - | LC_NUMERIC_MASK - | LC_TIME_MASK; + | LC_CTYPE_MASK + | LC_MESSAGES_MASK + | LC_MONETARY_MASK + | LC_NUMERIC_MASK + | LC_TIME_MASK; pub const TIOCSIG: ::c_uint = 0x2000745f; pub const BTUARTDISC: ::c_int = 0x7; @@ -967,11 +978,11 @@ pub const TIOCMODS: ::c_ulong = 0x80047404; pub const TIOCREMOTE: ::c_ulong = 0x80047469; // Constants used by "at" family of system calls. -pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor +pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1; -pub const AT_REMOVEDIR: ::c_int = 2; -pub const AT_EACCESS: ::c_int = 4; -pub const AT_SYMLINK_FOLLOW: ::c_int = 8; +pub const AT_REMOVEDIR: ::c_int = 2; +pub const AT_EACCESS: ::c_int = 4; +pub const AT_SYMLINK_FOLLOW: ::c_int = 8; pub const VCHECKPT: usize = 19; @@ -996,11 +1007,15 @@ pub const RTP_PRIO_THREAD: ::c_ushort = 3; // Flags for chflags(2) pub const UF_NOHISTORY: ::c_ulong = 0x00000040; -pub const UF_CACHE: ::c_ulong = 0x00000080; -pub const UF_XLINK: ::c_ulong = 0x00000100; +pub const UF_CACHE: ::c_ulong = 0x00000080; +pub const UF_XLINK: ::c_ulong = 0x00000100; pub const SF_NOHISTORY: ::c_ulong = 0x00400000; -pub const SF_CACHE: ::c_ulong = 0x00800000; -pub const SF_XLINK: ::c_ulong = 0x01000000; +pub const SF_CACHE: ::c_ulong = 0x00800000; +pub const SF_XLINK: ::c_ulong = 0x01000000; + +// timespec constants +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; fn _CMSG_ALIGN(n: usize) -> usize { (n + 3) & !3 @@ -1038,23 +1053,35 @@ f! { } } -extern { +extern "C" { pub fn setgrent(); - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; + pub fn mprotect( + addr: *mut ::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; + pub fn clock_settime( + clk_id: ::clockid_t, + tp: *const ::timespec, + ) -> ::c_int; pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int; - pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, - timeout: *mut ::timespec) -> ::c_int; + pub fn aio_waitcomplete( + iocbp: *mut *mut aiocb, + timeout: *mut ::timespec, + ) -> ::c_int; pub fn freelocale(loc: ::locale_t); - pub fn lwp_rtprio(function: ::c_int, pid: ::pid_t, lwpid: lwpid_t, - rtp: *mut super::rtprio) -> ::c_int; + pub fn lwp_rtprio( + function: ::c_int, + pid: ::pid_t, + lwpid: lwpid_t, + rtp: *mut super::rtprio, + ) -> ::c_int; pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index b71b284..79a152f 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -191,21 +191,29 @@ cfg_if! { pub const ELAST: ::c_int = 96; -extern { +extern "C" { // Return type ::c_int was removed in FreeBSD 12 pub fn setgrent() -> ::c_int; // Type of `addr` argument changed from `const void*` to `void*` // in FreeBSD 12 - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; + pub fn mprotect( + addr: *const ::c_void, + len: ::size_t, + prot: ::c_int, + ) -> ::c_int; // Return type ::c_int was removed in FreeBSD 12 pub fn freelocale(loc: ::locale_t) -> ::c_int; // Return type ::c_int changed to ::ssize_t in FreeBSD 12: - pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, - msgtyp: ::c_long, 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; } cfg_if! { diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs index bba277e..f32128f 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs @@ -26,5 +26,7 @@ pub struct stat { impl ::Copy for ::stat {} impl ::Clone for ::stat { - fn clone(&self) -> ::stat { *self } + fn clone(&self) -> ::stat { + *self + } } diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 464744d..6bf7f95 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -199,13 +199,21 @@ cfg_if! { } } -extern { +extern "C" { pub fn setgrent(); - pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; + pub fn mprotect( + addr: *mut ::c_void, + len: ::size_t, + prot: ::c_int, + ) -> ::c_int; pub fn freelocale(loc: ::locale_t); - pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t, - msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t; + pub fn msgrcv( + msqid: ::c_int, + msgp: *mut ::c_void, + msgsz: ::size_t, + msgtyp: ::c_long, + msgflg: ::c_int, + ) -> ::ssize_t; } cfg_if! { diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs index dbaa4ae..80c6fa1 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs @@ -28,5 +28,7 @@ pub struct stat { impl ::Copy for ::stat {} impl ::Clone for ::stat { - fn clone(&self) -> ::stat { *self } + fn clone(&self) -> ::stat { + *self + } } diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index fea680d..980caf2 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -337,6 +337,7 @@ pub const RLIMIT_NPTS: ::c_int = 11; pub const RLIMIT_SWAP: ::c_int = 12; pub const RLIMIT_KQUEUES: ::c_int = 13; pub const RLIMIT_UMTXP: ::c_int = 14; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::rlim_t = 15; pub const Q_GETQUOTA: ::c_int = 0x700; @@ -569,6 +570,8 @@ pub const TIOCSIG: ::c_uint = 0x2004745f; pub const TIOCM_DCD: ::c_int = 0x40; pub const H4DISC: ::c_int = 0x7; +pub const BIOCSETFNR: ::c_ulong = 0x80104282; + pub const FIONWRITE: ::c_ulong = 0x40046677; pub const FIONSPACE: ::c_ulong = 0x40046676; pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; @@ -652,12 +655,12 @@ pub const IFF_BROADCAST: ::c_int = 0x2; // (i) broadcast address valid pub const IFF_DEBUG: ::c_int = 0x4; // (n) turn on debugging pub const IFF_LOOPBACK: ::c_int = 0x8; // (i) is a loopback net pub const IFF_POINTOPOINT: ::c_int = 0x10; // (i) is a point-to-point link -// 0x20 was IFF_SMART + // 0x20 was IFF_SMART pub const IFF_RUNNING: ::c_int = 0x40; // (d) resources allocated #[doc(hidden)] #[deprecated( - since="0.2.54", - note="IFF_DRV_RUNNING is deprecated. Use the portable IFF_RUNNING instead" + 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 @@ -667,7 +670,7 @@ pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full #[doc(hidden)] #[deprecated( since = "0.2.54", - note = "Use the portable `IFF_OACTIVE` instead", + 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 @@ -676,7 +679,7 @@ pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection pub const IFF_MULTICAST: ::c_int = 0x8000; // (i) supports multicast -// (i) unconfigurable using ioctl(2) + // (i) unconfigurable using ioctl(2) pub const IFF_CANTCONFIG: ::c_int = 0x10000; pub const IFF_PPROMISC: ::c_int = 0x20000; // (n) user-requested promisc mode pub const IFF_MONITOR: ::c_int = 0x40000; // (n) user-requested monitor mode @@ -936,8 +939,8 @@ pub const TCP_PCAP_IN: ::c_int = 4096; pub const IP_BINDANY: ::c_int = 24; pub const IP_BINDMULTI: ::c_int = 25; pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26; -pub const IP_ORIGDSTADDR : ::c_int = 27; -pub const IP_RECVORIGDSTADDR : ::c_int = IP_ORIGDSTADDR; +pub const IP_ORIGDSTADDR: ::c_int = 27; +pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR; pub const IP_RECVTOS: ::c_int = 68; @@ -967,9 +970,9 @@ pub const IPC_RMID: ::c_int = 0; pub const IPC_SET: ::c_int = 1; pub const IPC_STAT: ::c_int = 2; pub const IPC_INFO: ::c_int = 3; -pub const IPC_R : ::c_int = 0o400; -pub const IPC_W : ::c_int = 0o200; -pub const IPC_M : ::c_int = 0o10000; +pub const IPC_R: ::c_int = 0o400; +pub const IPC_W: ::c_int = 0o200; +pub const IPC_M: ::c_int = 0o10000; pub const MSG_NOERROR: ::c_int = 0o10000; pub const SHM_RDONLY: ::c_int = 0o10000; pub const SHM_RND: ::c_int = 0o20000; @@ -986,16 +989,16 @@ 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")] +#[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")] +#[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")] +#[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")] +#[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; @@ -1006,6 +1009,7 @@ pub const MSG_COMPAT: ::c_int = 0x00008000; pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000; pub const MSG_NOSIGNAL: ::c_int = 0x20000; +// utmpx entry types pub const EMPTY: ::c_short = 0; pub const BOOT_TIME: ::c_short = 1; pub const OLD_TIME: ::c_short = 2; @@ -1015,19 +1019,23 @@ pub const INIT_PROCESS: ::c_short = 5; pub const LOGIN_PROCESS: ::c_short = 6; pub const DEAD_PROCESS: ::c_short = 7; pub const SHUTDOWN_TIME: ::c_short = 8; +// utmp database types +pub const UTXDB_ACTIVE: ::c_int = 0; +pub const UTXDB_LASTLOGIN: ::c_int = 1; +pub const UTXDB_LOG: ::c_int = 2; pub const LC_COLLATE_MASK: ::c_int = (1 << 0); pub const LC_CTYPE_MASK: ::c_int = (1 << 1); -pub const LC_MONETARY_MASK: ::c_int =(1 << 2); +pub const LC_MONETARY_MASK: ::c_int = (1 << 2); pub const LC_NUMERIC_MASK: ::c_int = (1 << 3); pub const LC_TIME_MASK: ::c_int = (1 << 4); pub const LC_MESSAGES_MASK: ::c_int = (1 << 5); pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK - | LC_CTYPE_MASK - | LC_MESSAGES_MASK - | LC_MONETARY_MASK - | LC_NUMERIC_MASK - | LC_TIME_MASK; + | LC_CTYPE_MASK + | LC_MESSAGES_MASK + | LC_MONETARY_MASK + | LC_NUMERIC_MASK + | LC_TIME_MASK; pub const WSTOPPED: ::c_int = 2; // same as WUNTRACED pub const WCONTINUED: ::c_int = 4; @@ -1041,6 +1049,9 @@ pub const P_PID: idtype_t = 0; pub const P_PGID: idtype_t = 2; pub const P_ALL: idtype_t = 7; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const B460800: ::speed_t = 460800; pub const B921600: ::speed_t = 921600; @@ -1079,14 +1090,14 @@ pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10; pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20; // Flags for chflags(2) -pub const UF_SYSTEM: ::c_ulong = 0x00000080; -pub const UF_SPARSE: ::c_ulong = 0x00000100; -pub const UF_OFFLINE: ::c_ulong = 0x00000200; -pub const UF_REPARSE: ::c_ulong = 0x00000400; -pub const UF_ARCHIVE: ::c_ulong = 0x00000800; -pub const UF_READONLY: ::c_ulong = 0x00001000; -pub const UF_HIDDEN: ::c_ulong = 0x00008000; -pub const SF_SNAPSHOT: ::c_ulong = 0x00200000; +pub const UF_SYSTEM: ::c_ulong = 0x00000080; +pub const UF_SPARSE: ::c_ulong = 0x00000100; +pub const UF_OFFLINE: ::c_ulong = 0x00000200; +pub const UF_REPARSE: ::c_ulong = 0x00000400; +pub const UF_ARCHIVE: ::c_ulong = 0x00000800; +pub const UF_READONLY: ::c_ulong = 0x00001000; +pub const UF_HIDDEN: ::c_ulong = 0x00008000; +pub const SF_SNAPSHOT: ::c_ulong = 0x00200000; fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -1130,151 +1141,241 @@ f! { } } -extern { +extern "C" { pub fn __error() -> *mut ::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; - - pub fn extattr_delete_fd(fd: ::c_int, - attrnamespace: ::c_int, - attrname: *const ::c_char) -> ::c_int; - pub fn extattr_delete_file(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char) -> ::c_int; - pub fn extattr_delete_link(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char) -> ::c_int; - pub fn extattr_get_fd(fd: ::c_int, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_get_file(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_get_link(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_list_fd(fd: ::c_int, - attrnamespace: ::c_int, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_list_file(path: *const ::c_char, - attrnamespace: ::c_int, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_list_link(path: *const ::c_char, - attrnamespace: ::c_int, - data: *mut ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_set_fd(fd: ::c_int, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *const ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_set_file(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *const ::c_void, - nbytes: ::size_t) -> ::ssize_t; - pub fn extattr_set_link(path: *const ::c_char, - attrnamespace: ::c_int, - attrname: *const ::c_char, - data: *const ::c_void, - nbytes: ::size_t) -> ::ssize_t; + pub fn clock_settime( + clk_id: ::clockid_t, + tp: *const ::timespec, + ) -> ::c_int; + + pub fn extattr_delete_fd( + fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + ) -> ::c_int; + pub fn extattr_delete_file( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + ) -> ::c_int; + pub fn extattr_delete_link( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + ) -> ::c_int; + pub fn extattr_get_fd( + fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_get_file( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_get_link( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_list_fd( + fd: ::c_int, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_list_file( + path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_list_link( + path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_set_fd( + fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_set_file( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; + pub fn extattr_set_link( + path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t, + ) -> ::ssize_t; pub fn jail(jail: *mut ::jail) -> ::c_int; pub fn jail_attach(jid: ::c_int) -> ::c_int; pub fn jail_remove(jid: ::c_int) -> ::c_int; - pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) - -> ::c_int; - pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) - -> ::c_int; + pub fn jail_get( + iov: *mut ::iovec, + niov: ::c_uint, + flags: ::c_int, + ) -> ::c_int; + pub fn jail_set( + iov: *mut ::iovec, + niov: ::c_uint, + flags: ::c_int, + ) -> ::c_int; pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, - len: ::off_t) -> ::c_int; - pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, - advise: ::c_int) -> ::c_int; + pub fn posix_fallocate( + fd: ::c_int, + offset: ::off_t, + len: ::off_t, + ) -> ::c_int; + pub fn posix_fadvise( + fd: ::c_int, + offset: ::off_t, + len: ::off_t, + advise: ::c_int, + ) -> ::c_int; pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; - pub fn mkostemps(template: *mut ::c_char, - suffixlen: ::c_int, - flags: ::c_int) -> ::c_int; + pub fn mkostemps( + template: *mut ::c_char, + suffixlen: ::c_int, + flags: ::c_int, + ) -> ::c_int; pub fn getutxuser(user: *const ::c_char) -> *mut utmpx; pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int; - pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, - timeout: *mut ::timespec) -> ::ssize_t; + pub fn aio_waitcomplete( + iocbp: *mut *mut aiocb, + timeout: *mut ::timespec, + ) -> ::ssize_t; pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int; - pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t, - options: ::c_int) -> ::c_int; + pub fn waitid( + idtype: idtype_t, + id: ::id_t, + infop: *mut ::siginfo_t, + options: ::c_int, + ) -> ::c_int; pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t; pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; - pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, - shmflg: ::c_int) -> *mut ::c_void; + pub fn shmat( + shmid: ::c_int, + shmaddr: *const ::c_void, + shmflg: ::c_int, + ) -> *mut ::c_void; pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; - pub fn shmctl(shmid: ::c_int, cmd: ::c_int, - buf: *mut ::shmid_ds) -> ::c_int; - pub fn msgctl(msqid: ::c_int, cmd: ::c_int, - buf: *mut ::msqid_ds) -> ::c_int; + pub fn shmctl( + shmid: ::c_int, + cmd: ::c_int, + buf: *mut ::shmid_ds, + ) -> ::c_int; + 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 msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t, - 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); - pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, - envp: *const *const ::c_char) - -> ::c_int; + pub fn fexecve( + fd: ::c_int, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; pub fn pdfork(fdp: *mut ::c_int, flags: ::c_int) -> ::pid_t; pub fn pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int; pub fn pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int; - pub fn rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, - rtp: *mut super::rtprio) -> ::c_int; - - pub fn posix_spawn(pid: *mut ::pid_t, - path: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char) -> ::c_int; - pub fn posix_spawnp(pid: *mut ::pid_t, - file: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char) -> ::c_int; + pub fn rtprio_thread( + function: ::c_int, + lwpid: ::lwpid_t, + rtp: *mut super::rtprio, + ) -> ::c_int; + + pub fn posix_spawn( + pid: *mut ::pid_t, + path: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnp( + pid: *mut ::pid_t, + file: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; - pub fn posix_spawnattr_getsigdefault(attr: *const posix_spawnattr_t, - default: *mut ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_setsigdefault(attr: *mut posix_spawnattr_t, - default: *const ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_getsigmask(attr: *const posix_spawnattr_t, - default: *mut ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_setsigmask(attr: *mut posix_spawnattr_t, - default: *const ::sigset_t) -> ::c_int; - pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, - flags: *mut ::c_short) -> ::c_int; - pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, - flags: ::c_short) -> ::c_int; - pub fn posix_spawnattr_getpgroup(attr: *const posix_spawnattr_t, - flags: *mut ::pid_t) -> ::c_int; - pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, - flags: ::pid_t) -> ::c_int; - pub fn posix_spawnattr_getschedpolicy(attr: *const posix_spawnattr_t, - flags: *mut ::c_int) -> ::c_int; - pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, - flags: ::c_int) -> ::c_int; + pub fn posix_spawnattr_getsigdefault( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigdefault( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getsigmask( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigmask( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getflags( + attr: *const posix_spawnattr_t, + flags: *mut ::c_short, + ) -> ::c_int; + pub fn posix_spawnattr_setflags( + attr: *mut posix_spawnattr_t, + flags: ::c_short, + ) -> ::c_int; + pub fn posix_spawnattr_getpgroup( + attr: *const posix_spawnattr_t, + flags: *mut ::pid_t, + ) -> ::c_int; + pub fn posix_spawnattr_setpgroup( + attr: *mut posix_spawnattr_t, + flags: ::pid_t, + ) -> ::c_int; + pub fn posix_spawnattr_getschedpolicy( + attr: *const posix_spawnattr_t, + flags: *mut ::c_int, + ) -> ::c_int; + pub fn posix_spawnattr_setschedpolicy( + attr: *mut posix_spawnattr_t, + flags: ::c_int, + ) -> ::c_int; pub fn posix_spawnattr_getschedparam( attr: *const posix_spawnattr_t, param: *mut ::sched_param, @@ -1307,24 +1408,45 @@ extern { newfd: ::c_int, ) -> ::c_int; + #[cfg_attr( + all(target_os = "freebsd", freebsd11), + link_name = "statfs@FBSD_1.0" + )] pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; + #[cfg_attr( + all(target_os = "freebsd", freebsd11), + link_name = "fstatfs@FBSD_1.0" + )] pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int; pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; pub fn __xuname(nmln: ::c_int, buf: *mut ::c_void) -> ::c_int; - pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, - flags: ::c_int) -> ::ssize_t; - pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::size_t, - flags: ::c_int, timeout: *const ::timespec) -> ::ssize_t; + pub fn sendmmsg( + sockfd: ::c_int, + msgvec: *mut ::mmsghdr, + vlen: ::size_t, + flags: ::c_int, + ) -> ::ssize_t; + pub fn recvmmsg( + sockfd: ::c_int, + msgvec: *mut ::mmsghdr, + vlen: ::size_t, + flags: ::c_int, + timeout: *const ::timespec, + ) -> ::ssize_t; } #[link(name = "util")] -extern { - pub fn extattr_namespace_to_string(attrnamespace: ::c_int, - string: *mut *mut ::c_char) -> ::c_int; - pub fn extattr_string_to_namespace(string: *const ::c_char, - attrnamespace: *mut ::c_int) -> ::c_int; +extern "C" { + pub fn extattr_namespace_to_string( + attrnamespace: ::c_int, + string: *mut *mut ::c_char, + ) -> ::c_int; + pub fn extattr_string_to_namespace( + string: *const ::c_char, + attrnamespace: *mut ::c_int, + ) -> ::c_int; } cfg_if! { @@ -1334,7 +1456,7 @@ cfg_if! { } else if #[cfg(freebsd13)] { mod freebsd12; pub use self::freebsd12::*; - } else if #[cfg(freebsd11)] { + } else if #[cfg(any(freebsd10, freebsd11))] { mod freebsd11; pub use self::freebsd11::*; } else { diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs new file mode 100644 index 0000000..7ca870f --- /dev/null +++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs @@ -0,0 +1,7 @@ +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } +} diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index 5220cde..0769a22 100644 --- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs +++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -15,3 +15,10 @@ cfg_if! { } } pub const MAP_32BIT: ::c_int = 0x00080000; + +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } +} diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs index f937d77..1b7804c 100644 --- a/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/libc/src/unix/bsd/freebsdlike/mod.rs @@ -18,7 +18,9 @@ pub type vm_size_t = ::uintptr_t; pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { - fn clone(&self) -> timezone { *self } + fn clone(&self) -> timezone { + *self + } } impl siginfo_t { @@ -239,6 +241,10 @@ cfg_if! { } } +#[deprecated( + since = "0.2.64", + note = "Can vary at runtime. Use sysconf(3) instead" +)] pub const AIO_LISTIO_MAX: ::c_int = 16; pub const AIO_CANCELED: ::c_int = 1; pub const AIO_NOTCANCELED: ::c_int = 2; @@ -520,9 +526,15 @@ pub const EMULTIHOP: ::c_int = 90; pub const ENOLINK: ::c_int = 91; pub const EPROTO: ::c_int = 92; -pub const POLLSTANDARD: ::c_short = ::POLLIN | ::POLLPRI | ::POLLOUT | - ::POLLRDNORM | ::POLLRDBAND | ::POLLWRBAND | ::POLLERR | - ::POLLHUP | ::POLLNVAL; +pub const POLLSTANDARD: ::c_short = ::POLLIN + | ::POLLPRI + | ::POLLOUT + | ::POLLRDNORM + | ::POLLRDBAND + | ::POLLWRBAND + | ::POLLERR + | ::POLLHUP + | ::POLLNVAL; pub const EAI_AGAIN: ::c_int = 2; pub const EAI_BADFLAGS: ::c_int = 3; @@ -543,17 +555,17 @@ pub const F_SETFL: ::c_int = 4; pub const SIGTRAP: ::c_int = 5; -pub const GLOB_APPEND : ::c_int = 0x0001; -pub const GLOB_DOOFFS : ::c_int = 0x0002; -pub const GLOB_ERR : ::c_int = 0x0004; -pub const GLOB_MARK : ::c_int = 0x0008; -pub const GLOB_NOCHECK : ::c_int = 0x0010; -pub const GLOB_NOSORT : ::c_int = 0x0020; +pub const GLOB_APPEND: ::c_int = 0x0001; +pub const GLOB_DOOFFS: ::c_int = 0x0002; +pub const GLOB_ERR: ::c_int = 0x0004; +pub const GLOB_MARK: ::c_int = 0x0008; +pub const GLOB_NOCHECK: ::c_int = 0x0010; +pub const GLOB_NOSORT: ::c_int = 0x0020; pub const GLOB_NOESCAPE: ::c_int = 0x2000; -pub const GLOB_NOSPACE : ::c_int = -1; -pub const GLOB_ABORTED : ::c_int = -2; -pub const GLOB_NOMATCH : ::c_int = -3; +pub const GLOB_NOSPACE: ::c_int = -1; +pub const GLOB_ABORTED: ::c_int = -2; +pub const GLOB_NOMATCH: ::c_int = -3; pub const POSIX_MADV_NORMAL: ::c_int = 0; pub const POSIX_MADV_RANDOM: ::c_int = 1; @@ -594,7 +606,7 @@ pub const MADV_AUTOSYNC: ::c_int = 7; pub const MADV_NOCORE: ::c_int = 8; pub const MADV_CORE: ::c_int = 9; -pub const MINCORE_INCORE: ::c_int = 0x1; +pub const MINCORE_INCORE: ::c_int = 0x1; pub const MINCORE_REFERENCED: ::c_int = 0x2; pub const MINCORE_MODIFIED: ::c_int = 0x4; pub const MINCORE_REFERENCED_OTHER: ::c_int = 0x8; @@ -690,7 +702,7 @@ pub const SOMAXCONN: ::c_int = 128; pub const MSG_OOB: ::c_int = 0x00000001; pub const MSG_PEEK: ::c_int = 0x00000002; pub const MSG_DONTROUTE: ::c_int = 0x00000004; -pub const MSG_EOR: ::c_int = 0x00000008; +pub const MSG_EOR: ::c_int = 0x00000008; pub const MSG_TRUNC: ::c_int = 0x00000010; pub const MSG_CTRUNC: ::c_int = 0x00000020; pub const MSG_WAITALL: ::c_int = 0x00000040; @@ -721,11 +733,11 @@ pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_RECVTCLASS: ::c_int = 57; pub const IPV6_TCLASS: ::c_int = 61; -pub const TCP_NOPUSH: ::c_int = 4; -pub const TCP_NOOPT: ::c_int = 8; -pub const TCP_KEEPIDLE: ::c_int = 256; +pub const TCP_NOPUSH: ::c_int = 4; +pub const TCP_NOOPT: ::c_int = 8; +pub const TCP_KEEPIDLE: ::c_int = 256; pub const TCP_KEEPINTVL: ::c_int = 512; -pub const TCP_KEEPCNT: ::c_int = 1024; +pub const TCP_KEEPCNT: ::c_int = 1024; pub const SOL_SOCKET: ::c_int = 0xffff; pub const SO_DEBUG: ::c_int = 0x01; @@ -761,10 +773,10 @@ pub const LOCK_UN: ::c_int = 8; pub const MAP_COPY: ::c_int = 0x0002; #[doc(hidden)] -#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] +#[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")] pub const MAP_RENAME: ::c_int = 0x0020; #[doc(hidden)] -#[deprecated(since="0.2.54",note="Removed in FreeBSD 11")] +#[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")] pub const MAP_NORESERVE: ::c_int = 0x0040; pub const MAP_HASSEMAPHORE: ::c_int = 0x0200; pub const MAP_STACK: ::c_int = 0x0400; @@ -1009,6 +1021,16 @@ pub const SLIPDISC: ::c_int = 0x4; pub const PPPDISC: ::c_int = 0x5; pub const NETGRAPHDISC: ::c_int = 0x6; +pub const BIOCGRSIG: ::c_ulong = 0x40044272; +pub const BIOCSRSIG: ::c_ulong = 0x80044273; +pub const BIOCSDLT: ::c_ulong = 0x80044278; +pub const BIOCGSEESENT: ::c_ulong = 0x40044276; +pub const BIOCSSEESENT: ::c_ulong = 0x80044277; +pub const BIOCSETF: ::c_ulong = 0x80104267; +pub const BIOCGDLTLIST: ::c_ulong = 0xc0104279; +pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d; +pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e; + pub const FIODTYPE: ::c_ulong = 0x4004667a; pub const FIOGETLBA: ::c_ulong = 0x40046679; pub const FIODGNAME: ::c_ulong = 0x80106678; @@ -1065,17 +1087,17 @@ pub const RTP_LOOKUP: ::c_int = 0; pub const RTP_SET: ::c_int = 1; // Flags for chflags(2) -pub const UF_SETTABLE: ::c_ulong = 0x0000ffff; -pub const UF_NODUMP: ::c_ulong = 0x00000001; -pub const UF_IMMUTABLE: ::c_ulong = 0x00000002; -pub const UF_APPEND: ::c_ulong = 0x00000004; -pub const UF_OPAQUE: ::c_ulong = 0x00000008; -pub const UF_NOUNLINK: ::c_ulong = 0x00000010; -pub const SF_SETTABLE: ::c_ulong = 0xffff0000; -pub const SF_ARCHIVED: ::c_ulong = 0x00010000; -pub const SF_IMMUTABLE: ::c_ulong = 0x00020000; -pub const SF_APPEND: ::c_ulong = 0x00040000; -pub const SF_NOUNLINK: ::c_ulong = 0x00100000; +pub const UF_SETTABLE: ::c_ulong = 0x0000ffff; +pub const UF_NODUMP: ::c_ulong = 0x00000001; +pub const UF_IMMUTABLE: ::c_ulong = 0x00000002; +pub const UF_APPEND: ::c_ulong = 0x00000004; +pub const UF_OPAQUE: ::c_ulong = 0x00000008; +pub const UF_NOUNLINK: ::c_ulong = 0x00000010; +pub const SF_SETTABLE: ::c_ulong = 0xffff0000; +pub const SF_ARCHIVED: ::c_ulong = 0x00010000; +pub const SF_IMMUTABLE: ::c_ulong = 0x00020000; +pub const SF_APPEND: ::c_ulong = 0x00040000; +pub const SF_NOUNLINK: ::c_ulong = 0x00100000; pub const TIMER_ABSTIME: ::c_int = 1; @@ -1097,225 +1119,337 @@ f! { } } -extern { +extern "C" { pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; - pub fn sem_init(sem: *mut sem_t, - pshared: ::c_int, - value: ::c_uint) - -> ::c_int; + pub fn sem_init( + sem: *mut sem_t, + pshared: ::c_int, + value: ::c_uint, + ) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - pub fn gettimeofday(tp: *mut ::timeval, - tz: *mut ::timezone) -> ::c_int; - pub fn accept4(s: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; + pub fn accept4( + s: ::c_int, + addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t, + flags: ::c_int, + ) -> ::c_int; pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; - pub fn aio_suspend(aiocb_list: *const *const aiocb, nitems: ::c_int, - timeout: *const ::timespec) -> ::c_int; + pub fn aio_suspend( + aiocb_list: *const *const aiocb, + nitems: ::c_int, + timeout: *const ::timespec, + ) -> ::c_int; pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; - pub fn chflagsat(fd: ::c_int, path: *const ::c_char, flags: ::c_ulong, - atflag: ::c_int) -> ::c_int; + pub fn chflagsat( + fd: ::c_int, + path: *const ::c_char, + flags: ::c_ulong, + atflag: ::c_int, + ) -> ::c_int; pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; pub fn duplocale(base: ::locale_t) -> ::locale_t; pub fn endutxent(); pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int; - pub fn getgrent_r(grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; + pub fn getgrent_r( + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] - pub fn getpwent_r(pwd: *mut ::passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::passwd) -> ::c_int; - pub fn getgrouplist(name: *const ::c_char, - basegid: ::gid_t, - groups: *mut ::gid_t, - ngroups: *mut ::c_int) -> ::c_int; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::size_t, - serv: *mut ::c_char, - servlen: ::size_t, - flags: ::c_int) -> ::c_int; + pub fn getpwent_r( + pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd, + ) -> ::c_int; + pub fn getgrouplist( + name: *const ::c_char, + basegid: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int, + ) -> ::c_int; + pub fn getnameinfo( + sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::size_t, + serv: *mut ::c_char, + servlen: ::size_t, + flags: ::c_int, + ) -> ::c_int; pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int; pub fn getutxent() -> *mut utmpx; pub fn getutxid(ut: *const utmpx) -> *mut utmpx; 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", freebsd11), + all(target_os = "freebsd", any(freebsd11, freebsd10)), link_name = "kevent@FBSD_1.0" )] - pub fn kevent(kq: ::c_int, - changelist: *const ::kevent, - nchanges: ::c_int, - eventlist: *mut ::kevent, - nevents: ::c_int, - timeout: *const ::timespec) -> ::c_int; + pub fn kevent( + kq: ::c_int, + changelist: *const ::kevent, + nchanges: ::c_int, + eventlist: *mut ::kevent, + nevents: ::c_int, + timeout: *const ::timespec, + ) -> ::c_int; pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; - pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, - nitems: ::c_int, sevp: *mut sigevent) -> ::c_int; + pub fn lio_listio( + mode: ::c_int, + aiocb_list: *const *mut aiocb, + nitems: ::c_int, + sevp: *mut sigevent, + ) -> ::c_int; pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; - pub fn memrchr(cx: *const ::c_void, - c: ::c_int, - n: ::size_t) -> *mut ::c_void; - pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t) -> ::c_int; + pub fn memrchr( + cx: *const ::c_void, + c: ::c_int, + n: ::size_t, + ) -> *mut ::c_void; + pub fn mkfifoat( + dirfd: ::c_int, + pathname: *const ::c_char, + mode: ::mode_t, + ) -> ::c_int; #[cfg_attr( - all(target_os = "freebsd", freebsd11), + all(target_os = "freebsd", any(freebsd11, freebsd10)), link_name = "mknodat@FBSD_1.1" )] - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t, dev: dev_t) -> ::c_int; + pub fn mknodat( + dirfd: ::c_int, + pathname: *const ::c_char, + mode: ::mode_t, + dev: dev_t, + ) -> ::c_int; pub fn mq_close(mqd: ::mqd_t) -> ::c_int; pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; - pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int; + pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) + -> ::c_int; pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; - pub fn mq_receive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint) -> ::ssize_t; - pub fn mq_send(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint) -> ::c_int; - pub fn mq_setattr(mqd: ::mqd_t, - newattr: *const ::mq_attr, - oldattr: *mut ::mq_attr) -> ::c_int; - pub fn mq_timedreceive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint, - abs_timeout: *const ::timespec) -> ::ssize_t; - pub fn mq_timedsend(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint, - abs_timeout: *const ::timespec) -> ::c_int; + pub fn mq_receive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + ) -> ::ssize_t; + pub fn mq_send( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + ) -> ::c_int; + pub fn mq_setattr( + mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr, + ) -> ::c_int; + pub fn mq_timedreceive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::ssize_t; + pub fn mq_timedsend( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; - pub fn mincore(addr: *const ::c_void, len: ::size_t, - vec: *mut ::c_char) -> ::c_int; - pub fn newlocale(mask: ::c_int, - locale: *const ::c_char, - base: ::locale_t) -> ::locale_t; - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn mincore( + addr: *const ::c_void, + len: ::size_t, + vec: *mut ::c_char, + ) -> ::c_int; + pub fn newlocale( + mask: ::c_int, + locale: *const ::c_char, + base: ::locale_t, + ) -> ::locale_t; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) + -> *mut ::c_char; pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; - pub fn ppoll(fds: *mut ::pollfd, - nfds: ::nfds_t, - timeout: *const ::timespec, - sigmask: *const sigset_t) -> ::c_int; - pub fn preadv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; - pub fn pthread_attr_get_np(tid: ::pthread_t, - attr: *mut ::pthread_attr_t) -> ::c_int; - pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t, - guardsize: *mut ::size_t) -> ::c_int; - pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, - stackaddr: *mut *mut ::c_void, - stacksize: *mut ::size_t) -> ::c_int; - pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t, - clock_id: *mut clockid_t) -> ::c_int; - pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t, - pshared: *mut ::c_int) -> ::c_int; - pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t, - clock_id: ::clockid_t) -> ::c_int; - pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, - pshared: ::c_int) -> ::c_int; - pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, - abstime: *const ::timespec) -> ::c_int; - pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t, - pshared: *mut ::c_int) -> ::c_int; - pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, - pshared: ::c_int) -> ::c_int; - pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t, - val: *mut ::c_int) -> ::c_int; - pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, - val: ::c_int) -> ::c_int; + pub fn ppoll( + fds: *mut ::pollfd, + nfds: ::nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t, + ) -> ::c_int; + pub fn preadv( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t, + ) -> ::ssize_t; + pub fn pthread_attr_get_np( + tid: ::pthread_t, + attr: *mut ::pthread_attr_t, + ) -> ::c_int; + pub fn pthread_attr_getguardsize( + attr: *const ::pthread_attr_t, + guardsize: *mut ::size_t, + ) -> ::c_int; + pub fn pthread_attr_getstack( + attr: *const ::pthread_attr_t, + stackaddr: *mut *mut ::c_void, + stacksize: *mut ::size_t, + ) -> ::c_int; + pub fn pthread_condattr_getclock( + attr: *const pthread_condattr_t, + clock_id: *mut clockid_t, + ) -> ::c_int; + pub fn pthread_condattr_getpshared( + attr: *const pthread_condattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_condattr_setclock( + attr: *mut pthread_condattr_t, + clock_id: ::clockid_t, + ) -> ::c_int; + pub fn pthread_condattr_setpshared( + attr: *mut pthread_condattr_t, + pshared: ::c_int, + ) -> ::c_int; + pub fn pthread_main_np() -> ::c_int; + pub fn pthread_mutex_timedlock( + lock: *mut pthread_mutex_t, + abstime: *const ::timespec, + ) -> ::c_int; + pub fn pthread_mutexattr_getpshared( + attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_mutexattr_setpshared( + attr: *mut pthread_mutexattr_t, + pshared: ::c_int, + ) -> ::c_int; + pub fn pthread_rwlockattr_getpshared( + attr: *const pthread_rwlockattr_t, + val: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_rwlockattr_setpshared( + attr: *mut pthread_rwlockattr_t, + val: ::c_int, + ) -> ::c_int; pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); - pub fn ptrace(request: ::c_int, - pid: ::pid_t, - addr: *mut ::c_char, - data: ::c_int) -> ::c_int; + pub fn ptrace( + request: ::c_int, + pid: ::pid_t, + addr: *mut ::c_char, + data: ::c_int, + ) -> ::c_int; pub fn pututxline(ut: *const utmpx) -> *mut utmpx; - pub fn pwritev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int, - offset: ::off_t) -> ::ssize_t; + pub fn pwritev( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t, + ) -> ::ssize_t; pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char; - pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int; + pub fn rtprio( + function: ::c_int, + pid: ::pid_t, + rtp: *mut rtprio, + ) -> ::c_int; pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; - pub fn sched_setscheduler(pid: ::pid_t, - policy: ::c_int, - param: *const ::sched_param) -> ::c_int; - pub fn sem_getvalue(sem: *mut sem_t, - sval: *mut ::c_int) -> ::c_int; - pub fn sem_timedwait(sem: *mut sem_t, - abstime: *const ::timespec) -> ::c_int; - pub fn sendfile(fd: ::c_int, - s: ::c_int, - offset: ::off_t, - nbytes: ::size_t, - hdtr: *mut ::sf_hdtr, - sbytes: *mut ::off_t, - flags: ::c_int) -> ::c_int; + pub fn sched_setscheduler( + pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; + pub fn sem_timedwait( + sem: *mut sem_t, + abstime: *const ::timespec, + ) -> ::c_int; + pub fn sendfile( + fd: ::c_int, + s: ::c_int, + offset: ::off_t, + nbytes: ::size_t, + hdtr: *mut ::sf_hdtr, + sbytes: *mut ::off_t, + flags: ::c_int, + ) -> ::c_int; pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int; - pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) + -> ::c_int; pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; - pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + pub fn settimeofday( + tv: *const ::timeval, + tz: *const ::timezone, + ) -> ::c_int; pub fn setutxent(); - pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) - -> ::c_int; - pub fn sigtimedwait(set: *const sigset_t, - info: *mut siginfo_t, - timeout: *const ::timespec) -> ::c_int; - pub fn sigwaitinfo(set: *const sigset_t, - info: *mut siginfo_t) -> ::c_int; - pub fn sysctl(name: *const ::c_int, - namelen: ::c_uint, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *const ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn sysctlbyname(name: *const ::c_char, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *const ::c_void, - newlen: ::size_t) - -> ::c_int; - pub fn sysctlnametomib(name: *const ::c_char, - mibp: *mut ::c_int, - sizep: *mut ::size_t) - -> ::c_int; + pub fn shm_open( + name: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; + pub fn sigtimedwait( + set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec, + ) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int; + pub fn sysctl( + name: *const ::c_int, + namelen: ::c_uint, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *const ::c_void, + newlen: ::size_t, + ) -> ::c_int; + pub fn sysctlbyname( + name: *const ::c_char, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *const ::c_void, + newlen: ::size_t, + ) -> ::c_int; + pub fn sysctlnametomib( + name: *const ::c_char, + mibp: *mut ::c_int, + sizep: *mut ::size_t, + ) -> ::c_int; pub fn uselocale(loc: ::locale_t) -> ::locale_t; - pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, - times: *const ::timespec, flag: ::c_int) -> ::c_int; + pub fn utimensat( + dirfd: ::c_int, + path: *const ::c_char, + times: *const ::timespec, + flag: ::c_int, + ) -> ::c_int; } #[link(name = "util")] -extern { - pub fn openpty(amaster: *mut ::c_int, - aslave: *mut ::c_int, - name: *mut ::c_char, - termp: *mut termios, - winp: *mut ::winsize) -> ::c_int; - pub fn forkpty(amaster: *mut ::c_int, - name: *mut ::c_char, - termp: *mut termios, - winp: *mut ::winsize) -> ::pid_t; +extern "C" { + pub fn openpty( + amaster: *mut ::c_int, + aslave: *mut ::c_int, + name: *mut ::c_char, + termp: *mut termios, + winp: *mut ::winsize, + ) -> ::c_int; + pub fn forkpty( + amaster: *mut ::c_int, + name: *mut ::c_char, + termp: *mut termios, + winp: *mut ::winsize, + ) -> ::pid_t; pub fn login_tty(fd: ::c_int) -> ::c_int; } |