diff options
Diffstat (limited to 'libc/src/unix/solarish')
-rw-r--r-- | libc/src/unix/solarish/compat.rs | 19 | ||||
-rw-r--r-- | libc/src/unix/solarish/mod.rs | 924 |
2 files changed, 653 insertions, 290 deletions
diff --git a/libc/src/unix/solarish/compat.rs b/libc/src/unix/solarish/compat.rs index 8631d60..a336452 100644 --- a/libc/src/unix/solarish/compat.rs +++ b/libc/src/unix/solarish/compat.rs @@ -5,14 +5,25 @@ use unix::solarish::*; pub unsafe fn cfmakeraw(termios: *mut ::termios) { let mut t = *termios as ::termios; - t.c_iflag &= !(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + t.c_iflag &= !(IMAXBEL + | IGNBRK + | BRKINT + | PARMRK + | ISTRIP + | INLCR + | IGNCR + | ICRNL + | IXON); t.c_oflag &= !OPOST; - t.c_lflag &= !(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t.c_cflag &= !(CSIZE|PARENB); + t.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + t.c_cflag &= !(CSIZE | PARENB); t.c_cflag |= CS8; } -pub unsafe fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int { +pub unsafe fn cfsetspeed( + termios: *mut ::termios, + speed: ::speed_t, +) -> ::c_int { // Neither of these functions on illumos or Solaris actually ever // return an error ::cfsetispeed(termios, speed); diff --git a/libc/src/unix/solarish/mod.rs b/libc/src/unix/solarish/mod.rs index 7895614..06c1a20 100644 --- a/libc/src/unix/solarish/mod.rs +++ b/libc/src/unix/solarish/mod.rs @@ -34,6 +34,7 @@ pub type nl_item = ::c_int; pub type mqd_t = *mut ::c_void; pub type id_t = ::c_int; pub type idtype_t = ::c_uint; +pub type shmatt_t = ::c_ulong; pub type door_attr_t = ::c_uint; pub type door_id_t = ::c_ulonglong; @@ -42,7 +43,9 @@ pub type door_id_t = ::c_ulonglong; pub enum timezone {} impl ::Copy for timezone {} impl ::Clone for timezone { - fn clone(&self) -> timezone { *self } + fn clone(&self) -> timezone { + *self + } } s! { @@ -55,6 +58,16 @@ s! { pub imr_interface: in_addr, } + pub struct ipc_perm { + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::mode_t, + pub seq: ::c_uint, + pub key: ::key_t, + } + pub struct sockaddr { pub sa_family: sa_family_t, pub sa_data: [::c_char; 14], @@ -204,6 +217,33 @@ s! { pub ai_next: *mut addrinfo, } + pub struct shmid_ds { + pub shm_perm: ipc_perm, + pub shm_segsz: ::size_t, + #[cfg(target_os = "illumos")] + pub shm_amp: *mut ::c_void, + #[cfg(target_os = "solaris")] + pub shm_flags: ::uintptr_t, + pub shm_lkcnt: ::c_ushort, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + pub shm_cnattch: ::c_ulong, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + #[cfg(target_os = "illumos")] + pub shm_pad4: [i64; 4], + #[cfg(target_os = "solaris")] + pub shm_amp: *mut ::c_void, + #[cfg(target_os = "solaris")] + pub shm_gransize: u64, + #[cfg(target_os = "solaris")] + pub shm_allocated: u64, + #[cfg(target_os = "solaris")] + pub shm_pad4: [i64; 1], + } + pub struct sigset_t { bits: [u32; 4], } @@ -346,6 +386,21 @@ s! { pub d_descriptor: ::c_int, pub d_id: ::door_id_t } + + pub struct exit_status { + e_termination: ::c_short, + e_exit: ::c_short, + } + + pub struct utmp { + pub ut_user: [::c_char; 8], + pub ut_id: [::c_char; 4], + pub ut_line: [::c_char; 12], + pub ut_pid: ::c_short, + pub ut_type: ::c_short, + pub ut_exit: exit_status, + pub ut_time: ::time_t, + } } s_no_extra_traits! { @@ -355,6 +410,20 @@ s_no_extra_traits! { pub u64: u64, } + pub struct utmpx { + pub ut_user: [::c_char; _UTX_USERSIZE], + pub ut_id: [::c_char; _UTX_IDSIZE], + pub ut_line: [::c_char; _UTX_LINESIZE], + pub ut_pid: ::pid_t, + pub ut_type: ::c_short, + pub ut_exit: exit_status, + pub ut_tv: ::timeval, + pub ut_session: ::c_int, + pub ut_pad: [::c_int; _UTX_PADSIZE], + pub ut_syslen: ::c_short, + pub ut_host: [::c_char; _UTX_HOSTSIZE], + } + pub struct sockaddr_un { pub sun_family: sa_family_t, pub sun_path: [c_char; 108] @@ -432,6 +501,62 @@ s_no_extra_traits! { cfg_if! { if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self.ut_user == other.ut_user + && self.ut_line == other.ut_line + && self.ut_id == other.ut_id + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_syslen == other.ut_syslen + && self.ut_pad == other.ut_pad + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + } + } + + impl Eq for utmpx {} + + impl ::fmt::Debug for utmpx { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmpx") + .field("ut_user", &self.ut_user) + .field("ut_id", &self.ut_id) + .field("ut_line", &self.ut_line) + .field("ut_pid", &self.ut_pid) + .field("ut_type", &self.ut_type) + .field("ut_exit", &self.ut_exit) + .field("ut_tv", &self.ut_tv) + .field("ut_session", &self.ut_session) + .field("ut_pad", &self.ut_pad) + .field("ut_syslen", &self.ut_syslen) + .field("ut_host", &self.ut_host) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + self.ut_user.hash(state); + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_syslen.hash(state); + self.ut_pad.hash(state); + } + } + impl PartialEq for epoll_event { fn eq(&self, other: &epoll_event) -> bool { self.events == other.events @@ -714,11 +839,11 @@ pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE); pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY); pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES); pub const LC_ALL_MASK: ::c_int = LC_CTYPE_MASK - | LC_NUMERIC_MASK - | LC_TIME_MASK - | LC_COLLATE_MASK - | LC_MONETARY_MASK - | LC_MESSAGES_MASK; + | LC_NUMERIC_MASK + | LC_TIME_MASK + | LC_COLLATE_MASK + | LC_MONETARY_MASK + | LC_MESSAGES_MASK; pub const DAY_1: ::nl_item = 1; pub const DAY_2: ::nl_item = 2; @@ -815,7 +940,7 @@ pub const SIG_UNBLOCK: ::c_int = 2; pub const SIG_SETMASK: ::c_int = 3; pub const SIGEV_NONE: ::c_int = 1; -pub const SIGEV_SIGNAL: ::c_int =2; +pub const SIGEV_SIGNAL: ::c_int = 2; pub const SIGEV_THREAD: ::c_int = 3; pub const IPV6_UNICAST_HOPS: ::c_int = 0x5; @@ -965,6 +1090,9 @@ pub const P_CTID: idtype_t = 13; pub const P_CPUID: idtype_t = 14; pub const P_PSETID: idtype_t = 15; +pub const UTIME_OMIT: c_long = -2; +pub const UTIME_NOW: c_long = -1; + pub const PROT_NONE: ::c_int = 0; pub const PROT_READ: ::c_int = 1; pub const PROT_WRITE: ::c_int = 2; @@ -976,6 +1104,7 @@ pub const MAP_PRIVATE: ::c_int = 0x0002; pub const MAP_FIXED: ::c_int = 0x0010; pub const MAP_NORESERVE: ::c_int = 0x40; pub const MAP_ANON: ::c_int = 0x0100; +pub const MAP_ANONYMOUS: ::c_int = 0x0100; pub const MAP_RENAME: ::c_int = 0x20; pub const MAP_ALIGN: ::c_int = 0x200; pub const MAP_TEXT: ::c_int = 0x400; @@ -1134,17 +1263,17 @@ pub const F_SETFL: ::c_int = 4; pub const SIGTRAP: ::c_int = 5; -pub const GLOB_APPEND : ::c_int = 32; -pub const GLOB_DOOFFS : ::c_int = 16; -pub const GLOB_ERR : ::c_int = 1; -pub const GLOB_MARK : ::c_int = 2; -pub const GLOB_NOCHECK : ::c_int = 8; -pub const GLOB_NOSORT : ::c_int = 4; +pub const GLOB_APPEND: ::c_int = 32; +pub const GLOB_DOOFFS: ::c_int = 16; +pub const GLOB_ERR: ::c_int = 1; +pub const GLOB_MARK: ::c_int = 2; +pub const GLOB_NOCHECK: ::c_int = 8; +pub const GLOB_NOSORT: ::c_int = 4; pub const GLOB_NOESCAPE: ::c_int = 64; -pub const GLOB_NOSPACE : ::c_int = -2; -pub const GLOB_ABORTED : ::c_int = -1; -pub const GLOB_NOMATCH : ::c_int = -3; +pub const GLOB_NOSPACE: ::c_int = -2; +pub const GLOB_ABORTED: ::c_int = -1; +pub const GLOB_NOMATCH: ::c_int = -3; pub const POLLIN: ::c_short = 0x1; pub const POLLPRI: ::c_short = 0x2; @@ -1196,6 +1325,7 @@ pub const RLIMIT_NOFILE: ::c_int = 5; pub const RLIMIT_VMEM: ::c_int = 6; pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: rlim_t = 7; pub const RLIM_INFINITY: rlim_t = 0x7fffffff; @@ -1314,12 +1444,14 @@ pub const IFF_PROMISC: ::c_int = 0x0000000100; // Receive all packets pub const IFF_ALLMULTI: ::c_int = 0x0000000200; // Receive all multicast pkts pub const IFF_INTELLIGENT: ::c_int = 0x0000000400; // Protocol code on board pub const IFF_MULTICAST: ::c_int = 0x0000000800; // Supports multicast + // Multicast using broadcst. add. pub const IFF_MULTI_BCAST: ::c_int = 0x0000001000; pub const IFF_UNNUMBERED: ::c_int = 0x0000002000; // Non-unique address pub const IFF_DHCPRUNNING: ::c_int = 0x0000004000; // DHCP controls interface pub const IFF_PRIVATE: ::c_int = 0x0000008000; // Do not advertise pub const IFF_NOXMIT: ::c_int = 0x0000010000; // Do not transmit pkts + // No address - just on-link subnet pub const IFF_NOLOCAL: ::c_int = 0x0000020000; pub const IFF_DEPRECATED: ::c_int = 0x0000040000; // Address is deprecated @@ -1335,7 +1467,7 @@ pub const IFF_FAILED: ::c_int = 0x0010000000; // Interface has failed pub const IFF_STANDBY: ::c_int = 0x0020000000; // Interface is a hot-spare pub const IFF_INACTIVE: ::c_int = 0x0040000000; // Functioning but not used pub const IFF_OFFLINE: ::c_int = 0x0080000000; // Interface is offline -// If CoS marking is supported + // If CoS marking is supported pub const IFF_COS_ENABLED: ::c_longlong = 0x0200000000; pub const IFF_PREFERRED: ::c_longlong = 0x0400000000; // Prefer as source addr. pub const IFF_TEMPORARY: ::c_longlong = 0x0800000000; // RFC3041 @@ -1344,6 +1476,16 @@ pub const IFF_VIRTUAL: ::c_longlong = 0x2000000000; // Cannot send/receive pkts pub const IFF_DUPLICATE: ::c_longlong = 0x4000000000; // Local address in use pub const IFF_IPMP: ::c_longlong = 0x8000000000; // IPMP IP interface +// sys/ipc.h: +pub const IPC_ALLOC: ::c_int = 0x8000; +pub const IPC_CREAT: ::c_int = 0x200; +pub const IPC_EXCL: ::c_int = 0x400; +pub const IPC_NOWAIT: ::c_int = 0x800; +pub const IPC_PRIVATE: key_t = 0; +pub const IPC_RMID: ::c_int = 10; +pub const IPC_SET: ::c_int = 11; +pub const IPC_SEAT: ::c_int = 12; + pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; @@ -1545,8 +1687,8 @@ pub const _SC_IPV6: ::c_int = 762; pub const _SC_RAW_SOCKETS: ::c_int = 763; pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX -pub const _COND_MAGIC: u16 = 0x4356; // CV -pub const _RWL_MAGIC: u16 = 0x5257; // RW +pub const _COND_MAGIC: u16 = 0x4356; // CV +pub const _RWL_MAGIC: u16 = 0x5257; // RW pub const NCCS: usize = 19; @@ -1559,13 +1701,13 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { __pthread_mutex_type: PTHREAD_PROCESS_PRIVATE, __pthread_mutex_magic: _MUTEX_MAGIC, __pthread_mutex_lock: 0, - __pthread_mutex_data: 0 + __pthread_mutex_data: 0, }; pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { __pthread_cond_flag: [0; 4], __pthread_cond_type: PTHREAD_PROCESS_PRIVATE, __pthread_cond_magic: _COND_MAGIC, - __pthread_cond_data: 0 + __pthread_cond_data: 0, }; pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __pthread_rwlock_readers: 0, @@ -1573,7 +1715,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __pthread_rwlock_magic: _RWL_MAGIC, __pthread_rwlock_mutex: PTHREAD_MUTEX_INITIALIZER, __pthread_rwlock_readercv: PTHREAD_COND_INITIALIZER, - __pthread_rwlock_writercv: PTHREAD_COND_INITIALIZER + __pthread_rwlock_writercv: PTHREAD_COND_INITIALIZER, }; pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; @@ -1607,23 +1749,41 @@ pub const PORT_SOURCE_FILE: ::c_int = 7; pub const PORT_SOURCE_POSTWAIT: ::c_int = 8; pub const PORT_SOURCE_SIGNAL: ::c_int = 9; +pub const NONROOT_USR: ::c_short = 2; +pub const _UTX_USERSIZE: usize = 32; +pub const _UTX_LINESIZE: usize = 32; +pub const _UTX_PADSIZE: usize = 5; +pub const _UTX_IDSIZE: usize = 4; +pub const _UTX_HOSTSIZE: usize = 257; +pub const EMPTY: ::c_short = 0; +pub const RUN_LVL: ::c_short = 1; +pub const BOOT_TIME: ::c_short = 2; +pub const OLD_TIME: ::c_short = 3; +pub const NEW_TIME: ::c_short = 4; +pub const INIT_PROCESS: ::c_short = 5; +pub const LOGIN_PROCESS: ::c_short = 6; +pub const USER_PROCESS: ::c_short = 7; +pub const DEAD_PROCESS: ::c_short = 8; +pub const ACCOUNTING: ::c_short = 9; +pub const DOWN_TIME: ::c_short = 10; + const _TIOC: ::c_int = ('T' as i32) << 8; const tIOC: ::c_int = ('t' as i32) << 8; -pub const TCGETA: ::c_int = (_TIOC|1); -pub const TCSETA: ::c_int = (_TIOC|2); -pub const TCSETAW: ::c_int = (_TIOC|3); -pub const TCSETAF: ::c_int = (_TIOC|4); -pub const TCSBRK: ::c_int = (_TIOC|5); -pub const TCXONC: ::c_int = (_TIOC|6); -pub const TCFLSH: ::c_int = (_TIOC|7); -pub const TCDSET: ::c_int = (_TIOC|32); -pub const TCGETS: ::c_int = (_TIOC|13); -pub const TCSETS: ::c_int = (_TIOC|14); -pub const TCSANOW: ::c_int = (_TIOC|14); -pub const TCSETSW: ::c_int = (_TIOC|15); -pub const TCSADRAIN: ::c_int = (_TIOC|15); -pub const TCSETSF: ::c_int = (_TIOC|16); -pub const TCSAFLUSH: ::c_int = (_TIOC|16); +pub const TCGETA: ::c_int = (_TIOC | 1); +pub const TCSETA: ::c_int = (_TIOC | 2); +pub const TCSETAW: ::c_int = (_TIOC | 3); +pub const TCSETAF: ::c_int = (_TIOC | 4); +pub const TCSBRK: ::c_int = (_TIOC | 5); +pub const TCXONC: ::c_int = (_TIOC | 6); +pub const TCFLSH: ::c_int = (_TIOC | 7); +pub const TCDSET: ::c_int = (_TIOC | 32); +pub const TCGETS: ::c_int = (_TIOC | 13); +pub const TCSETS: ::c_int = (_TIOC | 14); +pub const TCSANOW: ::c_int = (_TIOC | 14); +pub const TCSETSW: ::c_int = (_TIOC | 15); +pub const TCSADRAIN: ::c_int = (_TIOC | 15); +pub const TCSETSF: ::c_int = (_TIOC | 16); +pub const TCSAFLUSH: ::c_int = (_TIOC | 16); pub const TCIFLUSH: ::c_int = 0; pub const TCOFLUSH: ::c_int = 1; pub const TCIOFLUSH: ::c_int = 2; @@ -1632,55 +1792,55 @@ pub const TCOON: ::c_int = 1; pub const TCIOFF: ::c_int = 2; pub const TCION: ::c_int = 3; pub const TIOC: ::c_int = _TIOC; -pub const TIOCKBON: ::c_int = (_TIOC|8); -pub const TIOCKBOF: ::c_int = (_TIOC|9); -pub const TIOCGWINSZ: ::c_int = (_TIOC|104); -pub const TIOCSWINSZ: ::c_int = (_TIOC|103); -pub const TIOCGSOFTCAR: ::c_int = (_TIOC|105); -pub const TIOCSSOFTCAR: ::c_int = (_TIOC|106); -pub const TIOCSETLD: ::c_int = (_TIOC|123); -pub const TIOCGETLD: ::c_int = (_TIOC|124); -pub const TIOCGPPS: ::c_int = (_TIOC|125); -pub const TIOCSPPS: ::c_int = (_TIOC|126); -pub const TIOCGPPSEV: ::c_int = (_TIOC|127); -pub const TIOCGETD: ::c_int = (tIOC|0); -pub const TIOCSETD: ::c_int = (tIOC|1); -pub const TIOCHPCL: ::c_int = (tIOC|2); -pub const TIOCGETP: ::c_int = (tIOC|8); -pub const TIOCSETP: ::c_int = (tIOC|9); -pub const TIOCSETN: ::c_int = (tIOC|10); -pub const TIOCEXCL: ::c_int = (tIOC|13); -pub const TIOCNXCL: ::c_int = (tIOC|14); -pub const TIOCFLUSH: ::c_int = (tIOC|16); -pub const TIOCSETC: ::c_int = (tIOC|17); -pub const TIOCGETC: ::c_int = (tIOC|18); -pub const TIOCLBIS: ::c_int = (tIOC|127); -pub const TIOCLBIC: ::c_int = (tIOC|126); -pub const TIOCLSET: ::c_int = (tIOC|125); -pub const TIOCLGET: ::c_int = (tIOC|124); -pub const TIOCSBRK: ::c_int = (tIOC|123); -pub const TIOCCBRK: ::c_int = (tIOC|122); -pub const TIOCSDTR: ::c_int = (tIOC|121); -pub const TIOCCDTR: ::c_int = (tIOC|120); -pub const TIOCSLTC: ::c_int = (tIOC|117); -pub const TIOCGLTC: ::c_int = (tIOC|116); -pub const TIOCOUTQ: ::c_int = (tIOC|115); -pub const TIOCNOTTY: ::c_int = (tIOC|113); -pub const TIOCSCTTY: ::c_int = (tIOC|132); -pub const TIOCSTOP: ::c_int = (tIOC|111); -pub const TIOCSTART: ::c_int = (tIOC|110); -pub const TIOCSILOOP: ::c_int = (tIOC|109); -pub const TIOCCILOOP: ::c_int = (tIOC|108); -pub const TIOCGPGRP: ::c_int = (tIOC|20); -pub const TIOCSPGRP: ::c_int = (tIOC|21); -pub const TIOCGSID: ::c_int = (tIOC|22); -pub const TIOCSTI: ::c_int = (tIOC|23); -pub const TIOCMSET: ::c_int = (tIOC|26); -pub const TIOCMBIS: ::c_int = (tIOC|27); -pub const TIOCMBIC: ::c_int = (tIOC|28); -pub const TIOCMGET: ::c_int = (tIOC|29); -pub const TIOCREMOTE: ::c_int = (tIOC|30); -pub const TIOCSIGNAL: ::c_int = (tIOC|31); +pub const TIOCKBON: ::c_int = (_TIOC | 8); +pub const TIOCKBOF: ::c_int = (_TIOC | 9); +pub const TIOCGWINSZ: ::c_int = (_TIOC | 104); +pub const TIOCSWINSZ: ::c_int = (_TIOC | 103); +pub const TIOCGSOFTCAR: ::c_int = (_TIOC | 105); +pub const TIOCSSOFTCAR: ::c_int = (_TIOC | 106); +pub const TIOCSETLD: ::c_int = (_TIOC | 123); +pub const TIOCGETLD: ::c_int = (_TIOC | 124); +pub const TIOCGPPS: ::c_int = (_TIOC | 125); +pub const TIOCSPPS: ::c_int = (_TIOC | 126); +pub const TIOCGPPSEV: ::c_int = (_TIOC | 127); +pub const TIOCGETD: ::c_int = (tIOC | 0); +pub const TIOCSETD: ::c_int = (tIOC | 1); +pub const TIOCHPCL: ::c_int = (tIOC | 2); +pub const TIOCGETP: ::c_int = (tIOC | 8); +pub const TIOCSETP: ::c_int = (tIOC | 9); +pub const TIOCSETN: ::c_int = (tIOC | 10); +pub const TIOCEXCL: ::c_int = (tIOC | 13); +pub const TIOCNXCL: ::c_int = (tIOC | 14); +pub const TIOCFLUSH: ::c_int = (tIOC | 16); +pub const TIOCSETC: ::c_int = (tIOC | 17); +pub const TIOCGETC: ::c_int = (tIOC | 18); +pub const TIOCLBIS: ::c_int = (tIOC | 127); +pub const TIOCLBIC: ::c_int = (tIOC | 126); +pub const TIOCLSET: ::c_int = (tIOC | 125); +pub const TIOCLGET: ::c_int = (tIOC | 124); +pub const TIOCSBRK: ::c_int = (tIOC | 123); +pub const TIOCCBRK: ::c_int = (tIOC | 122); +pub const TIOCSDTR: ::c_int = (tIOC | 121); +pub const TIOCCDTR: ::c_int = (tIOC | 120); +pub const TIOCSLTC: ::c_int = (tIOC | 117); +pub const TIOCGLTC: ::c_int = (tIOC | 116); +pub const TIOCOUTQ: ::c_int = (tIOC | 115); +pub const TIOCNOTTY: ::c_int = (tIOC | 113); +pub const TIOCSCTTY: ::c_int = (tIOC | 132); +pub const TIOCSTOP: ::c_int = (tIOC | 111); +pub const TIOCSTART: ::c_int = (tIOC | 110); +pub const TIOCSILOOP: ::c_int = (tIOC | 109); +pub const TIOCCILOOP: ::c_int = (tIOC | 108); +pub const TIOCGPGRP: ::c_int = (tIOC | 20); +pub const TIOCSPGRP: ::c_int = (tIOC | 21); +pub const TIOCGSID: ::c_int = (tIOC | 22); +pub const TIOCSTI: ::c_int = (tIOC | 23); +pub const TIOCMSET: ::c_int = (tIOC | 26); +pub const TIOCMBIS: ::c_int = (tIOC | 27); +pub const TIOCMBIC: ::c_int = (tIOC | 28); +pub const TIOCMGET: ::c_int = (tIOC | 29); +pub const TIOCREMOTE: ::c_int = (tIOC | 30); +pub const TIOCSIGNAL: ::c_int = (tIOC | 31); pub const EPOLLIN: ::c_int = 0x1; pub const EPOLLPRI: ::c_int = 0x2; @@ -1795,6 +1955,11 @@ pub const VLNEXT: usize = 15; pub const VSTATUS: usize = 16; pub const VERASE2: usize = 17; +// 3SOCKET flags +pub const SOCK_CLOEXEC: ::c_int = 0x080000; +pub const SOCK_NONBLOCK: ::c_int = 0x100000; +pub const SOCK_NDELAY: ::c_int = 0x200000; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; @@ -1855,18 +2020,22 @@ f! { } } -extern { +extern "C" { pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; - pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, - buflen: ::size_t) -> ::c_int; + pub fn strerror_r( + errnum: ::c_int, + buf: *mut c_char, + buflen: ::size_t, + ) -> ::c_int; pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; - pub fn sem_init(sem: *mut sem_t, - pshared: ::c_int, - value: ::c_uint) - -> ::c_int; + pub fn sem_init( + sem: *mut sem_t, + pshared: ::c_int, + value: ::c_uint, + ) -> ::c_int; pub fn abs(i: ::c_int) -> ::c_int; pub fn acct(filename: *const ::c_char) -> ::c_int; @@ -1876,177 +2045,300 @@ extern { pub fn rand() -> ::c_int; pub fn srand(seed: ::c_uint); - pub fn gettimeofday(tp: *mut ::timeval, - tz: *mut ::c_void) -> ::c_int; + pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; + pub fn settimeofday(tp: *const ::timeval, tz: *const ::c_void) -> ::c_int; pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int; - pub fn mincore(addr: *const ::c_void, len: ::size_t, - vec: *mut c_char) -> ::c_int; + pub fn mincore( + addr: *const ::c_void, + len: ::size_t, + vec: *mut c_char, + ) -> ::c_int; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; - pub fn setgroups(ngroups: ::c_int, - ptr: *const ::gid_t) -> ::c_int; + pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int; - pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) - -> ::c_int; + pub fn mprotect( + addr: *const ::c_void, + len: ::size_t, + prot: ::c_int, + ) -> ::c_int; pub fn ___errno() -> *mut ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; - pub fn clock_nanosleep(clk_id: ::clockid_t, - flags: ::c_int, - rqtp: *const ::timespec, - rmtp: *mut ::timespec) -> ::c_int; - pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; - pub fn getnameinfo(sa: *const ::sockaddr, - salen: ::socklen_t, - host: *mut ::c_char, - hostlen: ::socklen_t, - serv: *mut ::c_char, - sevlen: ::socklen_t, - flags: ::c_int) -> ::c_int; + pub fn clock_nanosleep( + clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec, + ) -> ::c_int; + pub fn clock_settime( + clk_id: ::clockid_t, + tp: *const ::timespec, + ) -> ::c_int; + pub fn getnameinfo( + sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + sevlen: ::socklen_t, + flags: ::c_int, + ) -> ::c_int; pub fn setpwent(); pub fn endpwent(); pub fn getpwent() -> *mut passwd; pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) + -> *mut ::c_char; pub fn duplocale(base: ::locale_t) -> ::locale_t; pub fn freelocale(loc: ::locale_t); - pub fn newlocale(mask: ::c_int, - locale: *const ::c_char, - base: ::locale_t) -> ::locale_t; + pub fn newlocale( + mask: ::c_int, + locale: *const ::c_char, + base: ::locale_t, + ) -> ::locale_t; pub fn uselocale(loc: ::locale_t) -> ::locale_t; 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; 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; - - pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t, dev: dev_t) -> ::c_int; - pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, - mode: ::mode_t) -> ::c_int; + pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) + -> ::c_int; + + pub fn mknodat( + dirfd: ::c_int, + pathname: *const ::c_char, + mode: ::mode_t, + dev: dev_t, + ) -> ::c_int; + pub fn mkfifoat( + dirfd: ::c_int, + pathname: *const ::c_char, + mode: ::mode_t, + ) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); - 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; - 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; - pub fn sem_timedwait(sem: *mut sem_t, - abstime: *const ::timespec) -> ::c_int; - pub fn sem_getvalue(sem: *mut sem_t, - sval: *mut ::c_int) -> ::c_int; - pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t, - abstime: *const ::timespec) -> ::c_int; - pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, - options: ::c_int) -> ::c_int; - - pub fn glob(pattern: *const ::c_char, - flags: ::c_int, - errfunc: ::Option<extern fn(epath: *const ::c_char, - errno: ::c_int) -> ::c_int>, - pglob: *mut ::glob_t) -> ::c_int; + pub fn pthread_create( + native: *mut ::pthread_t, + attr: *const ::pthread_attr_t, + f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, + value: *mut ::c_void, + ) -> ::c_int; + 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; + pub fn sem_timedwait( + sem: *mut sem_t, + abstime: *const ::timespec, + ) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; + pub fn pthread_mutex_timedlock( + lock: *mut pthread_mutex_t, + abstime: *const ::timespec, + ) -> ::c_int; + pub fn waitid( + idtype: idtype_t, + id: id_t, + infop: *mut ::siginfo_t, + options: ::c_int, + ) -> ::c_int; + + pub fn glob( + pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option< + extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int, + >, + pglob: *mut ::glob_t, + ) -> ::c_int; pub fn globfree(pglob: *mut ::glob_t); - pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) - -> ::c_int; + pub fn posix_madvise( + addr: *mut ::c_void, + len: ::size_t, + advice: ::c_int, + ) -> ::c_int; + + pub fn shmat( + shmid: ::c_int, + shmaddr: *const ::c_void, + shmflg: ::c_int, + ) -> *mut ::c_void; + + pub fn shmctl( + shmid: ::c_int, + cmd: ::c_int, + buf: *mut ::shmid_ds, + ) -> ::c_int; + + pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; + + pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; + + pub fn shm_open( + name: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; pub fn shm_unlink(name: *const ::c_char) -> ::c_int; pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); pub fn telldir(dirp: *mut ::DIR) -> ::c_long; - pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) - -> ::c_int; - - pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int; + pub fn madvise( + addr: *mut ::c_void, + len: ::size_t, + advice: ::c_int, + ) -> ::c_int; + + pub fn msync( + addr: *mut ::c_void, + len: ::size_t, + flags: ::c_int, + ) -> ::c_int; pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; - pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, - flags: ::c_int, addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t) -> ::ssize_t; + pub fn recvfrom( + socket: ::c_int, + buf: *mut ::c_void, + len: ::size_t, + flags: ::c_int, + addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t, + ) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; - pub fn futimesat(fd: ::c_int, path: *const ::c_char, - times: *const ::timeval) -> ::c_int; - pub fn utimensat(dirfd: ::c_int, path: *const ::c_char, - times: *const ::timespec, flag: ::c_int) -> ::c_int; + pub fn futimesat( + fd: ::c_int, + path: *const ::c_char, + times: *const ::timeval, + ) -> ::c_int; + pub fn futimens(dirfd: ::c_int, times: *const ::timespec) -> ::c_int; + pub fn utimensat( + dirfd: ::c_int, + path: *const ::c_char, + times: *const ::timespec, + flag: ::c_int, + ) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; #[cfg_attr(target_os = "illumos", link_name = "__xnet_bind")] - pub fn bind(socket: ::c_int, address: *const ::sockaddr, - address_len: ::socklen_t) -> ::c_int; - - pub fn writev(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; - pub fn readv(fd: ::c_int, - iov: *const ::iovec, - iovcnt: ::c_int) -> ::ssize_t; + pub fn bind( + socket: ::c_int, + address: *const ::sockaddr, + address_len: ::socklen_t, + ) -> ::c_int; + + pub fn writev( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + ) -> ::ssize_t; + pub fn readv( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + ) -> ::ssize_t; #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")] - pub fn sendmsg(fd: ::c_int, - msg: *const ::msghdr, - flags: ::c_int) -> ::ssize_t; + pub fn sendmsg( + fd: ::c_int, + msg: *const ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; #[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")] - pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) - -> ::ssize_t; + pub fn recvmsg( + fd: ::c_int, + msg: *mut ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; pub fn mq_close(mqd: ::mqd_t) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; - pub fn mq_receive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint) -> ::ssize_t; - pub fn mq_timedreceive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint, - abs_timeout: *const ::timespec) -> ::ssize_t; - pub fn mq_send(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint) -> ::c_int; - pub fn mq_timedsend(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint, - abs_timeout: *const ::timespec) -> ::c_int; + pub fn mq_receive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + ) -> ::ssize_t; + pub fn mq_timedreceive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::ssize_t; + pub fn mq_send( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + ) -> ::c_int; + pub fn mq_timedsend( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::c_int; pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; - pub fn mq_setattr(mqd: ::mqd_t, - newattr: *const ::mq_attr, - oldattr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr( + mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr, + ) -> ::c_int; pub fn port_create() -> ::c_int; - pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t, - events: ::c_int, user: *mut ::c_void) -> ::c_int; - pub fn port_dissociate(port: ::c_int, source: ::c_int, object: ::uintptr_t) - -> ::c_int; - pub fn port_get(port: ::c_int, pe: *mut port_event, - timeout: *mut ::timespec) -> ::c_int; - pub fn port_getn(port: ::c_int, pe_list: *mut port_event, max: ::c_uint, - nget: *mut ::c_uint, timeout: *mut ::timespec) - -> ::c_int; - pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char, - envp: *const *const ::c_char) - -> ::c_int; - #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), - link_name = "__posix_getgrgid_r")] - pub fn getgrgid_r(gid: ::gid_t, - grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - pub fn sigaltstack(ss: *const stack_t, - oss: *mut stack_t) -> ::c_int; + pub fn port_associate( + port: ::c_int, + source: ::c_int, + object: ::uintptr_t, + events: ::c_int, + user: *mut ::c_void, + ) -> ::c_int; + pub fn port_dissociate( + port: ::c_int, + source: ::c_int, + object: ::uintptr_t, + ) -> ::c_int; + pub fn port_get( + port: ::c_int, + pe: *mut port_event, + timeout: *mut ::timespec, + ) -> ::c_int; + pub fn port_getn( + port: ::c_int, + pe_list: *mut port_event, + max: ::c_uint, + nget: *mut ::c_uint, + timeout: *mut ::timespec, + ) -> ::c_int; + pub fn fexecve( + fd: ::c_int, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + #[cfg_attr( + any(target_os = "solaris", target_os = "illumos"), + link_name = "__posix_getgrgid_r" + )] + pub fn getgrgid_r( + gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + 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; @@ -2054,93 +2346,153 @@ extern { // there are things using epoll on illumos (built using the // x86_64-sun-solaris target) which would break until the illumos target is // present in rustc. - pub fn epoll_pwait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int, - sigmask: *const ::sigset_t) -> ::c_int; + pub fn epoll_pwait( + epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + sigmask: *const ::sigset_t, + ) -> ::c_int; pub fn epoll_create(size: ::c_int) -> ::c_int; pub fn epoll_create1(flags: ::c_int) -> ::c_int; - pub fn epoll_wait(epfd: ::c_int, - events: *mut ::epoll_event, - maxevents: ::c_int, - timeout: ::c_int) -> ::c_int; - pub fn epoll_ctl(epfd: ::c_int, - op: ::c_int, - fd: ::c_int, - event: *mut ::epoll_event) -> ::c_int; - - #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), - 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; - pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, - oldset: *mut sigset_t) -> ::c_int; + pub fn epoll_wait( + epfd: ::c_int, + events: *mut ::epoll_event, + maxevents: ::c_int, + timeout: ::c_int, + ) -> ::c_int; + pub fn epoll_ctl( + epfd: ::c_int, + op: ::c_int, + fd: ::c_int, + event: *mut ::epoll_event, + ) -> ::c_int; + + #[cfg_attr( + any(target_os = "solaris", target_os = "illumos"), + 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; + 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(any(target_os = "solaris", target_os = "illumos"), - 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(any(target_os = "solaris", target_os = "illumos"), - 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(any(target_os = "solaris", target_os = "illumos"), - link_name = "__posix_getpwent_r")] - pub fn getpwent_r(pwd: *mut passwd, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut passwd) -> ::c_int; - #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), - link_name = "__posix_getgrent_r")] - pub fn getgrent_r(grp: *mut ::group, - buf: *mut ::c_char, - buflen: ::size_t, - result: *mut *mut ::group) -> ::c_int; - #[cfg_attr(any(target_os = "solaris", target_os = "illumos"), - 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; + #[cfg_attr( + any(target_os = "solaris", target_os = "illumos"), + 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( + any(target_os = "solaris", target_os = "illumos"), + 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( + any(target_os = "solaris", target_os = "illumos"), + link_name = "__posix_getpwent_r" + )] + pub fn getpwent_r( + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; + #[cfg_attr( + any(target_os = "solaris", target_os = "illumos"), + link_name = "__posix_getgrent_r" + )] + pub fn getgrent_r( + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + #[cfg_attr( + any(target_os = "solaris", target_os = "illumos"), + 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 "C" fn()>, + parent: ::Option<unsafe extern "C" fn()>, + child: ::Option<unsafe extern "C" fn()>, + ) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn setgrent(); pub fn endgrent(); pub fn getgrent() -> *mut ::group; - pub fn popen(command: *const c_char, - mode: *const c_char) -> *mut ::FILE; + pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int; - pub fn door_return(data_ptr: *const ::c_char, - data_size: ::size_t, - desc_ptr: *const door_desc_t, - num_desc: ::c_uint); - pub fn door_create(server_procedure: extern fn(cookie: *const ::c_void, - argp: *const ::c_char, - arg_size: ::size_t, - dp: *const door_desc_t, - n_desc: ::c_uint), - cookie: *const ::c_void, - attributes: door_attr_t) -> ::c_int; + pub fn door_return( + data_ptr: *const ::c_char, + data_size: ::size_t, + desc_ptr: *const door_desc_t, + num_desc: ::c_uint, + ); + pub fn door_create( + server_procedure: extern "C" fn( + cookie: *const ::c_void, + argp: *const ::c_char, + arg_size: ::size_t, + dp: *const door_desc_t, + n_desc: ::c_uint, + ), + cookie: *const ::c_void, + attributes: door_attr_t, + ) -> ::c_int; pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int; + + pub fn makeutx(ux: *const utmpx) -> *mut utmpx; + pub fn modutx(ux: *const utmpx) -> *mut utmpx; + pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int; + pub fn utmpxname(file: *const ::c_char) -> ::c_int; + pub fn getutxent() -> *mut utmpx; + pub fn getutxid(ut: *const utmpx) -> *mut utmpx; + pub fn getutxline(ut: *const utmpx) -> *mut utmpx; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn setutxent(); + pub fn endutxent(); + + pub fn endutent(); + pub fn getutent() -> *mut utmp; + pub fn getutid(u: *const utmp) -> *mut utmp; + pub fn getutline(u: *const utmp) -> *mut utmp; + pub fn pututline(u: *const utmp) -> *mut utmp; + pub fn setutent(); + pub fn utmpname(file: *const ::c_char) -> ::c_int; + + pub fn getutmp(ux: *const utmpx, u: *mut utmp); + pub fn getutmpx(u: *const utmp, ux: *mut utmpx); + pub fn updwtmp(file: *const ::c_char, u: *mut utmp); } mod compat; |