summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/unix/bsd/mod.rs7
-rw-r--r--src/unix/haiku/mod.rs345
-rw-r--r--src/unix/mod.rs9
-rw-r--r--src/unix/newlib/mod.rs9
-rw-r--r--src/unix/notbsd/mod.rs7
-rw-r--r--src/unix/solaris/mod.rs8
-rw-r--r--src/unix/uclibc/mod.rs8
7 files changed, 335 insertions, 58 deletions
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index ef8dafee5f..ab256d1eb8 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -299,6 +299,7 @@ pub const MDMBUF: ::tcflag_t = 0x00100000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
+pub const RTLD_LAZY: ::c_int = 0x1;
pub const RTLD_NOW: ::c_int = 0x2;
pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;
pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
@@ -313,6 +314,12 @@ pub const TCP_MAXSEG: ::c_int = 2;
pub const PIPE_BUF: usize = 512;
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLPRI: ::c_short = 0x2;
+pub const POLLOUT: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLHUP: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLWRNORM: ::c_short = 0x004;
pub const POLLRDBAND: ::c_short = 0x080;
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index bce79e7a8b..2b05e8ef87 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -169,6 +169,14 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}
+ pub struct flock {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off_t,
+ pub l_len: ::off_t,
+ pub l_pid: ::pid_t,
+ }
+
pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
@@ -290,6 +298,14 @@ s! {
sa_userdata: *mut ::c_void,
}
+ pub struct sigevent {
+ pub sigev_notify: ::c_int,
+ pub sigev_signo: ::c_int,
+ pub sigev_value: ::sigval,
+ __unused1: *mut ::c_void, // actually a function pointer
+ pub sigev_notify_attributes: *mut ::pthread_attr_t,
+ }
+
pub struct sem_t {
pub se_type: i32,
pub se_named_id: i32, // this is actually a union
@@ -330,6 +346,27 @@ pub const F_GETFD: ::c_int = 0x0002;
pub const F_SETFD: ::c_int = 0x0004;
pub const F_GETFL: ::c_int = 0x0008;
pub const F_SETFL: ::c_int = 0x0010;
+pub const F_GETLK: ::c_int = 0x0020;
+pub const F_SETLK: ::c_int = 0x0080;
+pub const F_SETLKW: ::c_int = 0x0100;
+pub const F_DUPFD_CLOEXEC: ::c_int = 0x0200;
+
+pub const AT_FDCWD: ::c_int = -1;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02;
+pub const AT_REMOVEDIR: ::c_int = 0x04;
+pub const AT_EACCESS: ::c_int = 0x08;
+
+pub const POLLIN: ::c_short = 0x0001;
+pub const POLLOUT: ::c_short = 0x0002;
+pub const POLLRDNORM: ::c_short = POLLIN;
+pub const POLLWRNORM: ::c_short = POLLOUT;
+pub const POLLRDBAND: ::c_short = 0x0008;
+pub const POLLWRBAND: ::c_short = 0x0010;
+pub const POLLPRI: ::c_short = 0x0020;
+pub const POLLERR: ::c_short = 0x0004;
+pub const POLLHUP: ::c_short = 0x0080;
+pub const POLLNVAL: ::c_short = 0x1000;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
@@ -349,6 +386,8 @@ pub const RLIMIT_NLIMITS: ::c_int = 8;
pub const RUSAGE_SELF: ::c_int = 0;
+pub const RTLD_LAXY: ::c_int = 0;
+
pub const NCCS: usize = 11;
pub const O_RDONLY: ::c_int = 0x0000;
@@ -431,6 +470,14 @@ pub const SIGXCPU: ::c_int = 28;
pub const SIGXFSZ: ::c_int = 29;
pub const SIGBUS: ::c_int = 30;
+pub const SIG_BLOCK: ::c_int = 1;
+pub const SIG_UNBLOCK: ::c_int = 2;
+pub const SIG_SETMASK: ::c_int = 3;
+
+pub const SIGEV_NONE: ::c_int = 0;
+pub const SIGEV_SIGNAL: ::c_int = 1;
+pub const SIGEV_THREAD: ::c_int = 2;
+
pub const EAI_SYSTEM: ::c_int = 11;
pub const PROT_NONE: ::c_int = 0;
@@ -450,7 +497,9 @@ pub const LC_MESSAGES: ::c_int = 6;
pub const MAP_FILE: ::c_int = 0x00;
pub const MAP_SHARED: ::c_int = 0x01;
pub const MAP_PRIVATE: ::c_int = 0x02;
-pub const MAP_FIXED: ::c_int = 0x004;
+pub const MAP_FIXED: ::c_int = 0x04;
+pub const MAP_ANONYMOUS: ::c_int = 0x08;
+pub const MAP_ANON: ::c_int = MAP_ANONYMOUS;
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
@@ -542,7 +591,7 @@ pub const EISDIR : ::c_int = -2147459063;
pub const ENOTEMPTY : ::c_int = -2147459066;
pub const ENOSPC : ::c_int = -2147459065;
pub const EROFS : ::c_int = -2147459064;
-pub const EMFILE : ::c_int = -214745962;
+pub const EMFILE : ::c_int = -2147459062;
pub const EXDEV : ::c_int = -2147459061;
pub const ELOOP : ::c_int = -2147459060;
pub const ENOEXEC : ::c_int = -2147478782;
@@ -559,9 +608,20 @@ pub const MADV_DONTNEED: ::c_int = 5;
pub const IFF_LOOPBACK: ::c_int = 0x0008;
-pub const AF_UNIX: ::c_int = 9;
+pub const AF_UNSEC: ::c_int = 0;
pub const AF_INET: ::c_int = 1;
-pub const AF_INET6: ::c_int = 6;
+pub const AF_APPLETALK: ::c_int = 2;
+pub const AF_ROUTE: ::c_int = 3;
+pub const AF_LINK: ::c_int = 4;
+pub const AF_INET6: ::c_int = 5;
+pub const AF_DLI: ::c_int = 6;
+pub const AF_IPX: ::c_int = 7;
+pub const AF_NOTIFY: ::c_int = 8;
+pub const AF_LOCAL: ::c_int = 9;
+pub const AF_UNIX: ::c_int = AF_LOCAL;
+pub const AF_BLUETOOTH: ::c_int = 10;
+pub const AF_MAX: ::c_int = 11;
+
pub const IP_MULTICAST_TTL: ::c_int = 10;
pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IP_TTL: ::c_int = 4;
@@ -579,9 +639,17 @@ pub const IPV6_JOIN_GROUP: ::c_int = 28;
pub const IPV6_LEAVE_GROUP: ::c_int = 29;
pub const IPV6_V6ONLY: ::c_int = 30;
-pub const SO_DEBUG: ::c_int = 0x00000004;
-
-pub const MSG_PEEK: ::c_int = 0x2;
+pub const MSG_OOB: ::c_int = 0x0001;
+pub const MSG_PEEK: ::c_int = 0x0002;
+pub const MSG_DONTROUTE: ::c_int = 0x0004;
+pub const MSG_EOR: ::c_int = 0x0008;
+pub const MSG_TRUNC: ::c_int = 0x0010;
+pub const MSG_CTRUNC: ::c_int = 0x0020;
+pub const MSG_WAITALL: ::c_int = 0x0040;
+pub const MSG_DONTWAIT: ::c_int = 0x0080;
+pub const MSG_BCAST: ::c_int = 0x0100;
+pub const MSG_MCAST: ::c_int = 0x0200;
+pub const MSG_EOF: ::c_int = 0x0400;
pub const MSG_NOSIGNAL: ::c_int = 0x0800;
pub const SHUT_RD: ::c_int = 0;
@@ -595,10 +663,18 @@ pub const LOCK_UN: ::c_int = 0x08;
pub const SIGSTKSZ: ::size_t = 16384;
-pub const SA_NODEFER: ::c_int = 0x08;
+pub const PATH_MAX: ::c_int = 1024;
+
+pub const SA_NOCLDSTOP: ::c_int = 0x01;
+pub const SA_NOCLDWAIT: ::c_int = 0x02;
pub const SA_RESETHAND: ::c_int = 0x04;
+pub const SA_NODEFER: ::c_int = 0x08;
pub const SA_RESTART: ::c_int = 0x10;
-pub const SA_NOCLDSTOP: ::c_int = 0x01;
+pub const SA_ONSTACK: ::c_int = 0x20;
+pub const SA_SIGINFO: ::c_int = 0x40;
+pub const SA_NOMASK: ::c_int = SA_NODEFER;
+pub const SA_STACK: ::c_int = SA_ONSTACK;
+pub const SA_ONESHOT: ::c_int = SA_RESETHAND;
pub const FD_SETSIZE: usize = 1024;
@@ -610,21 +686,78 @@ pub const FILENAME_MAX: ::c_uint = 256;
pub const FOPEN_MAX: ::c_uint = 128;
pub const L_tmpnam: ::c_uint = 512;
pub const TMP_MAX: ::c_uint = 32768;
+
+pub const _PC_CHOWN_RESTRICTED: ::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_NO_TRUNC: ::c_int = 5;
+pub const _PC_PATH_MAX: ::c_int = 6;
+pub const _PC_PIPE_BUF: ::c_int = 7;
+pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_LINK_MAX: ::c_int = 25;
+pub const _PC_SYNC_IO: ::c_int = 26;
+pub const _PC_ASYNC_IO: ::c_int = 27;
+pub const _PC_PRIO_IO: ::c_int = 28;
+pub const _PC_SOCK_MAXBUF: ::c_int = 29;
+pub const _PC_FILESIZEBITS: ::c_int = 30;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 31;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 32;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 33;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 34;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 35;
+pub const _PC_SYMLINK_MAX: ::c_int = 36;
+pub const _PC_2_SYMLINKS: ::c_int = 37;
+pub const _PC_XATTR_EXISTS: ::c_int = 38;
+pub const _PC_XATTR_ENABLED: ::c_int = 39;
pub const FIONBIO: ::c_int = 0xbe000000;
-pub const _SC_IOV_MAX : ::c_int = 32;
+pub const _SC_ARG_MAX : ::c_int = 15;
+pub const _SC_CHILD_MAX : ::c_int = 16;
+pub const _SC_CLK_TCK : ::c_int = 17;
+pub const _SC_JOB_CONTROL : ::c_int = 18;
+pub const _SC_NGROUPS_MAX : ::c_int = 19;
+pub const _SC_OPEN_MAX : ::c_int = 20;
+pub const _SC_SAVED_IDS : ::c_int = 21;
+pub const _SC_STREAM_MAX : ::c_int = 22;
+pub const _SC_TZNAME_MAX : ::c_int = 23;
+pub const _SC_VERSION : ::c_int = 24;
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 25;
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 26;
pub const _SC_PAGESIZE : ::c_int = 27;
+pub const _SC_PAGE_SIZE : ::c_int = 27;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 28;
+pub const _SC_SEM_VALUE_MAX : ::c_int = 29;
+pub const _SC_SEMAPHORES : ::c_int = 30;
+pub const _SC_THREADS : ::c_int = 31;
+pub const _SC_IOV_MAX : ::c_int = 32;
+pub const _SC_UIO_MAXIOV : ::c_int = 32;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 34;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 35;
+pub const _SC_ATEXIT_MAX : ::c_int = 37;
+pub const _SC_PASS_MAX : ::c_int = 39;
+pub const _SC_PHYS_PAGES : ::c_int = 40;
+pub const _SC_AVPHYS_PAGES : ::c_int = 41;
+pub const _SC_PIPE : ::c_int = 42;
+pub const _SC_SELECT : ::c_int = 43;
+pub const _SC_POLL : ::c_int = 44;
+pub const _SC_MAPPED_FILES : ::c_int = 45;
+pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 46;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 47;
pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 48;
pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 49;
pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 50;
-pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 46;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 47;
-pub const _SC_THREADS : ::c_int = 31;
-pub const _SC_ATEXIT_MAX : ::c_int = 37;
+pub const _SC_REALTIME_SIGNALS : ::c_int = 51;
+pub const _SC_MEMORY_PROTECTION : ::c_int = 52;
+pub const _SC_SIGQUEUE_MAX : ::c_int = 53;
+pub const _SC_RTSIG_MAX : ::c_int = 54;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 55;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 56;
+pub const _SC_TIMER_MAX : ::c_int = 57;
+pub const _SC_TIMERS : ::c_int = 58;
+pub const _SC_CPUTIME : ::c_int = 59;
+pub const _SC_THREAD_CPUTIME : ::c_int = 60;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
@@ -659,12 +792,6 @@ pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
-pub const SA_ONSTACK: c_ulong = 0x20;
-pub const SA_SIGINFO: c_ulong = 0x40;
-pub const SA_NOCLDWAIT: c_ulong = 0x02;
-
-pub const SIG_SETMASK: ::c_int = 3;
-
pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const SOCK_STREAM: ::c_int = 1;
@@ -675,6 +802,7 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOL_SOCKET: ::c_int = -1;
pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
pub const SO_BROADCAST: ::c_int = 0x00000002;
+pub const SO_DEBUG: ::c_int = 0x00000004;
pub const SO_DONTROUTE: ::c_int = 0x00000008;
pub const SO_KEEPALIVE: ::c_int = 0x00000010;
pub const SO_OOBINLINE: ::c_int = 0x00000020;
@@ -694,6 +822,8 @@ pub const SO_NONBLOCK: ::c_int = 0x40000009;
pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
pub const SO_PEERCRED: ::c_int = 0x4000000b;
+pub const SCM_RIGHTS: ::c_int = 0x01;
+
pub const NI_MAXHOST: ::size_t = 1025;
pub const WNOHANG: ::c_int = 0x01;
@@ -720,34 +850,83 @@ pub const VSWTCH: usize = 7;
pub const VSTART: usize = 8;
pub const VSTOP: usize = 9;
pub const VSUSP: usize = 10;
-pub const OLCUC: ::tcflag_t = 0o000002;
-pub const OCRNL: ::tcflag_t = 0o000010;
-pub const ONOCR: ::tcflag_t = 0o000020;
-pub const ONLRET: ::tcflag_t = 0o000040;
-pub const OFILL: ::tcflag_t = 0o000100;
-pub const OFDEL: ::tcflag_t = 0o000200;
-pub const NLDLY: ::tcflag_t = 0o000400;
-pub const NL0: ::tcflag_t = 0o000000;
-pub const NL1: ::tcflag_t = 0o000400;
-pub const CRDLY: ::tcflag_t = 0o003000;
-pub const CR0: ::tcflag_t = 0o000000;
-pub const CR1: ::tcflag_t = 0o001000;
-pub const CR2: ::tcflag_t = 0o002000;
-pub const CR3: ::tcflag_t = 0o003000;
-pub const TABDLY: ::tcflag_t = 0o014000;
-pub const TAB0: ::tcflag_t = 0o000000;
-pub const TAB1: ::tcflag_t = 0o004000;
-pub const TAB2: ::tcflag_t = 0o010000;
-pub const TAB3: ::tcflag_t = 0o014000;
-pub const BSDLY: ::tcflag_t = 0o020000;
-pub const BS0: ::tcflag_t = 0o000000;
-pub const BS1: ::tcflag_t = 0o020000;
-pub const FFDLY: ::tcflag_t = 0o100000;
-pub const FF0: ::tcflag_t = 0o000000;
-pub const FF1: ::tcflag_t = 0o100000;
-pub const VTDLY: ::tcflag_t = 0o040000;
-pub const VT0: ::tcflag_t = 0o000000;
-pub const VT1: ::tcflag_t = 0o040000;
+
+pub const IGNBRK: ::tcflag_t = 0x01;
+pub const BRKINT: ::tcflag_t = 0x02;
+pub const IGNPAR: ::tcflag_t = 0x04;
+pub const PARMRK: ::tcflag_t = 0x08;
+pub const INPCK: ::tcflag_t = 0x10;
+pub const ISTRIP: ::tcflag_t = 0x20;
+pub const INLCR: ::tcflag_t = 0x40;
+pub const IGNCR: ::tcflag_t = 0x80;
+pub const ICRNL: ::tcflag_t = 0x100;
+pub const IUCLC: ::tcflag_t = 0x200;
+pub const IXON: ::tcflag_t = 0x400;
+pub const IXANY: ::tcflag_t = 0x800;
+pub const IXOFF: ::tcflag_t = 0x1000;
+
+pub const OPOST: ::tcflag_t = 0x00000001;
+pub const OLCUC: ::tcflag_t = 0x00000002;
+pub const ONLCR: ::tcflag_t = 0x00000004;
+pub const OCRNL: ::tcflag_t = 0x00000008;
+pub const ONOCR: ::tcflag_t = 0x00000010;
+pub const ONLRET: ::tcflag_t = 0x00000020;
+pub const OFILL: ::tcflag_t = 0x00000040;
+pub const OFDEL: ::tcflag_t = 0x00000080;
+pub const NLDLY: ::tcflag_t = 0x00000100;
+pub const NL0: ::tcflag_t = 0x00000000;
+pub const NL1: ::tcflag_t = 0x00000100;
+pub const CRDLY: ::tcflag_t = 0x00000600;
+pub const CR0: ::tcflag_t = 0x00000000;
+pub const CR1: ::tcflag_t = 0x00000200;
+pub const CR2: ::tcflag_t = 0x00000400;
+pub const CR3: ::tcflag_t = 0x00000600;
+pub const TABDLY: ::tcflag_t = 0x00001800;
+pub const TAB0: ::tcflag_t = 0x00000000;
+pub const TAB1: ::tcflag_t = 0x00000800;
+pub const TAB2: ::tcflag_t = 0x00001000;
+pub const TAB3: ::tcflag_t = 0x00001800;
+pub const BSDLY: ::tcflag_t = 0x00002000;
+pub const BS0: ::tcflag_t = 0x00000000;
+pub const BS1: ::tcflag_t = 0x00002000;
+pub const VTDLY: ::tcflag_t = 0x00004000;
+pub const VT0: ::tcflag_t = 0x00000000;
+pub const VT1: ::tcflag_t = 0x00004000;
+pub const FFDLY: ::tcflag_t = 0x00008000;
+pub const FF0: ::tcflag_t = 0x00000000;
+pub const FF1: ::tcflag_t = 0x00008000;
+
+pub const CSIZE: ::tcflag_t = 0x00000020;
+pub const CS5: ::tcflag_t = 0x00000000;
+pub const CS6: ::tcflag_t = 0x00000000;
+pub const CS7: ::tcflag_t = 0x00000000;
+pub const CS8: ::tcflag_t = 0x00000020;
+pub const CSTOPB: ::tcflag_t = 0x00000040;
+pub const CREAD: ::tcflag_t = 0x00000080;
+pub const PARENB: ::tcflag_t = 0x00000100;
+pub const PARODD: ::tcflag_t = 0x00000200;
+pub const HUPCL: ::tcflag_t = 0x00000400;
+pub const CLOCAL: ::tcflag_t = 0x00000800;
+pub const XLOBLK: ::tcflag_t = 0x00001000;
+pub const CTSFLOW: ::tcflag_t = 0x00002000;
+pub const RTSFLOW: ::tcflag_t = 0x00004000;
+pub const CRTSCTS: ::tcflag_t = RTSFLOW | CTSFLOW;
+
+pub const ISIG: ::tcflag_t = 0x00000001;
+pub const ICANON: ::tcflag_t = 0x00000002;
+pub const XCASE: ::tcflag_t = 0x00000004;
+pub const ECHO: ::tcflag_t = 0x00000008;
+pub const ECHOE: ::tcflag_t = 0x00000010;
+pub const ECHOK: ::tcflag_t = 0x00000020;
+pub const ECHONL: ::tcflag_t = 0x00000040;
+pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const TOSTOP: ::tcflag_t = 0x00000100;
+pub const IEXTEN: ::tcflag_t = 0x00000200;
+pub const ECHOCTL: ::tcflag_t = 0x00000400;
+pub const ECHOPRT: ::tcflag_t = 0x00000800;
+pub const ECHOKE: ::tcflag_t = 0x00001000;
+pub const FLUSHO: ::tcflag_t = 0x00002000;
+pub const PENDIN: ::tcflag_t = 0x00004000;
pub const TCGB_CTS: ::c_int = 0x01;
pub const TCGB_DSR: ::c_int = 0x02;
@@ -761,6 +940,40 @@ pub const TIOCM_DSR: ::c_int = TCGB_DSR;
pub const TIOCM_DTR: ::c_int = 0x10;
pub const TIOCM_RTS: ::c_int = 0x20;
+pub const B0: speed_t = 0x00;
+pub const B50: speed_t = 0x01;
+pub const B75: speed_t = 0x02;
+pub const B110: speed_t = 0x03;
+pub const B134: speed_t = 0x04;
+pub const B150: speed_t = 0x05;
+pub const B200: speed_t = 0x06;
+pub const B300: speed_t = 0x07;
+pub const B600: speed_t = 0x08;
+pub const B1200: speed_t = 0x09;
+pub const B1800: speed_t = 0x0A;
+pub const B2400: speed_t = 0x0B;
+pub const B4800: speed_t = 0x0C;
+pub const B9600: speed_t = 0x0D;
+pub const B19200: speed_t = 0x0E;
+pub const B38400: speed_t = 0x0F;
+pub const B57600: speed_t = 0x10;
+pub const B115200: speed_t = 0x11;
+pub const B230400: speed_t = 0x12;
+pub const B31250: speed_t = 0x13;
+
+pub const TCSANOW: ::c_int = 0x01;
+pub const TCSADRAIN: ::c_int = 0x02;
+pub const TCSAFLUSH: ::c_int = 0x04;
+
+pub const TCOOFF: ::c_int = 0x01;
+pub const TCOON: ::c_int = 0x02;
+pub const TCIOFF: ::c_int = 0x04;
+pub const TCION: ::c_int = 0x08;
+
+pub const TCIFLUSH: ::c_int = 0x01;
+pub const TCOFLUSH: ::c_int = 0x02;
+pub const TCIOFLUSH: ::c_int = 0x03;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@@ -789,18 +1002,40 @@ f! {
}
pub fn WIFEXITED(status: ::c_int) -> bool {
- (status >> 8) == 0
+ (status & !0xff) == 0
}
pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
(status & 0xff)
}
+ pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ ((status >> 8) & 0xff) != 0
+ }
+
pub fn WTERMSIG(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
+
+ pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ ((status >> 16) & 0xff) != 0
+ }
+
+ pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ (status >> 16) & 0xff
+ }
+
+ // actually WIFCORED, but this is used everywhere else
+ pub fn WCOREDUMP(status: ::c_int) -> bool {
+ (status & 0x10000) != 0
+ }
+
+ pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ (status & 0x20000) != 0
+ }
}
+#[link(name = "bsd")]
extern {
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
@@ -847,6 +1082,8 @@ extern {
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 shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
@@ -936,6 +1173,16 @@ extern {
link_name = "popen$UNIX2003")]
pub fn popen(command: *const c_char,
mode: *const c_char) -> *mut ::FILE;
+ pub fn openpty(amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::c_int;
+ pub fn forkpty(amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::pid_t;
+ pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index f60985c4b2..cc2de9136f 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -163,17 +163,8 @@ pub const S_ISUID: ::c_int = 0x800;
pub const S_ISGID: ::c_int = 0x400;
pub const S_ISVTX: ::c_int = 0x200;
-pub const POLLIN: ::c_short = 0x1;
-pub const POLLPRI: ::c_short = 0x2;
-pub const POLLOUT: ::c_short = 0x4;
-pub const POLLERR: ::c_short = 0x8;
-pub const POLLHUP: ::c_short = 0x10;
-pub const POLLNVAL: ::c_short = 0x20;
-
pub const IF_NAMESIZE: ::size_t = 16;
-pub const RTLD_LAZY: ::c_int = 0x1;
-
pub const LOG_EMERG: ::c_int = 0;
pub const LOG_ALERT: ::c_int = 1;
pub const LOG_CRIT: ::c_int = 2;
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index aec3bca367..d895541124 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -435,6 +435,15 @@ pub const O_NONBLOCK: ::c_int = 16384;
pub const O_ACCMODE: ::c_int = 3;
pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLPRI: ::c_short = 0x2;
+pub const POLLOUT: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLHUP: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
+
+pub const RTLD_LAZY: ::c_int = 0x1;
+
pub const STDIN_FILENO: ::c_int = 0;
pub const STDOUT_FILENO: ::c_int = 1;
pub const STDERR_FILENO: ::c_int = 2;
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index 859312e0ad..8dbe42b1ae 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -760,6 +760,7 @@ pub const SPLICE_F_MORE: ::c_uint = 0x04;
pub const SPLICE_F_GIFT: ::c_uint = 0x08;
pub const RTLD_LOCAL: ::c_int = 0;
+pub const RTLD_LAZY: ::c_int = 1;
pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
@@ -793,6 +794,12 @@ pub const P_PGID: idtype_t = 2;
pub const UTIME_OMIT: c_long = 1073741822;
pub const UTIME_NOW: c_long = 1073741823;
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLPRI: ::c_short = 0x2;
+pub const POLLOUT: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLHUP: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLRDBAND: ::c_short = 0x080;
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index e00722f433..a6c2d4bf97 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -769,6 +769,13 @@ 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;
+pub const POLLOUT: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLHUP: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
+
pub const POSIX_MADV_NORMAL: ::c_int = 0;
pub const POSIX_MADV_RANDOM: ::c_int = 1;
pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
@@ -1103,6 +1110,7 @@ pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void;
pub const RTLD_PROBE: *mut ::c_void = -4isize as *mut ::c_void;
+pub const RTLD_LAZY: ::c_int = 0x1;
pub const RTLD_NOW: ::c_int = 0x2;
pub const RTLD_NOLOAD: ::c_int = 0x4;
pub const RTLD_GLOBAL: ::c_int = 0x100;
diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs
index 28b4136350..87521b2a81 100644
--- a/src/unix/uclibc/mod.rs
+++ b/src/unix/uclibc/mod.rs
@@ -928,6 +928,7 @@ pub const SPLICE_F_MORE: ::c_uint = 0x04;
pub const SPLICE_F_GIFT: ::c_uint = 0x08;
pub const RTLD_LOCAL: ::c_int = 0;
+pub const RTLD_LAZY: ::c_int = 1;
pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
@@ -944,6 +945,13 @@ pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
pub const LOG_FTP: ::c_int = 11 << 3;
pub const LOG_PERROR: ::c_int = 0x20;
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLPRI: ::c_short = 0x2;
+pub const POLLOUT: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLHUP: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
+
pub const PIPE_BUF: usize = 4096;
pub const SI_LOAD_SHIFT: ::c_uint = 16;