summaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
committerDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
commitbcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2 (patch)
treee7470179e1bfb3fff279450e402ddcaf038ae086 /libc/src/unix/bsd
parentab3c2a935b1ba655de2f3fec35da2c14b69966dc (diff)
downloadnitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.gz
nitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.bz2
Update libc crate to 0.2.30
Import subrepo libc/:libc at 3520512a8c9cb55661910318a6fb169a75c02a59
Diffstat (limited to 'libc/src/unix/bsd')
-rw-r--r--libc/src/unix/bsd/apple/b32.rs34
-rw-r--r--libc/src/unix/bsd/apple/b64.rs39
-rw-r--r--libc/src/unix/bsd/apple/mod.rs169
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs94
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs2
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs54
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs2
-rw-r--r--libc/src/unix/bsd/freebsdlike/mod.rs196
-rw-r--r--libc/src/unix/bsd/mod.rs112
-rw-r--r--libc/src/unix/bsd/netbsdlike/mod.rs70
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/mod.rs165
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs198
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs2
13 files changed, 915 insertions, 222 deletions
diff --git a/libc/src/unix/bsd/apple/b32.rs b/libc/src/unix/bsd/apple/b32.rs
index 8ca0254..53fc0ae 100644
--- a/libc/src/unix/bsd/apple/b32.rs
+++ b/libc/src/unix/bsd/apple/b32.rs
@@ -2,18 +2,52 @@
pub type c_long = i32;
pub type c_ulong = u32;
+pub type boolean_t = ::c_int;
s! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 36]
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_typelen: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_unused1: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_baudrate: u32,
+ pub ifi_ipackets: u32,
+ pub ifi_ierrors: u32,
+ pub ifi_opackets: u32,
+ pub ifi_oerrors: u32,
+ pub ifi_collisions: u32,
+ pub ifi_ibytes: u32,
+ pub ifi_obytes: u32,
+ pub ifi_imcasts: u32,
+ pub ifi_omcasts: u32,
+ pub ifi_iqdrops: u32,
+ pub ifi_noproto: u32,
+ pub ifi_recvtiming: u32,
+ pub ifi_xmittiming: u32,
+ pub ifi_lastchange: ::timeval,
+ pub ifi_unused2: u32,
+ pub ifi_hwassist: u32,
+ pub ifi_reserved1: u32,
+ pub ifi_reserved2: u32,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;
diff --git a/libc/src/unix/bsd/apple/b64.rs b/libc/src/unix/bsd/apple/b64.rs
index 3f83230..e4a3981 100644
--- a/libc/src/unix/bsd/apple/b64.rs
+++ b/libc/src/unix/bsd/apple/b64.rs
@@ -2,18 +2,57 @@
pub type c_long = i64;
pub type c_ulong = u64;
+pub type boolean_t = ::c_uint;
s! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 56]
}
+
+ pub struct timeval32 {
+ pub tv_sec: i32,
+ pub tv_usec: i32,
+ }
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_typelen: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_unused1: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_baudrate: u32,
+ pub ifi_ipackets: u32,
+ pub ifi_ierrors: u32,
+ pub ifi_opackets: u32,
+ pub ifi_oerrors: u32,
+ pub ifi_collisions: u32,
+ pub ifi_ibytes: u32,
+ pub ifi_obytes: u32,
+ pub ifi_imcasts: u32,
+ pub ifi_omcasts: u32,
+ pub ifi_iqdrops: u32,
+ pub ifi_noproto: u32,
+ pub ifi_recvtiming: u32,
+ pub ifi_xmittiming: u32,
+ pub ifi_lastchange: timeval32,
+ pub ifi_unused2: u32,
+ pub ifi_hwassist: u32,
+ pub ifi_reserved1: u32,
+ pub ifi_reserved2: u32,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_COND_SIZE__: usize = 40;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs
index 6f0c55b..2f57592 100644
--- a/libc/src/unix/bsd/apple/mod.rs
+++ b/libc/src/unix/bsd/apple/mod.rs
@@ -146,6 +146,11 @@ s! {
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
+ pub struct pthread_rwlockattr_t {
+ __sig: ::c_long,
+ __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
+ }
+
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
@@ -263,6 +268,16 @@ s! {
pub dqb_spare: [::uint32_t; 4],
}
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
+
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
@@ -322,6 +337,79 @@ s! {
__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,
+ pub pti_total_user: u64,
+ pub pti_total_system: u64,
+ pub pti_threads_user: u64,
+ pub pti_threads_system: u64,
+ pub pti_policy: i32,
+ pub pti_faults: i32,
+ pub pti_pageins: i32,
+ pub pti_cow_faults: i32,
+ pub pti_messages_sent: i32,
+ pub pti_messages_received: i32,
+ pub pti_syscalls_mach: i32,
+ pub pti_syscalls_unix: i32,
+ pub pti_csw: i32,
+ pub pti_threadnum: i32,
+ pub pti_numrunning: i32,
+ pub pti_priority: i32,
+ }
+
+ pub struct proc_bsdinfo {
+ pub pbi_flags: u32,
+ pub pbi_status: u32,
+ pub pbi_xstatus: u32,
+ pub pbi_pid: u32,
+ pub pbi_ppid: u32,
+ pub pbi_uid: ::uid_t,
+ pub pbi_gid: ::gid_t,
+ pub pbi_ruid: ::uid_t,
+ pub pbi_rgid: ::gid_t,
+ pub pbi_svuid: ::uid_t,
+ pub pbi_svgid: ::gid_t,
+ pub rfu_1: u32,
+ pub pbi_comm: [::c_char; MAXCOMLEN],
+ pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
+ pub pbi_nfiles: u32,
+ pub pbi_pgid: u32,
+ pub pbi_pjobc: u32,
+ pub e_tdev: u32,
+ pub e_tpgid: u32,
+ pub pbi_nice: i32,
+ pub pbi_start_tvsec: u64,
+ pub pbi_start_tvusec: u64,
+ }
+
+ pub struct proc_taskallinfo {
+ pub pbsd: proc_bsdinfo,
+ pub ptinfo: proc_taskinfo,
+ }
+
+ pub struct proc_threadinfo {
+ pub pth_user_time: u64,
+ pub pth_system_time: u64,
+ pub pth_cpu_usage: i32,
+ pub pth_policy: i32,
+ pub pth_run_state: i32,
+ pub pth_flags: i32,
+ pub pth_sleep_time: i32,
+ pub pth_curpri: i32,
+ pub pth_priority: i32,
+ pub pth_maxpriority: i32,
+ pub pth_name: [::c_char; MAXTHREADNAMESIZE],
+ }
+
+ pub struct xsw_usage {
+ pub xsu_total: u64,
+ pub xsu_avail: u64,
+ pub xsu_used: u64,
+ pub xsu_pagesize: u32,
+ pub xsu_encrypted: ::boolean_t,
+ }
}
pub const _UTX_USERSIZE: usize = 256;
@@ -448,14 +536,8 @@ pub const _PC_PIPE_BUF: ::c_int = 6;
pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
pub const _PC_NO_TRUNC: ::c_int = 8;
pub const _PC_VDISABLE: ::c_int = 9;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
-pub const O_NOCTTY: ::c_int = 131072;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DSYNC: ::c_int = 0x400000;
+pub const O_NOCTTY: ::c_int = 0x20000;
pub const O_CLOEXEC: ::c_int = 0x1000000;
pub const O_DIRECTORY: ::c_int = 0x100000;
pub const S_IFIFO: mode_t = 4096;
@@ -671,8 +753,6 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
pub const AT_REMOVEDIR: ::c_int = 0x0080;
-pub const O_ACCMODE: ::c_int = 3;
-
pub const TIOCMODG: ::c_ulong = 0x40047403;
pub const TIOCMODS: ::c_ulong = 0x80047404;
pub const TIOCM_LE: ::c_int = 0x1;
@@ -812,6 +892,8 @@ pub const _SC_XOPEN_UNIX: ::c_int = 115;
pub const _SC_XOPEN_VERSION: ::c_int = 116;
pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
@@ -890,6 +972,10 @@ pub const AF_PPP: ::c_int = 34;
pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
#[doc(hidden)]
pub const AF_MAX: ::c_int = 40;
+pub const AF_SYS_CONTROL: ::c_int = 2;
+
+pub const SYSPROTO_EVENT: ::c_int = 1;
+pub const SYSPROTO_CONTROL: ::c_int = 2;
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
pub const PF_LOCAL: ::c_int = AF_LOCAL;
@@ -947,13 +1033,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
pub const SOCK_RDM: ::c_int = 4;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
@@ -976,6 +1055,7 @@ pub const SO_LINGER: ::c_int = 0x0080;
pub const SO_OOBINLINE: ::c_int = 0x0100;
pub const SO_REUSEPORT: ::c_int = 0x0200;
pub const SO_TIMESTAMP: ::c_int = 0x0400;
+pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
pub const SO_DONTTRUNC: ::c_int = 0x2000;
pub const SO_WANTMORE: ::c_int = 0x4000;
pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
@@ -987,11 +1067,17 @@ pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
+pub const SO_LABEL: ::c_int = 0x1010;
+pub const SO_PEERLABEL: ::c_int = 0x1011;
pub const SO_NREAD: ::c_int = 0x1020;
pub const SO_NKE: ::c_int = 0x1021;
pub const SO_NOSIGPIPE: ::c_int = 0x1022;
pub const SO_NOADDRERR: ::c_int = 0x1023;
pub const SO_NWRITE: ::c_int = 0x1024;
+pub const SO_REUSESHAREUID: ::c_int = 0x1025;
+pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
+pub const SO_RANDOMPORT: ::c_int = 0x1082;
+pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
pub const MSG_OOB: ::c_int = 0x1;
pub const MSG_PEEK: ::c_int = 0x2;
@@ -1009,7 +1095,6 @@ pub const MSG_HAVEMORE: ::c_int = 0x2000;
pub const MSG_RCVMORE: ::c_int = 0x4000;
// pub const MSG_COMPAT: ::c_int = 0x8000;
-pub const SCM_RIGHTS: ::c_int = 0x01;
pub const SCM_TIMESTAMP: ::c_int = 0x02;
pub const SCM_CREDS: ::c_int = 0x03;
@@ -1024,10 +1109,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_DSYNC: ::c_int = 4194304;
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
pub const MAP_COPY: ::c_int = 0x0002;
pub const MAP_RENAME: ::c_int = 0x0020;
pub const MAP_NORESERVE: ::c_int = 0x0040;
@@ -1238,6 +1319,18 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const OCRNL: ::c_int = 0x00000010;
+pub const ONOCR: ::c_int = 0x00000020;
+pub const ONLRET: ::c_int = 0x00000040;
+pub const OFILL: ::c_int = 0x00000080;
+pub const NLDLY: ::c_int = 0x00000300;
+pub const TABDLY: ::c_int = 0x00000c04;
+pub const CRDLY: ::c_int = 0x00003000;
+pub const FFDLY: ::c_int = 0x00004000;
+pub const BSDLY: ::c_int = 0x00008000;
+pub const VTDLY: ::c_int = 0x00010000;
+pub const OFDEL: ::c_int = 0x00020000;
+
pub const NL0: ::c_int = 0x00000000;
pub const NL1: ::c_int = 0x00000100;
pub const TAB0: ::c_int = 0x00000000;
@@ -1481,11 +1574,6 @@ pub const CTL_DEBUG_NAME: ::c_int = 0;
pub const CTL_DEBUG_VALUE: ::c_int = 1;
pub const CTL_DEBUG_MAXID: ::c_int = 20;
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
-pub const POLLWRBAND: ::c_short = 0x100;
-
pub const PRIO_DARWIN_THREAD: ::c_int = 3;
pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
@@ -1523,6 +1611,17 @@ pub const XATTR_NOSECURITY: ::c_int = 0x0008;
pub const XATTR_NODEFAULT: ::c_int = 0x0010;
pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020;
+pub const NET_RT_IFLIST2: ::c_int = 0x0006;
+pub const RTM_IFINFO2: ::c_int = 0x0012;
+
+pub const KERN_PROCARGS2: ::c_int = 49;
+
+pub const PROC_PIDTASKALLINFO: ::c_int = 2;
+pub const PROC_PIDTASKINFO: ::c_int = 4;
+pub const PROC_PIDTHREADINFO: ::c_int = 5;
+pub const MAXCOMLEN: usize = 16;
+pub const MAXTHREADNAMESIZE: usize = 64;
+
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@@ -1559,6 +1658,8 @@ extern {
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
+
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn getutxent() -> *mut utmpx;
@@ -1613,6 +1714,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::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 __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
@@ -1637,7 +1742,7 @@ extern {
target: *const ::c_char,
flags: ::c_int,
data: *mut ::c_void) -> ::c_int;
- pub fn ptrace(requeset: ::c_int,
+ pub fn ptrace(request: ::c_int,
pid: ::pid_t,
addr: *mut ::c_char,
data: ::c_int) -> ::c_int;
@@ -1693,13 +1798,19 @@ extern {
pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char,
flags: ::c_int) -> ::c_int;
+ pub fn getgrouplist(name: *const ::c_char,
+ basegid: ::c_int,
+ groups: *mut ::c_int,
+ ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "waitid$UNIX2003")]
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
-
+ pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
+ pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index e60825a..038a886 100644
--- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -131,13 +131,51 @@ s! {
pub st_qspare1: ::int64_t,
pub st_qspare2: ::int64_t,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_mtu: ::c_ulong,
+ pub ifi_metric: ::c_ulong,
+ pub ifi_link_state: ::c_ulong,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: ::c_ulong,
+ pub ifi_ierrors: ::c_ulong,
+ pub ifi_opackets: ::c_ulong,
+ pub ifi_oerrors: ::c_ulong,
+ pub ifi_collisions: ::c_ulong,
+ pub ifi_ibytes: ::c_ulong,
+ pub ifi_obytes: ::c_ulong,
+ pub ifi_imcasts: ::c_ulong,
+ pub ifi_omcasts: ::c_ulong,
+ pub ifi_iqdrops: ::c_ulong,
+ pub ifi_noproto: ::c_ulong,
+ pub ifi_hwassist: ::c_ulong,
+ pub ifi_oqdrops: ::c_ulong,
+ pub ifi_lastchange: ::timeval,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
-pub const PTHREAD_STACK_MIN: ::size_t = 1024;
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
pub const SIGSTKSZ: ::size_t = 40960;
pub const MADV_INVAL: ::c_int = 10;
pub const O_CLOEXEC: ::c_int = 0x00020000;
+pub const O_DIRECTORY: ::c_int = 0x08000000;
pub const F_GETLK: ::c_int = 7;
pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;
@@ -148,20 +186,20 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
@@ -302,6 +340,7 @@ 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_EXCEPT: ::int16_t = -8;
pub const EVFILT_USER: ::int16_t = -9;
pub const EVFILT_FS: ::int16_t = -10;
@@ -404,12 +443,31 @@ pub const TIOCMODG: ::c_uint = 0x40047403;
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_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 VCHECKPT: usize = 19;
+
+pub const _PC_2_SYMLINKS: ::c_int = 22;
+pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23;
+
+pub const _SC_V7_ILP32_OFF32: ::c_int = 122;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123;
+pub const _SC_V7_LP64_OFF64: ::c_int = 124;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
+
extern {
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_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 setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
index a2da845..3d61f88 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -28,3 +28,5 @@ s! {
pub st_birthtime_nsec: ::c_long,
}
}
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
index fb113de..dbf7fd3 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -139,6 +139,9 @@ pub const SF_NODISKIO: ::c_int = 0x00000001;
pub const SF_MNOWAIT: ::c_int = 0x00000002;
pub const SF_SYNC: ::c_int = 0x00000004;
pub const O_CLOEXEC: ::c_int = 0x00100000;
+pub const O_DIRECTORY: ::c_int = 0x00020000;
+pub const O_EXEC: ::c_int = 0x00040000;
+pub const O_TTY_INIT: ::c_int = 0x00080000;
pub const F_GETLK: ::c_int = 11;
pub const F_SETLK: ::c_int = 12;
pub const F_SETLKW: ::c_int = 13;
@@ -157,6 +160,8 @@ pub const POSIX_FADV_WILLNEED: ::c_int = 3;
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
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;
@@ -213,20 +218,20 @@ pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
@@ -508,15 +513,29 @@ pub const P_ALL: idtype_t = 7;
pub const B460800: ::speed_t = 460800;
pub const B921600: ::speed_t = 921600;
+pub const AT_FDCWD: ::c_int = -100;
+pub const AT_EACCESS: ::c_int = 0x100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_REMOVEDIR: ::c_int = 0x800;
+
+pub const TABDLY: ::tcflag_t = 0x00000004;
+pub const TAB0: ::tcflag_t = 0x00000000;
+pub const TAB3: ::tcflag_t = 0x00000004;
+
+pub const _PC_ACL_NFS4: ::c_int = 64;
+
+pub const _SC_CPUSET_SIZE: ::c_int = 122;
+
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;
+ 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 jail(jail: *mut ::jail) -> ::c_int;
pub fn jail_attach(jid: ::c_int) -> ::c_int;
@@ -559,6 +578,7 @@ extern {
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);
}
cfg_if! {
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
index a2da845..3d61f88 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
@@ -28,3 +28,5 @@ s! {
pub st_birthtime_nsec: ::c_long,
}
}
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs
index daf3f29..8cc87ce 100644
--- a/libc/src/unix/bsd/freebsdlike/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/mod.rs
@@ -7,6 +7,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
pub type pthread_condattr_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
pub type pthread_key_t = ::c_int;
pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
@@ -263,6 +264,8 @@ pub const EOF: ::c_int = -1;
pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: ::c_int = 2;
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 2;
pub const _IOLBF: ::c_int = 1;
@@ -272,15 +275,9 @@ pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 308915776;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_ACCMODE: ::c_int = 3;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
pub const O_NOCTTY: ::c_int = 32768;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DIRECT: ::c_int = 0x00010000;
+
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@@ -339,6 +336,7 @@ pub const MAP_SHARED: ::c_int = 0x0001;
pub const MAP_PRIVATE: ::c_int = 0x0002;
pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_ANON: ::c_int = 0x1000;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
@@ -444,6 +442,10 @@ 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 EAI_SYSTEM: ::c_int = 11;
pub const F_DUPFD: ::c_int = 0;
@@ -452,11 +454,6 @@ pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
-pub const AT_EACCESS: ::c_int = 0x100;
-pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
-pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
-pub const AT_REMOVEDIR: ::c_int = 0x800;
-
pub const SIGTRAP: ::c_int = 5;
pub const GLOB_APPEND : ::c_int = 0x0001;
@@ -477,36 +474,8 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
-pub const _SC_IOV_MAX: ::c_int = 56;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
-pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
-pub const _SC_THREADS: ::c_int = 96;
-pub const _SC_TTY_NAME_MAX: ::c_int = 101;
-pub const _SC_ATEXIT_MAX: ::c_int = 107;
-pub const _SC_XOPEN_CRYPT: ::c_int = 108;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
-pub const _SC_XOPEN_LEGACY: ::c_int = 110;
-pub const _SC_XOPEN_REALTIME: ::c_int = 111;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
-pub const _SC_XOPEN_SHM: ::c_int = 113;
-pub const _SC_XOPEN_UNIX: ::c_int = 115;
-pub const _SC_XOPEN_VERSION: ::c_int = 116;
-pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
-
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
@@ -629,6 +598,8 @@ pub const MSG_WAITALL: ::c_int = 0x00000040;
pub const MSG_DONTWAIT: ::c_int = 0x00000080;
pub const MSG_EOF: ::c_int = 0x00000100;
+pub const SCM_TIMESTAMP: ::c_int = 0x02;
+
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
@@ -637,13 +608,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
pub const SOCK_MAXADDRLEN: ::c_int = 255;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
@@ -687,9 +651,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
pub const MAP_COPY: ::c_int = 0x0002;
pub const MAP_RENAME: ::c_int = 0x0020;
pub const MAP_NORESERVE: ::c_int = 0x0040;
@@ -700,6 +661,32 @@ pub const MAP_NOCORE: ::c_int = 0x020000;
pub const IPPROTO_RAW: ::c_int = 255;
+pub const _PC_LINK_MAX: ::c_int = 1;
+pub const _PC_MAX_CANON: ::c_int = 2;
+pub const _PC_MAX_INPUT: ::c_int = 3;
+pub const _PC_NAME_MAX: ::c_int = 4;
+pub const _PC_PATH_MAX: ::c_int = 5;
+pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
+pub const _PC_NO_TRUNC: ::c_int = 8;
+pub const _PC_VDISABLE: ::c_int = 9;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 10;
+pub const _PC_FILESIZEBITS: ::c_int = 12;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_SYMLINK_MAX: ::c_int = 18;
+pub const _PC_MIN_HOLE_SIZE: ::c_int = 21;
+pub const _PC_ASYNC_IO: ::c_int = 53;
+pub const _PC_PRIO_IO: ::c_int = 54;
+pub const _PC_SYNC_IO: ::c_int = 55;
+pub const _PC_ACL_EXTENDED: ::c_int = 59;
+pub const _PC_ACL_PATH_MAX: ::c_int = 60;
+pub const _PC_CAP_PRESENT: ::c_int = 61;
+pub const _PC_INF_PRESENT: ::c_int = 62;
+pub const _PC_MAC_PRESENT: ::c_int = 63;
+
pub const _SC_ARG_MAX: ::c_int = 1;
pub const _SC_CHILD_MAX: ::c_int = 2;
pub const _SC_CLK_TCK: ::c_int = 3;
@@ -753,7 +740,71 @@ pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
pub const _SC_TIMER_MAX: ::c_int = 52;
+pub const _SC_IOV_MAX: ::c_int = 56;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
+pub const _SC_2_PBS: ::c_int = 59;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
+pub const _SC_2_PBS_LOCATE: ::c_int = 62;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
+pub const _SC_2_PBS_TRACK: ::c_int = 64;
+pub const _SC_ADVISORY_INFO: ::c_int = 65;
+pub const _SC_BARRIERS: ::c_int = 66;
+pub const _SC_CLOCK_SELECTION: ::c_int = 67;
+pub const _SC_CPUTIME: ::c_int = 68;
+pub const _SC_FILE_LOCKING: ::c_int = 69;
+pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
pub const _SC_HOST_NAME_MAX: ::c_int = 72;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
+pub const _SC_REGEXP: ::c_int = 77;
+pub const _SC_SHELL: ::c_int = 78;
+pub const _SC_SPAWN: ::c_int = 79;
+pub const _SC_SPIN_LOCKS: ::c_int = 80;
+pub const _SC_SPORADIC_SERVER: ::c_int = 81;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
+pub const _SC_TIMEOUTS: ::c_int = 95;
+pub const _SC_THREADS: ::c_int = 96;
+pub const _SC_TRACE: ::c_int = 97;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
+pub const _SC_TRACE_INHERIT: ::c_int = 99;
+pub const _SC_TRACE_LOG: ::c_int = 100;
+pub const _SC_TTY_NAME_MAX: ::c_int = 101;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
+pub const _SC_V6_LP64_OFF64: ::c_int = 105;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
+pub const _SC_ATEXIT_MAX: ::c_int = 107;
+pub const _SC_XOPEN_CRYPT: ::c_int = 108;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
+pub const _SC_XOPEN_LEGACY: ::c_int = 110;
+pub const _SC_XOPEN_REALTIME: ::c_int = 111;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
+pub const _SC_XOPEN_SHM: ::c_int = 113;
+pub const _SC_XOPEN_STREAMS: ::c_int = 114;
+pub const _SC_XOPEN_UNIX: ::c_int = 115;
+pub const _SC_XOPEN_VERSION: ::c_int = 116;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
+pub const _SC_IPV6: ::c_int = 118;
+pub const _SC_RAW_SOCKETS: ::c_int = 119;
+pub const _SC_SYMLOOP_MAX: ::c_int = 120;
+pub const _SC_PHYS_PAGES: ::c_int = 121;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
@@ -875,8 +926,15 @@ pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
pub const CRTSCTS: ::tcflag_t = 0x00030000;
-
-pub const AT_FDCWD: ::c_int = -100;
+pub const CCTS_OFLOW: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = 0x00020000;
+pub const CDTR_IFLOW: ::tcflag_t = 0x00040000;
+pub const CDSR_OFLOW: ::tcflag_t = 0x00080000;
+pub const CCAR_OFLOW: ::tcflag_t = 0x00100000;
+pub const VERASE2: usize = 7;
+pub const OCRNL: ::tcflag_t = 0x10;
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
@@ -904,6 +962,13 @@ extern {
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
+ 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 getgrouplist(name: *const ::c_char,
+ basegid: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
}
#[link(name = "util")]
@@ -918,6 +983,7 @@ extern {
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -933,6 +999,14 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
+ pub fn pwritev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn preadv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
pub fn sysctlnametomib(name: *const ::c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
@@ -954,7 +1028,7 @@ extern {
-> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
- param: *const sched_param) -> ::c_int;
+ param: *const ::sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn memrchr(cx: *const ::c_void,
c: ::c_int,
@@ -1005,6 +1079,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::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 getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
@@ -1017,7 +1095,7 @@ extern {
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
clock_id: *mut clockid_t) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
- clock_id: clockid_t) -> ::c_int;
+ clock_id: ::clockid_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
pub fn sem_timedwait(sem: *mut sem_t,
abstime: *const ::timespec) -> ::c_int;
@@ -1028,6 +1106,10 @@ extern {
nfds: ::nfds_t,
timeout: *const ::timespec,
sigmask: *const sigset_t) -> ::c_int;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs
index 96b0f22..94b8576 100644
--- a/libc/src/unix/bsd/mod.rs
+++ b/libc/src/unix/bsd/mod.rs
@@ -180,17 +180,35 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
+pub const IP_MULTICAST_IF: ::c_int = 9;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_MULTICAST_LOOP: ::c_int = 11;
+
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
pub const ST_RDONLY: ::c_ulong = 1;
+pub const SCM_RIGHTS: ::c_int = 0x01;
+
pub const NCCS: usize = 20;
+pub const O_ACCMODE: ::c_int = 0x3;
+pub const O_RDONLY: ::c_int = 0;
+pub const O_WRONLY: ::c_int = 1;
+pub const O_RDWR: ::c_int = 2;
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 512;
+pub const O_TRUNC: ::c_int = 1024;
+pub const O_EXCL: ::c_int = 2048;
pub const O_ASYNC: ::c_int = 0x40;
-pub const O_FSYNC: ::c_int = 0x80;
-pub const O_NDELAY: ::c_int = 0x4;
+pub const O_SYNC: ::c_int = 0x80;
+pub const O_NONBLOCK: ::c_int = 0x4;
pub const O_NOFOLLOW: ::c_int = 0x100;
+pub const O_SHLOCK: ::c_int = 0x10;
+pub const O_EXLOCK: ::c_int = 0x20;
+pub const O_FSYNC: ::c_int = O_SYNC;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const F_GETOWN: ::c_int = 5;
pub const F_SETOWN: ::c_int = 6;
@@ -221,12 +239,15 @@ pub const VREPRINT: usize = 6;
pub const VINTR: usize = 8;
pub const VQUIT: usize = 9;
pub const VSUSP: usize = 10;
+pub const VDSUSP: usize = 11;
pub const VSTART: usize = 12;
pub const VSTOP: usize = 13;
pub const VLNEXT: usize = 14;
pub const VDISCARD: usize = 15;
pub const VMIN: usize = 16;
pub const VTIME: usize = 17;
+pub const VSTATUS: usize = 18;
+pub const _POSIX_VDISABLE: ::cc_t = 0xff;
pub const IGNBRK: ::tcflag_t = 0x00000001;
pub const BRKINT: ::tcflag_t = 0x00000002;
pub const IGNPAR: ::tcflag_t = 0x00000004;
@@ -244,6 +265,7 @@ pub const OPOST: ::tcflag_t = 0x1;
pub const ONLCR: ::tcflag_t = 0x2;
pub const OXTABS: ::tcflag_t = 0x4;
pub const ONOEOT: ::tcflag_t = 0x8;
+pub const CIGNORE: ::tcflag_t = 0x00000001;
pub const CSIZE: ::tcflag_t = 0x00000300;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CS6: ::tcflag_t = 0x00000100;
@@ -264,12 +286,15 @@ pub const ECHOPRT: ::tcflag_t = 0x00000020;
pub const ECHOCTL: ::tcflag_t = 0x00000040;
pub const ISIG: ::tcflag_t = 0x00000080;
pub const ICANON: ::tcflag_t = 0x00000100;
+pub const ALTWERASE: ::tcflag_t = 0x00000200;
pub const IEXTEN: ::tcflag_t = 0x00000400;
pub const EXTPROC: ::tcflag_t = 0x00000800;
pub const TOSTOP: ::tcflag_t = 0x00400000;
pub const FLUSHO: ::tcflag_t = 0x00800000;
+pub const NOKERNINFO: ::tcflag_t = 0x02000000;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const MDMBUF: ::tcflag_t = 0x00100000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -284,8 +309,15 @@ pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
pub const LOG_FTP: ::c_int = 11 << 3;
pub const LOG_PERROR: ::c_int = 0x20;
+pub const TCP_MAXSEG: ::c_int = 2;
+
pub const PIPE_BUF: usize = 512;
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLRDBAND: ::c_short = 0x080;
+pub const POLLWRBAND: ::c_short = 0x100;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -339,21 +371,10 @@ extern {
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")]
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
+ pub fn endpwent();
pub fn getprogname() -> *const ::c_char;
pub fn setprogname(name: *const ::c_char);
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
@@ -432,6 +453,69 @@ extern {
link_name = "recvmsg$UNIX2003")]
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+
+ pub fn sync();
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+ pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn pthread_create(native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs
index 1471e6f..e43f2ab 100644
--- a/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -127,16 +127,7 @@ pub const BUFSIZ : ::c_uint = 1024;
pub const FOPEN_MAX : ::c_uint = 20;
pub const FILENAME_MAX : ::c_uint = 1024;
pub const L_tmpnam : ::c_uint = 1024;
-pub const O_RDONLY : ::c_int = 0;
-pub const O_WRONLY : ::c_int = 1;
-pub const O_RDWR : ::c_int = 2;
-pub const O_ACCMODE : ::c_int = 3;
-pub const O_APPEND : ::c_int = 8;
-pub const O_CREAT : ::c_int = 512;
-pub const O_EXCL : ::c_int = 2048;
pub const O_NOCTTY : ::c_int = 32768;
-pub const O_TRUNC : ::c_int = 1024;
-pub const O_SYNC : ::c_int = 128;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
@@ -316,8 +307,6 @@ pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
pub const POSIX_MADV_WILLNEED : ::c_int = 3;
pub const POSIX_MADV_DONTNEED : ::c_int = 4;
-pub const _SC_XOPEN_SHM : ::c_int = 30;
-
pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
@@ -329,8 +318,8 @@ pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
// http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
// https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
// Basically the same goes for NetBSD
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 3;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -418,14 +407,8 @@ pub const PF_NATM: ::c_int = AF_NATM;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
+pub const SOCK_RDM: ::c_int = 4;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
-pub const IP_MULTICAST_TTL: ::c_int = 10;
-pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
@@ -465,8 +448,6 @@ pub const MSG_MCAST: ::c_int = 0x200;
pub const MSG_NOSIGNAL: ::c_int = 0x400;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
-pub const SCM_RIGHTS: ::c_int = 0x01;
-
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const SHUT_RD: ::c_int = 0;
@@ -478,8 +459,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_NONBLOCK : ::c_int = 4;
-
pub const IPPROTO_RAW : ::c_int = 255;
pub const _SC_ARG_MAX : ::c_int = 1;
@@ -511,6 +490,7 @@ pub const _SC_TZNAME_MAX : ::c_int = 27;
pub const _SC_PAGESIZE : ::c_int = 28;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_FSYNC : ::c_int = 29;
+pub const _SC_XOPEN_SHM : ::c_int = 30;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
@@ -549,6 +529,23 @@ pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
+pub const CRTSCTS: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
+pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
+pub const OCRNL: ::tcflag_t = 0x10;
+
+pub const TIOCM_LE: ::c_int = 0o0001;
+pub const TIOCM_DTR: ::c_int = 0o0002;
+pub const TIOCM_RTS: ::c_int = 0o0004;
+pub const TIOCM_ST: ::c_int = 0o0010;
+pub const TIOCM_SR: ::c_int = 0o0020;
+pub const TIOCM_CTS: ::c_int = 0o0040;
+pub const TIOCM_CAR: ::c_int = 0o0100;
+pub const TIOCM_RNG: ::c_int = 0o0200;
+pub const TIOCM_DSR: ::c_int = 0o0400;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@@ -568,11 +565,11 @@ extern {
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
- 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 __errno() -> *mut ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int;
@@ -583,6 +580,14 @@ extern {
pub fn mkostemps(template: *mut ::c_char,
suffixlen: ::c_int,
flags: ::c_int) -> ::c_int;
+ pub fn pwritev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn preadv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn openpty(amaster: *mut ::c_int,
@@ -606,11 +611,20 @@ extern {
pub fn sem_timedwait(sem: *mut sem_t,
abstime: *const ::timespec) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
- clock_id: clockid_t) -> ::c_int;
+ clock_id: ::clockid_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
abstime: *const ::timespec) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
+
+ pub fn getgrouplist(name: *const ::c_char,
+ basegid: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index ffe8d75..ff6dd24 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -165,6 +165,11 @@ s! {
ptma_private: *mut ::c_void,
}
+ pub struct pthread_rwlockattr_t {
+ ptra_magic: ::c_uint,
+ ptra_private: *mut ::c_void,
+ }
+
pub struct pthread_cond_t {
ptc_magic: ::c_uint,
ptc_lock: ::c_uchar,
@@ -244,6 +249,38 @@ s! {
pub int_p_sign_posn: ::c_char,
pub int_n_sign_posn: ::c_char,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_link_state: ::c_int,
+ pub ifi_mtu: u64,
+ pub ifi_metric: u64,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: u64,
+ pub ifi_ierrors: u64,
+ pub ifi_opackets: u64,
+ pub ifi_oerrors: u64,
+ pub ifi_collisions: u64,
+ pub ifi_ibytes: u64,
+ pub ifi_obytes: u64,
+ pub ifi_imcasts: u64,
+ pub ifi_omcasts: u64,
+ pub ifi_iqdrops: u64,
+ pub ifi_noproto: u64,
+ pub ifi_lastchange: ::timespec,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
}
pub const AT_FDCWD: ::c_int = -100;
@@ -270,9 +307,9 @@ pub const O_CLOEXEC: ::c_int = 0x400000;
pub const O_ALT_IO: ::c_int = 0x40000;
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
pub const O_SEARCH: ::c_int = 0x800000;
-pub const O_EXLOCK: ::c_int = 0x20;
-pub const O_SHLOCK: ::c_int = 0x10;
pub const O_DIRECTORY: ::c_int = 0x200000;
+pub const O_DIRECT : ::c_int = 0x00080000;
+pub const O_RSYNC : ::c_int = 0x00020000;
pub const MS_SYNC : ::c_int = 0x4;
pub const MS_INVALIDATE : ::c_int = 0x2;
@@ -349,42 +386,91 @@ pub const MAP_NORESERVE : ::c_int = 0x40;
pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
pub const MAP_WIRED: ::c_int = 0x800;
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_SYNC_IO : ::c_int = 10;
+pub const _PC_FILESIZEBITS : ::c_int = 11;
+pub const _PC_SYMLINK_MAX : ::c_int = 12;
+pub const _PC_2_SYMLINKS : ::c_int = 13;
+pub const _PC_ACL_EXTENDED : ::c_int = 14;
+pub const _PC_MIN_HOLE_SIZE : ::c_int = 15;
+
+pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
pub const _SC_IOV_MAX : ::c_int = 32;
+pub const _SC_MAPPED_FILES : ::c_int = 33;
+pub const _SC_MEMLOCK : ::c_int = 34;
+pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
+pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 38;
+pub const _SC_CLK_TCK : ::c_int = 39;
+pub const _SC_ATEXIT_MAX : ::c_int = 40;
+pub const _SC_THREADS : ::c_int = 41;
+pub const _SC_SEMAPHORES : ::c_int = 42;
+pub const _SC_BARRIERS : ::c_int = 43;
+pub const _SC_TIMERS : ::c_int = 44;
+pub const _SC_SPIN_LOCKS : ::c_int = 45;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 46;
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
+pub const _SC_CLOCK_SELECTION : ::c_int = 49;
+pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
+pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
+pub const _SC_AIO_MAX : ::c_int = 52;
+pub const _SC_MESSAGE_PASSING : ::c_int = 53;
+pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
-pub const _SC_THREADS : ::c_int = 41;
-pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
-pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
+pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
+pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
-pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
-pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
pub const _SC_TTY_NAME_MAX : ::c_int = 68;
-pub const _SC_ATEXIT_MAX : ::c_int = 40;
-pub const _SC_CLK_TCK : ::c_int = 39;
-pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
-pub const _SC_AIO_MAX : ::c_int = 52;
-pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
-pub const _SC_MAPPED_FILES : ::c_int = 33;
-pub const _SC_MEMLOCK : ::c_int = 34;
-pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
-pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
-pub const _SC_MESSAGE_PASSING : ::c_int = 53;
-pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
-pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
-pub const _SC_SEMAPHORES : ::c_int = 42;
-pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
-pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
-pub const _SC_TIMERS : ::c_int = 44;
pub const _SC_HOST_NAME_MAX : ::c_int = 69;
+pub const _SC_PASS_MAX : ::c_int = 70;
+pub const _SC_REGEXP : ::c_int = 71;
+pub const _SC_SHELL : ::c_int = 72;
+pub const _SC_SYMLOOP_MAX : ::c_int = 73;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 74;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 75;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 76;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 77;
+pub const _SC_2_PBS : ::c_int = 80;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 81;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 82;
+pub const _SC_2_PBS_LOCATE : ::c_int = 83;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 84;
+pub const _SC_2_PBS_TRACK : ::c_int = 85;
+pub const _SC_SPAWN : ::c_int = 86;
+pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
+pub const _SC_TIMER_MAX : ::c_int = 88;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 89;
+pub const _SC_CPUTIME : ::c_int = 90;
+pub const _SC_THREAD_CPUTIME : ::c_int = 91;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 92;
+// These two variables will be supported in NetBSD 8.0
+// pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
+// pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
+pub const _SC_PHYS_PAGES : ::c_int = 121;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 1001;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
+pub const _SC_SCHED_RT_TS : ::c_int = 2001;
+pub const _SC_SCHED_PRI_MIN : ::c_int = 2002;
+pub const _SC_SCHED_PRI_MAX : ::c_int = 2003;
pub const FD_SETSIZE: usize = 0x100;
@@ -463,8 +549,6 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
-pub const CRTSCTS: ::tcflag_t = 0x00010000;
-
pub const TMP_MAX : ::c_uint = 308915776;
pub const NI_MAXHOST: ::socklen_t = 1025;
@@ -644,6 +728,27 @@ pub const P_PGID: idtype_t = 4;
pub const B460800: ::speed_t = 460800;
pub const B921600: ::speed_t = 921600;
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
+pub const CDTRCTS: ::tcflag_t = 0x00020000;
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
+pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
+
+// dirfd() is a macro on netbsd to access
+// the first field of the struct where dirp points to:
+// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
+f! {
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
+ unsafe { *(dirp as *const ::c_int) }
+ }
+
+ pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ status == 0xffff
+ }
+}
+
extern {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
@@ -693,7 +798,7 @@ extern {
flags: ::c_int,
data: *mut ::c_void,
size: ::size_t) -> ::c_int;
- pub fn ptrace(requeset: ::c_int,
+ pub fn ptrace(request: ::c_int,
pid: ::pid_t,
addr: *mut ::c_void,
data: ::c_int) -> ::c_int;
@@ -719,6 +824,8 @@ extern {
pub fn newlocale(mask: ::c_int,
locale: *const ::c_char,
base: ::locale_t) -> ::locale_t;
+ #[link_name = "__settimeofday50"]
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
}
mod other;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index b0d8128..37c7708 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -1,3 +1,5 @@
+use unix::bsd::O_SYNC;
+
pub type clock_t = i64;
pub type suseconds_t = ::c_long;
pub type dev_t = i32;
@@ -11,6 +13,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
pub type pthread_condattr_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
s! {
pub struct dirent {
@@ -133,6 +136,46 @@ s! {
pub ut_host: [::c_char; UT_HOSTSIZE],
pub ut_time: ::time_t,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_link_state: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_rdomain: u32,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: u64,
+ pub ifi_ierrors: u64,
+ pub ifi_opackets: u64,
+ pub ifi_oerrors: u64,
+ pub ifi_collisions: u64,
+ pub ifi_ibytes: u64,
+ pub ifi_obytes: u64,
+ pub ifi_imcasts: u64,
+ pub ifi_omcasts: u64,
+ pub ifi_iqdrops: u64,
+ pub ifi_oqdrops: u64,
+ pub ifi_noproto: u64,
+ pub ifi_capabilities: u32,
+ pub ifi_lastchange: ::timeval,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_hdrlen: ::c_ushort,
+ pub ifm_index: ::c_ushort,
+ pub ifm_tableid: ::c_ushort,
+ pub ifm_pad1: ::c_uchar,
+ pub ifm_pad2: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_xflags: ::c_int,
+ pub ifm_data: if_data,
+ }
}
pub const UT_NAMESIZE: usize = 32;
@@ -140,12 +183,16 @@ pub const UT_LINESIZE: usize = 8;
pub const UT_HOSTSIZE: usize = 256;
pub const O_CLOEXEC: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x20000;
+pub const O_RSYNC: ::c_int = O_SYNC;
pub const MS_SYNC : ::c_int = 0x0002;
pub const MS_INVALIDATE : ::c_int = 0x0004;
pub const PTHREAD_STACK_MIN : ::size_t = 2048;
+pub const POLLNORM: ::c_short = ::POLLRDNORM;
+
pub const ENOATTR : ::c_int = 83;
pub const EILSEQ : ::c_int = 84;
pub const EOVERFLOW : ::c_int = 87;
@@ -165,6 +212,7 @@ pub const AT_REMOVEDIR: ::c_int = 0x08;
pub const RLIM_NLIMITS: ::c_int = 9;
+pub const SO_TIMESTAMP: ::c_int = 0x0800;
pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_BINDANY: ::c_int = 0x1000;
@@ -232,58 +280,128 @@ pub const RUSAGE_THREAD: ::c_int = 1;
pub const MAP_COPY : ::c_int = 0x0002;
pub const MAP_NOEXTEND : ::c_int = 0x0000;
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_2_SYMLINKS : ::c_int = 10;
+pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11;
+pub const _PC_ASYNC_IO : ::c_int = 12;
+pub const _PC_FILESIZEBITS : ::c_int = 13;
+pub const _PC_PRIO_IO : ::c_int = 14;
+pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15;
+pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16;
+pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17;
+pub const _PC_REC_XFER_ALIGN : ::c_int = 18;
+pub const _PC_SYMLINK_MAX : ::c_int = 19;
+pub const _PC_SYNC_IO : ::c_int = 20;
+pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21;
+
pub const _SC_CLK_TCK : ::c_int = 3;
-pub const _SC_IOV_MAX : ::c_int = 51;
-pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
-pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
-pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
-pub const _SC_THREADS : ::c_int = 91;
-pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
-pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
-pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
-pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
-pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
-pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
-pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
-pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
-pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
-pub const _SC_TTY_NAME_MAX : ::c_int = 107;
-pub const _SC_ATEXIT_MAX : ::c_int = 46;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
+pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
+pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 34;
+pub const _SC_2_PBS : ::c_int = 35;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37;
+pub const _SC_2_PBS_LOCATE : ::c_int = 38;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 39;
+pub const _SC_2_PBS_TRACK : ::c_int = 40;
+pub const _SC_ADVISORY_INFO : ::c_int = 41;
pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
pub const _SC_AIO_MAX : ::c_int = 43;
+pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
+pub const _SC_ATEXIT_MAX : ::c_int = 46;
+pub const _SC_BARRIERS : ::c_int = 47;
+pub const _SC_CLOCK_SELECTION : ::c_int = 48;
+pub const _SC_CPUTIME : ::c_int = 49;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
+pub const _SC_IOV_MAX : ::c_int = 51;
+pub const _SC_IPV6 : ::c_int = 52;
pub const _SC_MAPPED_FILES : ::c_int = 53;
pub const _SC_MEMLOCK : ::c_int = 54;
pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
pub const _SC_MESSAGE_PASSING : ::c_int = 57;
pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
+pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
+pub const _SC_PRIORITIZED_IO : ::c_int = 60;
pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
+pub const _SC_RAW_SOCKETS : ::c_int = 62;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 63;
+pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
+pub const _SC_REGEXP : ::c_int = 65;
+pub const _SC_RTSIG_MAX : ::c_int = 66;
pub const _SC_SEMAPHORES : ::c_int = 67;
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
+pub const _SC_SHELL : ::c_int = 69;
+pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
+pub const _SC_SPAWN : ::c_int = 71;
+pub const _SC_SPIN_LOCKS : ::c_int = 72;
+pub const _SC_SPORADIC_SERVER : ::c_int = 73;
+pub const _SC_SS_REPL_MAX : ::c_int = 74;
pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
+pub const _SC_SYMLOOP_MAX : ::c_int = 76;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
+pub const _SC_THREAD_CPUTIME : ::c_int = 79;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
+pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
+pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
+pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
+pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87;
+pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
+pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
+pub const _SC_THREADS : ::c_int = 91;
+pub const _SC_TIMEOUTS : ::c_int = 92;
+pub const _SC_TIMER_MAX : ::c_int = 93;
pub const _SC_TIMERS : ::c_int = 94;
+pub const _SC_TRACE : ::c_int = 95;
+pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96;
+pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97;
+pub const _SC_TRACE_INHERIT : ::c_int = 98;
+pub const _SC_TRACE_LOG : ::c_int = 99;
+pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
+pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
+pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
+pub const _SC_TRACE_NAME_MAX : ::c_int = 104;
+pub const _SC_TRACE_SYS_MAX : ::c_int = 105;
+pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106;
+pub const _SC_TTY_NAME_MAX : ::c_int = 107;
+pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 109;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 111;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112;
+pub const _SC_V7_ILP32_OFF32 : ::c_int = 113;
+pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114;
+pub const _SC_V7_LP64_OFF64 : ::c_int = 115;
+pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116;
pub const _SC_XOPEN_CRYPT : ::c_int = 117;
pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
pub const _SC_XOPEN_LEGACY : ::c_int = 119;
pub const _SC_XOPEN_REALTIME : ::c_int = 120;
pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
+pub const _SC_XOPEN_STREAMS : ::c_int = 122;
pub const _SC_XOPEN_UNIX : ::c_int = 123;
+pub const _SC_XOPEN_UUCP : ::c_int = 124;
pub const _SC_XOPEN_VERSION : ::c_int = 125;
-pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
-pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
-pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
-pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
-pub const _SC_PRIORITIZED_IO : ::c_int = 60;
-pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
-pub const _SC_RTSIG_MAX : ::c_int = 66;
-pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
-pub const _SC_TIMER_MAX : ::c_int = 93;
-pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_PHYS_PAGES : ::c_int = 500;
+pub const _SC_AVPHYS_PAGES : ::c_int = 501;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 502;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
pub const FD_SETSIZE: usize = 1024;
@@ -313,6 +431,8 @@ 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_FLAG1: ::uint16_t = 0x2000;
pub const EV_ERROR: ::uint16_t = 0x4000;
pub const EV_EOF: ::uint16_t = 0x8000;
@@ -456,7 +576,23 @@ pub const KI_WMESGLEN: ::c_int = 8;
pub const KI_MAXLOGNAME: ::c_int = 32;
pub const KI_EMULNAMELEN: ::c_int = 8;
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS;
+pub const OLCUC: ::tcflag_t = 0x20;
+pub const ONOCR: ::tcflag_t = 0x40;
+pub const ONLRET: ::tcflag_t = 0x80;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x8000;
+pub const SOCK_NONBLOCK: ::c_int = 0x4000;
+pub const SOCK_DNS: ::c_int = 0x1000;
+
+f! {
+ pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ status & 0o177777 == 0o177777
+ }
+}
+
extern {
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -486,6 +622,8 @@ extern {
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn pledge(promises: *const ::c_char,
paths: *mut *const ::c_char) -> ::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;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
index 8b36ee5..5c80447 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
@@ -30,4 +30,6 @@ s! {
extern {
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
+ pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+ envp: *const *const ::c_char) -> ::c_int;
}