aboutsummaryrefslogtreecommitdiff
path: root/src/unix/solarish/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/solarish/mod.rs')
-rw-r--r--src/unix/solarish/mod.rs738
1 files changed, 432 insertions, 306 deletions
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 06c1a20c..6166da5d 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -1,6 +1,7 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type caddr_t = *mut ::c_char;
pub type clockid_t = ::c_int;
pub type blkcnt_t = ::c_long;
@@ -19,8 +20,11 @@ pub type rlim_t = ::c_ulong;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type time_t = ::c_long;
+pub type timer_t = ::c_int;
pub type wchar_t = ::c_int;
pub type nfds_t = ::c_ulong;
+pub type projid_t = ::c_int;
+pub type zoneid_t = ::c_int;
pub type suseconds_t = ::c_long;
pub type off_t = ::c_long;
@@ -36,9 +40,6 @@ 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;
-
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
@@ -48,6 +49,15 @@ impl ::Clone for timezone {
}
}
+#[cfg_attr(feature = "extra_traits", derive(Debug))]
+pub enum ucred_t {}
+impl ::Copy for ucred_t {}
+impl ::Clone for ucred_t {
+ fn clone(&self) -> ucred_t {
+ *self
+ }
+}
+
s! {
pub struct in_addr {
pub s_addr: ::in_addr_t,
@@ -111,6 +121,11 @@ s! {
pub ifa_data: *mut ::c_void
}
+ pub struct itimerspec {
+ pub it_interval: ::timespec,
+ pub it_value: ::timespec,
+ }
+
pub struct tm {
pub tm_sec: ::c_int,
pub tm_min: ::c_int,
@@ -217,33 +232,6 @@ 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],
}
@@ -371,7 +359,7 @@ s! {
pub mq_maxmsg: ::c_long,
pub mq_msgsize: ::c_long,
pub mq_curmsgs: ::c_long,
- _pad: [::c_int; 4]
+ _pad: [::c_int; 12]
}
pub struct port_event {
@@ -382,9 +370,9 @@ s! {
pub portev_user: *mut ::c_void,
}
- pub struct door_desc_t__d_data__d_desc {
- pub d_descriptor: ::c_int,
- pub d_id: ::door_id_t
+ pub struct port_notify {
+ pub portnfy_port: ::c_int,
+ pub portnfy_user: *mut ::c_void,
}
pub struct exit_status {
@@ -401,10 +389,44 @@ s! {
pub ut_exit: exit_status,
pub ut_time: ::time_t,
}
+
+ pub struct timex {
+ pub modes: u32,
+ pub offset: i32,
+ pub freq: i32,
+ pub maxerror: i32,
+ pub esterror: i32,
+ pub status: i32,
+ pub constant: i32,
+ pub precision: i32,
+ pub tolerance: i32,
+ pub ppsfreq: i32,
+ pub jitter: i32,
+ pub shift: i32,
+ pub stabil: i32,
+ pub jitcnt: i32,
+ pub calcnt: i32,
+ pub errcnt: i32,
+ pub stbcnt: i32,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timeval,
+ pub maxerror: i32,
+ pub esterror: i32,
+ }
+
}
s_no_extra_traits! {
- #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed))]
+ #[cfg_attr(all(
+ any(target_arch = "x86", target_arch = "x86_64"),
+ libc_packedN
+ ), repr(packed(4)))]
+ #[cfg_attr(all(
+ any(target_arch = "x86", target_arch = "x86_64"),
+ not(libc_packedN)
+ ), repr(packed))]
pub struct epoll_event {
pub events: u32,
pub u64: u64,
@@ -478,25 +500,6 @@ s_no_extra_traits! {
pub sigev_notify_attributes: *const ::pthread_attr_t,
__sigev_pad2: ::c_int,
}
-
- pub union door_desc_t__d_data {
- pub d_desc: door_desc_t__d_data__d_desc,
- d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */
- }
-
- pub struct door_desc_t {
- pub d_attributes: door_attr_t,
- pub d_data: door_desc_t__d_data,
- }
-
- pub struct door_arg_t {
- pub data_ptr: *const ::c_char,
- pub data_size: ::size_t,
- pub desc_ptr: *const door_desc_t,
- pub dec_num: ::c_uint,
- pub rbuf: *const ::c_char,
- pub rsize: ::size_t,
- }
}
cfg_if! {
@@ -536,7 +539,7 @@ cfg_if! {
.field("ut_session", &self.ut_session)
.field("ut_pad", &self.ut_pad)
.field("ut_syslen", &self.ut_syslen)
- .field("ut_host", &self.ut_host)
+ .field("ut_host", &&self.ut_host[..])
.finish()
}
}
@@ -832,12 +835,12 @@ pub const LC_COLLATE: ::c_int = 3;
pub const LC_MONETARY: ::c_int = 4;
pub const LC_MESSAGES: ::c_int = 5;
pub const LC_ALL: ::c_int = 6;
-pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
-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_CTYPE_MASK: ::c_int = 1 << LC_CTYPE;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME;
+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
@@ -943,10 +946,15 @@ pub const SIGEV_NONE: ::c_int = 1;
pub const SIGEV_SIGNAL: ::c_int = 2;
pub const SIGEV_THREAD: ::c_int = 3;
+pub const IP_RECVDSTADDR: ::c_int = 0x7;
+pub const IP_SEC_OPT: ::c_int = 0x22;
+
pub const IPV6_UNICAST_HOPS: ::c_int = 0x5;
pub const IPV6_MULTICAST_IF: ::c_int = 0x6;
pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7;
pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
+pub const IPV6_RECVPKTINFO: ::c_int = 0x12;
+pub const IPV6_SEC_OPT: ::c_int = 0x22;
pub const IPV6_V6ONLY: ::c_int = 0x27;
cfg_if! {
@@ -969,6 +977,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 = 4;
pub const _IOLBF: ::c_int = 64;
@@ -988,11 +998,13 @@ pub const O_CREAT: ::c_int = 256;
pub const O_EXCL: ::c_int = 1024;
pub const O_NOCTTY: ::c_int = 2048;
pub const O_TRUNC: ::c_int = 512;
-pub const O_NOFOLLOW: ::c_int = 0x200000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_DIRECTORY: ::c_int = 0x1000000;
pub const O_SEARCH: ::c_int = 0x200000;
pub const O_EXEC: ::c_int = 0x400000;
pub const O_CLOEXEC: ::c_int = 0x800000;
pub const O_ACCMODE: ::c_int = 0x600003;
+pub const O_XATTR: ::c_int = 0x4000;
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@@ -1031,6 +1043,12 @@ pub const F_DUPFD_CLOEXEC: ::c_int = 37;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_GETLK: ::c_int = 14;
+pub const F_ALLOCSP: ::c_int = 10;
+pub const F_FREESP: ::c_int = 11;
+pub const F_BLOCKS: ::c_int = 18;
+pub const F_BLKSIZE: ::c_int = 19;
+pub const F_SHARE: ::c_int = 40;
+pub const F_UNSHARE: ::c_int = 41;
pub const SIGHUP: ::c_int = 1;
pub const SIGINT: ::c_int = 2;
pub const SIGQUIT: ::c_int = 3;
@@ -1072,6 +1090,10 @@ pub const WNOWAIT: ::c_int = 0x80;
pub const AT_FDCWD: ::c_int = 0xffd19553;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x1000;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x2000;
+pub const AT_REMOVEDIR: ::c_int = 0x1;
+pub const _AT_TRIGGER: ::c_int = 0x2;
+pub const AT_EACCESS: ::c_int = 0x4;
pub const P_PID: idtype_t = 0;
pub const P_PPID: idtype_t = 1;
@@ -1117,7 +1139,6 @@ pub const MCL_FUTURE: ::c_int = 0x0002;
pub const MS_SYNC: ::c_int = 0x0004;
pub const MS_ASYNC: ::c_int = 0x0001;
pub const MS_INVALIDATE: ::c_int = 0x0002;
-pub const MS_INVALCURPROC: ::c_int = 0x0008;
pub const EPERM: ::c_int = 1;
pub const ENOENT: ::c_int = 2;
@@ -1256,10 +1277,13 @@ pub const EAI_SYSTEM: ::c_int = 11;
pub const EAI_OVERFLOW: ::c_int = 12;
pub const F_DUPFD: ::c_int = 0;
+pub const F_DUP2FD: ::c_int = 9;
+pub const F_DUP2FD_CLOEXEC: ::c_int = 36;
pub const F_GETFD: ::c_int = 1;
pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
+pub const F_GETXFL: ::c_int = 45;
pub const SIGTRAP: ::c_int = 5;
@@ -1327,7 +1351,7 @@ 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;
+pub const RLIM_INFINITY: rlim_t = 0xfffffffffffffffd;
pub const RUSAGE_SELF: ::c_int = 0;
pub const RUSAGE_CHILDREN: ::c_int = -1;
@@ -1341,8 +1365,6 @@ pub const MADV_FREE: ::c_int = 5;
pub const AF_UNSPEC: ::c_int = 0;
pub const AF_UNIX: ::c_int = 1;
-pub const AF_LOCAL: ::c_int = 0;
-pub const AF_FILE: ::c_int = 0;
pub const AF_INET: ::c_int = 2;
pub const AF_IMPLINK: ::c_int = 3;
pub const AF_PUP: ::c_int = 4;
@@ -1374,7 +1396,6 @@ pub const AF_POLICY: ::c_int = 29;
pub const AF_INET_OFFLOAD: ::c_int = 30;
pub const AF_TRILL: ::c_int = 31;
pub const AF_PACKET: ::c_int = 32;
-pub const AF_LX_NETLINK: ::c_int = 33;
pub const SOCK_DGRAM: ::c_int = 1;
pub const SOCK_STREAM: ::c_int = 2;
@@ -1391,8 +1412,27 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
pub const IPV6_JOIN_GROUP: ::c_int = 9;
pub const IPV6_LEAVE_GROUP: ::c_int = 10;
-pub const TCP_NODELAY: ::c_int = 1;
-pub const TCP_KEEPIDLE: ::c_int = 34;
+// These TCP socket options are common between illumos and Solaris, while higher
+// numbers have generally diverged:
+pub const TCP_NODELAY: ::c_int = 0x1;
+pub const TCP_MAXSEG: ::c_int = 0x2;
+pub const TCP_KEEPALIVE: ::c_int = 0x8;
+pub const TCP_NOTIFY_THRESHOLD: ::c_int = 0x10;
+pub const TCP_ABORT_THRESHOLD: ::c_int = 0x11;
+pub const TCP_CONN_NOTIFY_THRESHOLD: ::c_int = 0x12;
+pub const TCP_CONN_ABORT_THRESHOLD: ::c_int = 0x13;
+pub const TCP_RECVDSTADDR: ::c_int = 0x14;
+pub const TCP_INIT_CWND: ::c_int = 0x15;
+pub const TCP_KEEPALIVE_THRESHOLD: ::c_int = 0x16;
+pub const TCP_KEEPALIVE_ABORT_THRESHOLD: ::c_int = 0x17;
+pub const TCP_CORK: ::c_int = 0x18;
+pub const TCP_RTO_INITIAL: ::c_int = 0x19;
+pub const TCP_RTO_MIN: ::c_int = 0x1a;
+pub const TCP_RTO_MAX: ::c_int = 0x1b;
+pub const TCP_LINGER2: ::c_int = 0x1c;
+
+pub const UDP_NAT_T_ENDPOINT: ::c_int = 0x0103;
+
pub const SOL_SOCKET: ::c_int = 0xffff;
pub const SO_DEBUG: ::c_int = 0x01;
pub const SO_ACCEPTCONN: ::c_int = 0x0002;
@@ -1431,6 +1471,9 @@ pub const MSG_DUPCTRL: ::c_int = 0x800;
pub const MSG_XPG4_2: ::c_int = 0x8000;
pub const MSG_MAXIOVLEN: ::c_int = 16;
+pub const IF_NAMESIZE: ::size_t = 32;
+pub const IFNAMSIZ: ::size_t = 16;
+
// https://docs.oracle.com/cd/E23824_01/html/821-1475/if-7p.html
pub const IFF_UP: ::c_int = 0x0000000001; // Address is up
pub const IFF_BROADCAST: ::c_int = 0x0000000002; // Broadcast address valid
@@ -1746,8 +1789,6 @@ pub const PORT_SOURCE_FD: ::c_int = 4;
pub const PORT_SOURCE_ALERT: ::c_int = 5;
pub const PORT_SOURCE_MQ: ::c_int = 6;
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;
@@ -1769,21 +1810,21 @@ 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;
@@ -1792,55 +1833,53 @@ 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 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;
@@ -1854,8 +1893,9 @@ pub const EPOLLERR: ::c_int = 0x8;
pub const EPOLLHUP: ::c_int = 0x10;
pub const EPOLLET: ::c_int = 0x80000000;
pub const EPOLLRDHUP: ::c_int = 0x2000;
-pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
pub const EPOLL_CTL_ADD: ::c_int = 1;
pub const EPOLL_CTL_MOD: ::c_int = 3;
@@ -1886,9 +1926,9 @@ pub const B230400: speed_t = 20;
pub const B307200: speed_t = 21;
pub const B460800: speed_t = 22;
pub const B921600: speed_t = 23;
-pub const CSTART: ::tcflag_t = 021;
-pub const CSTOP: ::tcflag_t = 023;
-pub const CSWTCH: ::tcflag_t = 032;
+pub const CSTART: ::tcflag_t = 0o21;
+pub const CSTOP: ::tcflag_t = 0o23;
+pub const CSWTCH: ::tcflag_t = 0o32;
pub const CSIZE: ::tcflag_t = 0o000060;
pub const CS5: ::tcflag_t = 0;
pub const CS6: ::tcflag_t = 0o000020;
@@ -1955,12 +1995,161 @@ pub const VLNEXT: usize = 15;
pub const VSTATUS: usize = 16;
pub const VERASE2: usize = 17;
+// <sys/stropts.h>
+const STR: ::c_int = (b'S' as ::c_int) << 8;
+pub const I_NREAD: ::c_int = STR | 0o1;
+pub const I_PUSH: ::c_int = STR | 0o2;
+pub const I_POP: ::c_int = STR | 0o3;
+pub const I_LOOK: ::c_int = STR | 0o4;
+pub const I_FLUSH: ::c_int = STR | 0o5;
+pub const I_SRDOPT: ::c_int = STR | 0o6;
+pub const I_GRDOPT: ::c_int = STR | 0o7;
+pub const I_STR: ::c_int = STR | 0o10;
+pub const I_SETSIG: ::c_int = STR | 0o11;
+pub const I_GETSIG: ::c_int = STR | 0o12;
+pub const I_FIND: ::c_int = STR | 0o13;
+pub const I_LINK: ::c_int = STR | 0o14;
+pub const I_UNLINK: ::c_int = STR | 0o15;
+pub const I_PEEK: ::c_int = STR | 0o17;
+pub const I_FDINSERT: ::c_int = STR | 0o20;
+pub const I_SENDFD: ::c_int = STR | 0o21;
+pub const I_RECVFD: ::c_int = STR | 0o16;
+pub const I_SWROPT: ::c_int = STR | 0o23;
+pub const I_GWROPT: ::c_int = STR | 0o24;
+pub const I_LIST: ::c_int = STR | 0o25;
+pub const I_PLINK: ::c_int = STR | 0o26;
+pub const I_PUNLINK: ::c_int = STR | 0o27;
+pub const I_ANCHOR: ::c_int = STR | 0o30;
+pub const I_FLUSHBAND: ::c_int = STR | 0o34;
+pub const I_CKBAND: ::c_int = STR | 0o35;
+pub const I_GETBAND: ::c_int = STR | 0o36;
+pub const I_ATMARK: ::c_int = STR | 0o37;
+pub const I_SETCLTIME: ::c_int = STR | 0o40;
+pub const I_GETCLTIME: ::c_int = STR | 0o41;
+pub const I_CANPUT: ::c_int = STR | 0o42;
+pub const I_SERROPT: ::c_int = STR | 0o43;
+pub const I_GERROPT: ::c_int = STR | 0o44;
+pub const I_ESETSIG: ::c_int = STR | 0o45;
+pub const I_EGETSIG: ::c_int = STR | 0o46;
+pub const __I_PUSH_NOCTTY: ::c_int = STR | 0o47;
+
// 3SOCKET flags
pub const SOCK_CLOEXEC: ::c_int = 0x080000;
pub const SOCK_NONBLOCK: ::c_int = 0x100000;
pub const SOCK_NDELAY: ::c_int = 0x200000;
+//<sys/timex.h>
+pub const SCALE_KG: ::c_int = 1 << 6;
+pub const SCALE_KF: ::c_int = 1 << 16;
+pub const SCALE_KH: ::c_int = 1 << 2;
+pub const MAXTC: ::c_int = 1 << 6;
+pub const SCALE_PHASE: ::c_int = 1 << 22;
+pub const SCALE_USEC: ::c_int = 1 << 16;
+pub const SCALE_UPDATE: ::c_int = SCALE_KG * MAXTC;
+pub const FINEUSEC: ::c_int = 1 << 22;
+pub const MAXPHASE: ::c_int = 512000;
+pub const MAXFREQ: ::c_int = 512 * SCALE_USEC;
+pub const MAXTIME: ::c_int = 200 << PPS_AVG;
+pub const MINSEC: ::c_int = 16;
+pub const MAXSEC: ::c_int = 1200;
+pub const PPS_AVG: ::c_int = 2;
+pub const PPS_SHIFT: ::c_int = 2;
+pub const PPS_SHIFTMAX: ::c_int = 8;
+pub const PPS_VALID: ::c_int = 120;
+pub const MAXGLITCH: ::c_int = 30;
+pub const MOD_OFFSET: u32 = 0x0001;
+pub const MOD_FREQUENCY: u32 = 0x0002;
+pub const MOD_MAXERROR: u32 = 0x0004;
+pub const MOD_ESTERROR: u32 = 0x0008;
+pub const MOD_STATUS: u32 = 0x0010;
+pub const MOD_TIMECONST: u32 = 0x0020;
+pub const MOD_CLKB: u32 = 0x4000;
+pub const MOD_CLKA: u32 = 0x8000;
+pub const STA_PLL: u32 = 0x0001;
+pub const STA_PPSFREQ: i32 = 0x0002;
+pub const STA_PPSTIME: i32 = 0x0004;
+pub const STA_FLL: i32 = 0x0008;
+pub const STA_INS: i32 = 0x0010;
+pub const STA_DEL: i32 = 0x0020;
+pub const STA_UNSYNC: i32 = 0x0040;
+pub const STA_FREQHOLD: i32 = 0x0080;
+pub const STA_PPSSIGNAL: i32 = 0x0100;
+pub const STA_PPSJITTER: i32 = 0x0200;
+pub const STA_PPSWANDER: i32 = 0x0400;
+pub const STA_PPSERROR: i32 = 0x0800;
+pub const STA_CLOCKERR: i32 = 0x1000;
+pub const STA_RONLY: i32 =
+ STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR | STA_CLOCKERR;
+pub const TIME_OK: i32 = 0;
+pub const TIME_INS: i32 = 1;
+pub const TIME_DEL: i32 = 2;
+pub const TIME_OOP: i32 = 3;
+pub const TIME_WAIT: i32 = 4;
+pub const TIME_ERROR: i32 = 5;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+// As per sys/socket.h, header alignment must be 8 bytes on SPARC
+// and 4 bytes everywhere else:
+#[cfg(target_arch = "sparc64")]
+const _CMSG_HDR_ALIGNMENT: usize = 8;
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+const _CMSG_HDR_ALIGNMENT: usize = 4;
+
+const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
+
+const_fn! {
+ {const} fn _CMSG_HDR_ALIGN(p: usize) -> usize {
+ (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
+ }
+
+ {const} fn _CMSG_DATA_ALIGN(p: usize) -> usize {
+ (p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
+ }
+}
+
f! {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ _CMSG_DATA_ALIGN(cmsg.offset(1) as usize) as *mut ::c_uchar
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _CMSG_DATA_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
+ if ((*mhdr).msg_controllen as usize) < ::mem::size_of::<::cmsghdr>() {
+ 0 as *mut ::cmsghdr
+ } else {
+ (*mhdr).msg_control as *mut ::cmsghdr
+ }
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = _CMSG_HDR_ALIGN(cmsg as usize + (*cmsg).cmsg_len as usize
+ + ::mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ _CMSG_HDR_ALIGN(cmsg as usize + (*cmsg).cmsg_len as usize)
+ as *mut ::cmsghdr
+ }
+ }
+
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ _CMSG_HDR_ALIGN(::mem::size_of::<::cmsghdr>() as usize
+ + length as usize) as ::c_uint
+ }
+
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
let fd = fd as usize;
@@ -1986,36 +2175,38 @@ f! {
*slot = 0;
}
}
+}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+safe_f! {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0xFF) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
(status >> 8) & 0xFF
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0x7F
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
(status & 0xffff) == 0xffff
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
(status & 0xff00) >> 8
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
((status & 0xff) > 0) && (status & 0xff00 == 0)
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
((status & 0xff) == 0x7f) && ((status & 0xff00) != 0)
}
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0x80) != 0
}
}
@@ -2024,18 +2215,10 @@ 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;
@@ -2051,19 +2234,10 @@ extern "C" {
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 initgroups(name: *const ::c_char, basegid: ::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;
@@ -2073,10 +2247,7 @@ extern "C" {
rqtp: *const ::timespec,
rmtp: *mut ::timespec,
) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -2090,22 +2261,16 @@ extern "C" {
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 setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
pub fn mknodat(
dirfd: ::c_int,
@@ -2113,11 +2278,7 @@ extern "C" {
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 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);
@@ -2127,6 +2288,11 @@ extern "C" {
f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
value: *mut ::c_void,
) -> ::c_int;
+ pub fn pthread_attr_getstack(
+ attr: *const ::pthread_attr_t,
+ stackaddr: *mut *mut ::c_void,
+ stacksize: *mut ::size_t,
+ ) -> ::c_int;
pub fn pthread_condattr_getclock(
attr: *const pthread_condattr_t,
clock_id: *mut clockid_t,
@@ -2135,76 +2301,45 @@ extern "C" {
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_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 waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "_glob_ext")]
pub fn glob(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "_globfree_ext")]
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 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 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 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_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 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 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;
@@ -2217,11 +2352,7 @@ extern "C" {
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 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,
@@ -2232,35 +2363,21 @@ extern "C" {
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 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 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(
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn accept4(
fd: ::c_int,
- msg: *mut ::msghdr,
+ address: *mut sockaddr,
+ address_len: *mut socklen_t,
flags: ::c_int,
- ) -> ::ssize_t;
+ ) -> ::c_int;
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
@@ -2292,11 +2409,7 @@ extern "C" {
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,
@@ -2305,16 +2418,8 @@ extern "C" {
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_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,
@@ -2322,10 +2427,13 @@ extern "C" {
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,
+ pub fn port_send(port: ::c_int, events: ::c_int, user: *mut ::c_void) -> ::c_int;
+ pub fn port_sendn(
+ port_list: *mut ::c_int,
+ error_list: *mut ::c_int,
+ nent: ::c_uint,
+ events: ::c_int,
+ user: *mut ::c_void,
) -> ::c_int;
#[cfg_attr(
any(target_os = "solaris", target_os = "illumos"),
@@ -2344,7 +2452,7 @@ extern "C" {
// The epoll functions are actually only present on illumos. However,
// there are things using epoll on illumos (built using the
- // x86_64-sun-solaris target) which would break until the illumos target is
+ // x86_64-pc-solaris target) which would break until the illumos target is
// present in rustc.
pub fn epoll_pwait(
epfd: ::c_int,
@@ -2362,12 +2470,8 @@ extern "C" {
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;
+ 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"),
@@ -2380,11 +2484,7 @@ extern "C" {
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 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;
@@ -2451,25 +2551,6 @@ extern "C" {
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 "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;
@@ -2493,7 +2574,52 @@ extern "C" {
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);
+
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+
+ pub fn timer_create(clock_id: clockid_t, evp: *mut sigevent, timerid: *mut timer_t) -> ::c_int;
+ pub fn timer_delete(timerid: timer_t) -> ::c_int;
+ pub fn timer_getoverrun(timerid: timer_t) -> ::c_int;
+ pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> ::c_int;
+ pub fn timer_settime(
+ timerid: timer_t,
+ flags: ::c_int,
+ value: *const itimerspec,
+ ovalue: *mut itimerspec,
+ ) -> ::c_int;
+
+ pub fn ucred_get(pid: ::pid_t) -> *mut ucred_t;
+ pub fn getpeerucred(fd: ::c_int, ucred: *mut *mut ucred_t) -> ::c_int;
+
+ pub fn ucred_free(ucred: *mut ucred_t);
+
+ pub fn ucred_geteuid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getruid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getsuid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getegid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getrgid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getsgid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getgroups(ucred: *const ucred_t, groups: *mut *const ::gid_t) -> ::c_int;
+ pub fn ucred_getpid(ucred: *const ucred_t) -> ::pid_t;
+ pub fn ucred_getprojid(ucred: *const ucred_t) -> projid_t;
+ pub fn ucred_getzoneid(ucred: *const ucred_t) -> zoneid_t;
+ pub fn ucred_getpflags(ucred: *const ucred_t, flags: ::c_uint) -> ::c_uint;
+
+ pub fn ucred_size() -> ::size_t;
}
mod compat;
pub use self::compat::*;
+
+cfg_if! {
+ if #[cfg(target_os = "illumos")] {
+ mod illumos;
+ pub use self::illumos::*;
+ } else if #[cfg(target_os = "solaris")] {
+ mod solaris;
+ pub use self::solaris::*;
+ } else {
+ // Unknown target_os
+ }
+}