From bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sat, 16 Sep 2017 08:42:30 -0700 Subject: Update libc crate to 0.2.30 Import subrepo libc/:libc at 3520512a8c9cb55661910318a6fb169a75c02a59 --- libc/src/unix/bsd/netbsdlike/mod.rs | 70 +++++--- libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 165 ++++++++++++++--- libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs | 198 +++++++++++++++++---- .../src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs | 2 + 4 files changed, 348 insertions(+), 87 deletions(-) (limited to 'libc/src/unix/bsd/netbsdlike') 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; } -- cgit v1.2.3