Auto merge of #555 - alexcrichton:retry-appveyor, r=alexcrichton
Surround rustc download in appveyor-retry
diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh
index 0762dcb..d03b762 100644
--- a/ci/android-install-sdk.sh
+++ b/ci/android-install-sdk.sh
@@ -37,6 +37,10 @@
abi=x86
;;
+ x86_64)
+ abi=x86_64
+ ;;
+
*)
echo "invalid arch: $1"
exit 1
diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile
new file mode 100644
index 0000000..bf4793e
--- /dev/null
+++ b/ci/docker/x86_64-linux-android/Dockerfile
@@ -0,0 +1,32 @@
+FROM ubuntu:16.04
+
+RUN dpkg --add-architecture i386 && \
+ apt-get update && \
+ apt-get install -y --no-install-recommends \
+ file \
+ curl \
+ ca-certificates \
+ python \
+ unzip \
+ expect \
+ openjdk-9-jre \
+ libstdc++6:i386 \
+ libpulse0 \
+ gcc \
+ libc6-dev
+
+WORKDIR /android/
+COPY android* /android/
+
+ENV ANDROID_ARCH=x86_64
+ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools
+
+RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
+RUN sh /android/android-install-sdk.sh $ANDROID_ARCH
+RUN mv /root/.android /tmp
+RUN chmod 777 -R /tmp/.android
+RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
+
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
+ HOME=/tmp
diff --git a/ci/run-docker.sh b/ci/run-docker.sh
index 1ac419a..e963078 100644
--- a/ci/run-docker.sh
+++ b/ci/run-docker.sh
@@ -8,10 +8,14 @@
# use -f so we can use ci/ as build context
docker build -t libc -f ci/docker/$1/Dockerfile ci/
mkdir -p target
+ if [ -w /dev/kvm ]; then
+ kvm="--volume /dev/kvm:/dev/kvm"
+ fi
docker run \
--user `id -u`:`id -g` \
--rm \
--volume $HOME/.cargo:/cargo \
+ $kvm \
--env CARGO_HOME=/cargo \
--volume `rustc --print sysroot`:/rust:ro \
--volume `pwd`:/checkout:ro \
@@ -19,8 +23,6 @@
--env CARGO_TARGET_DIR=/checkout/target \
--workdir /checkout \
--privileged \
- --interactive \
- --tty \
libc \
ci/run.sh $1
}
diff --git a/ci/run.sh b/ci/run.sh
index 1b6e0fb..4b8825f 100755
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -105,13 +105,17 @@
esac
case "$TARGET" in
- arm-linux-androideabi | aarch64-linux-android | i686-linux-android)
+ arm-linux-androideabi | aarch64-linux-android | i686-linux-android | x86_64-linux-android)
# set SHELL so android can detect a 64bits system, see
# http://stackoverflow.com/a/41789144
# https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791
export SHELL=/bin/dash
arch=$(echo $TARGET | cut -d- -f1)
- emulator @$arch -no-window -no-accel &
+ accel="-no-accel"
+ if emulator -accel-check; then
+ accel=""
+ fi
+ emulator @$arch -no-window $accel &
adb wait-for-device
adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test
adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 4ebba50..28ac5a5 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -106,8 +106,8 @@
}
if android {
- if !aarch64 {
- // time64_t is not define for aarch64
+ if !aarch64 && !x86_64 {
+ // time64_t is not define for aarch64 and x86_64
// If included it will generate the error 'Your time_t is already 64-bit'
cfg.header("time64.h");
}
@@ -201,6 +201,9 @@
cfg.header("sched.h");
cfg.header("ufs/ufs/quota.h");
cfg.header("sys/jail.h");
+ cfg.header("sys/ipc.h");
+ cfg.header("sys/msg.h");
+ cfg.header("sys/shm.h");
}
if netbsd {
diff --git a/src/unix/bsd/apple/b64.rs b/src/unix/bsd/apple/b64.rs
index 327a4b6..3f83230 100644
--- a/src/unix/bsd/apple/b64.rs
+++ b/src/unix/bsd/apple/b64.rs
@@ -17,3 +17,5 @@
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
+
+pub const FIONREAD: ::c_ulong = 0x4004667f;
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 132b69d..6652bb8 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -665,6 +665,12 @@
pub const F_PEOFPOSMODE: ::c_int = 3;
pub const F_VOLPOSMODE: ::c_int = 4;
+pub const AT_FDCWD: ::c_int = -2;
+pub const AT_EACCESS: ::c_int = 0x0010;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
+pub const AT_REMOVEDIR: ::c_int = 0x0080;
+
pub const O_ACCMODE: ::c_int = 3;
pub const TIOCMODG: ::c_ulong = 0x40047403;
@@ -1659,33 +1665,6 @@
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
- pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::c_int;
-
pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index aecf228..fb113de 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -11,6 +11,10 @@
pub type fsfilcnt_t = ::uint64_t;
pub type idtype_t = ::c_uint;
+pub type key_t = ::c_long;
+pub type msglen_t = ::c_ulong;
+pub type msgqnum_t = ::c_ulong;
+
s! {
pub struct utmpx {
pub ut_type: ::c_short,
@@ -88,6 +92,41 @@
pub struct _sem {
data: [u32; 4],
}
+
+ pub struct ipc_perm {
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub mode: ::mode_t,
+ pub seq: ::c_ushort,
+ pub key: ::key_t,
+ }
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ pub msg_cbytes: ::msglen_t,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::c_int,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ }
}
pub const SIGEV_THREAD_ID: ::c_int = 4;
@@ -368,6 +407,8 @@
#[doc(hidden)]
pub const AF_MAX: ::c_int = 42;
+pub const IPPROTO_DIVERT: ::c_int = 258;
+
pub const PF_SLOW: ::c_int = AF_SLOW;
pub const PF_SCLUSTER: ::c_int = AF_SCLUSTER;
pub const PF_ARP: ::c_int = AF_ARP;
@@ -384,6 +425,28 @@
pub const NET_RT_IFMALIST: ::c_int = 4;
pub const NET_RT_IFLISTL: ::c_int = 5;
+// System V IPC
+pub const IPC_PRIVATE: ::key_t = 0;
+pub const IPC_CREAT: ::c_int = 0o1000;
+pub const IPC_EXCL: ::c_int = 0o2000;
+pub const IPC_NOWAIT: ::c_int = 0o4000;
+pub const IPC_RMID: ::c_int = 0;
+pub const IPC_SET: ::c_int = 1;
+pub const IPC_STAT: ::c_int = 2;
+pub const IPC_INFO: ::c_int = 3;
+pub const IPC_R : ::c_int = 0o400;
+pub const IPC_W : ::c_int = 0o200;
+pub const IPC_M : ::c_int = 0o10000;
+pub const MSG_NOERROR: ::c_int = 0o10000;
+pub const SHM_RDONLY: ::c_int = 0o10000;
+pub const SHM_RND: ::c_int = 0o20000;
+pub const SHM_R: ::c_int = 0o400;
+pub const SHM_W: ::c_int = 0o200;
+pub const SHM_LOCK: ::c_int = 11;
+pub const SHM_UNLOCK: ::c_int = 12;
+pub const SHM_STAT: ::c_int = 13;
+pub const SHM_INFO: ::c_int = 14;
+
// The *_MAXID constants never should've been used outside of the
// FreeBSD base system. And with the exception of CTL_P1003_1B_MAXID,
// they were all removed in svn r262489. They remain here for backwards
@@ -442,6 +505,9 @@
pub const P_PGID: idtype_t = 2;
pub const P_ALL: idtype_t = 7;
+pub const B460800: ::speed_t = 460800;
+pub const B921600: ::speed_t = 921600;
+
extern {
pub fn __error() -> *mut ::c_int;
@@ -478,6 +544,21 @@
pub fn freelocale(loc: ::locale_t) -> ::c_int;
pub fn waitid(idtype: idtype_t, id: ::id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
+
+ pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
+ pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
+ pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void,
+ shmflg: ::c_int) -> *mut ::c_void;
+ pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
+ pub fn shmctl(shmid: ::c_int, cmd: ::c_int,
+ buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn msgctl(msqid: ::c_int, cmd: ::c_int,
+ buf: *mut ::msqid_ds) -> ::c_int;
+ pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
+ pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
+ msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
+ pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
+ msgflg: ::c_int) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 197ae56..5cfa3b1 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -452,6 +452,11 @@
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
+pub const AT_EACCESS: ::c_int = 0x100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_REMOVEDIR: ::c_int = 0x800;
+
pub const SIGTRAP: ::c_int = 5;
pub const GLOB_APPEND : ::c_int = 0x0001;
@@ -864,13 +869,13 @@
pub const B76800: speed_t = 76800;
pub const B115200: speed_t = 115200;
pub const B230400: speed_t = 230400;
-pub const B460800: speed_t = 460800;
-pub const B921600: speed_t = 921600;
pub const EXTA: speed_t = 19200;
pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
+pub const CRTSCTS: ::tcflag_t = 0x00030000;
+
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
@@ -1001,35 +1006,12 @@
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 openat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
- pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
+
+ 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 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,
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index d4f0ded..1471e6f 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -597,39 +597,16 @@
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
- pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
- pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
- pub fn sem_timedwait(sem: *mut sem_t,
- abstime: *const ::timespec) -> ::c_int;
- pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
- clock_id: clockid_t) -> ::c_int;
+ pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
+
+ 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 sem_timedwait(sem: *mut sem_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
+ clock_id: clockid_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
abstime: *const ::timespec) -> ::c_int;
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index a329cdf..ffe8d75 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -246,6 +246,12 @@
}
}
+pub const AT_FDCWD: ::c_int = -100;
+pub const AT_EACCESS: ::c_int = 0x100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_REMOVEDIR: ::c_int = 0x800;
+
pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
@@ -635,6 +641,9 @@
pub const P_PID: idtype_t = 1;
pub const P_PGID: idtype_t = 4;
+pub const B460800: ::speed_t = 460800;
+pub const B921600: ::speed_t = 921600;
+
extern {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index 0e53ccd..b0d8128 100644
--- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -157,6 +157,12 @@
pub const F_DUPFD_CLOEXEC : ::c_int = 10;
+pub const AT_FDCWD: ::c_int = -100;
+pub const AT_EACCESS: ::c_int = 0x01;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x02;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x04;
+pub const AT_REMOVEDIR: ::c_int = 0x08;
+
pub const RLIM_NLIMITS: ::c_int = 9;
pub const SO_SNDTIMEO: ::c_int = 0x1005;
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index c4b4467..829c225 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -761,6 +761,7 @@
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
+ pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
pub fn glob(pattern: *const ::c_char,
flags: ::c_int,
errfunc: Option<extern fn(epath: *const ::c_char,
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 9b39050..74ed97d 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -242,6 +242,7 @@
#[link(name = "c")]
#[link(name = "m")]
#[link(name = "rt")]
+ #[link(name = "pthread")]
extern {}
}
}
@@ -363,6 +364,36 @@
link_name = "rewinddir$INODE64$UNIX2003")]
pub fn rewinddir(dirp: *mut ::DIR);
+ pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
+ flags: ::c_int, ...) -> ::c_int;
+ pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::mode_t, flags: ::c_int) -> ::c_int;
+ pub fn fchown(fd: ::c_int,
+ owner: ::uid_t,
+ group: ::gid_t) -> ::c_int;
+ pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
+ owner: ::uid_t, group: ::gid_t,
+ flags: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
+ pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
+ buf: *mut stat, flags: ::c_int) -> ::c_int;
+ pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
+ newdirfd: ::c_int, newpath: *const ::c_char,
+ flags: ::c_int) -> ::c_int;
+ pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::mode_t) -> ::c_int;
+ pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
+ buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
+ pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
+ newdirfd: ::c_int, newpath: *const ::c_char)
+ -> ::c_int;
+ pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
+ linkpath: *const ::c_char) -> ::c_int;
+ pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
+ flags: ::c_int) -> ::c_int;
+
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
pub fn alarm(seconds: ::c_uint) -> ::c_uint;
pub fn chdir(dir: *const c_char) -> ::c_int;
@@ -545,6 +576,9 @@
link_name = "pthread_join$UNIX2003")]
pub fn pthread_join(native: ::pthread_t,
value: *mut *mut ::c_void) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void);
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
diff --git a/src/unix/notbsd/android/b32/mod.rs b/src/unix/notbsd/android/b32/mod.rs
index 9efcd61..32f88e4 100644
--- a/src/unix/notbsd/android/b32/mod.rs
+++ b/src/unix/notbsd/android/b32/mod.rs
@@ -1,3 +1,6 @@
+// The following definitions are correct for arm and i686,
+// but may be wrong for mips
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type mode_t = u16;
diff --git a/src/unix/notbsd/android/b64/aarch64.rs b/src/unix/notbsd/android/b64/aarch64.rs
new file mode 100644
index 0000000..89c505d
--- /dev/null
+++ b/src/unix/notbsd/android/b64/aarch64.rs
@@ -0,0 +1,56 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_mode: ::c_uint,
+ pub st_nlink: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ __pad1: ::c_ulong,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_int,
+ __pad2: ::c_int,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused4: ::c_uint,
+ __unused5: ::c_uint,
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_mode: ::c_uint,
+ pub st_nlink: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ __pad1: ::c_ulong,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_int,
+ __pad2: ::c_int,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused4: ::c_uint,
+ __unused5: ::c_uint,
+ }
+}
+
+pub const O_DIRECT: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x4000;
+pub const O_NOFOLLOW: ::c_int = 0x8000;
+
+pub const SYS_gettid: ::c_long = 178;
diff --git a/src/unix/notbsd/android/b64/mod.rs b/src/unix/notbsd/android/b64/mod.rs
index 31a05d6..57982a2 100644
--- a/src/unix/notbsd/android/b64/mod.rs
+++ b/src/unix/notbsd/android/b64/mod.rs
@@ -1,12 +1,11 @@
-// The following definitions are correct for aarch64 and may be wrong for x86_64
+// The following definitions are correct for aarch64 and x86_64,
+// but may be wrong for mips64
-pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type mode_t = u32;
pub type off64_t = i64;
pub type socklen_t = u32;
-pub type wchar_t = u32;
s! {
pub struct sigset_t {
@@ -25,52 +24,6 @@
pub rlim_max: ::c_ulonglong,
}
- pub struct stat {
- pub st_dev: ::dev_t,
- pub st_ino: ::ino_t,
- pub st_mode: ::c_uint,
- pub st_nlink: ::c_uint,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub st_rdev: ::dev_t,
- __pad1: ::c_ulong,
- pub st_size: ::off64_t,
- pub st_blksize: ::c_int,
- __pad2: ::c_int,
- pub st_blocks: ::c_long,
- pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
- pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
- pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- __unused4: ::c_uint,
- __unused5: ::c_uint,
- }
-
- pub struct stat64 {
- pub st_dev: ::dev_t,
- pub st_ino: ::ino_t,
- pub st_mode: ::c_uint,
- pub st_nlink: ::c_uint,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub st_rdev: ::dev_t,
- __pad1: ::c_ulong,
- pub st_size: ::off64_t,
- pub st_blksize: ::c_int,
- __pad2: ::c_int,
- pub st_blocks: ::c_long,
- pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
- pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
- pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- __unused4: ::c_uint,
- __unused5: ::c_uint,
- }
-
pub struct pthread_attr_t {
pub flags: ::uint32_t,
pub stack_base: *mut ::c_void,
@@ -143,15 +96,10 @@
}
}
-pub const O_DIRECT: ::c_int = 0x10000;
-pub const O_DIRECTORY: ::c_int = 0x4000;
-pub const O_NOFOLLOW: ::c_int = 0x8000;
-
pub const RTLD_GLOBAL: ::c_int = 0x00100;
pub const RTLD_NOW: ::c_int = 2;
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
-pub const SYS_gettid: ::c_long = 178;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
__reserved: [0; 36],
@@ -200,3 +148,15 @@
// the return type should be ::ssize_t, but it is c_int!
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::c_int;
}
+
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/src/unix/notbsd/android/b64/x86_64.rs b/src/unix/notbsd/android/b64/x86_64.rs
new file mode 100644
index 0000000..58d07e1
--- /dev/null
+++ b/src/unix/notbsd/android/b64/x86_64.rs
@@ -0,0 +1,50 @@
+pub type c_char = i8;
+pub type wchar_t = i32;
+
+s! {
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::c_ulong,
+ pub st_mode: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_long,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::c_ulong,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::c_ulong,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::c_ulong,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused: [::c_long; 3],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::c_ulong,
+ pub st_mode: ::c_uint,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::c_long,
+ pub st_blocks: ::c_long,
+ pub st_atime: ::c_ulong,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::c_ulong,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::c_ulong,
+ pub st_ctime_nsec: ::c_ulong,
+ __unused: [::c_long; 3],
+ }
+}
+
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+
+pub const SYS_gettid: ::c_long = 186;
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index cd20cb1..032272b 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -464,7 +464,6 @@
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 0x1;
pub const TCSAFLUSH: ::c_int = 0x2;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs
index db580c9..1361b25 100644
--- a/src/unix/notbsd/linux/mips/mod.rs
+++ b/src/unix/notbsd/linux/mips/mod.rs
@@ -322,7 +322,7 @@
pub const IEXTEN: ::tcflag_t = 0x00000100;
pub const TOSTOP: ::tcflag_t = 0x00008000;
pub const FLUSHO: ::tcflag_t = 0x00002000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const EXTPROC: ::tcflag_t = 0o200000;
pub const TCSANOW: ::c_int = 0x540e;
pub const TCSADRAIN: ::c_int = 0x540f;
pub const TCSAFLUSH: ::c_int = 0x5410;
diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs
index 2bf13f9..26cc4b9 100644
--- a/src/unix/notbsd/linux/musl/mod.rs
+++ b/src/unix/notbsd/linux/musl/mod.rs
@@ -124,6 +124,9 @@
pub const BUFSIZ: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 10000;
pub const FOPEN_MAX: ::c_uint = 1000;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_EXEC: ::c_int = 0o10000000;
+pub const O_SEARCH: ::c_int = 0o10000000;
pub const O_ACCMODE: ::c_int = 0o10000003;
pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const NI_MAXHOST: ::socklen_t = 255;
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index ad5cc69..13a5c68 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -314,7 +314,6 @@
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
pub const VEOF: usize = 4;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CPU_SETSIZE: ::c_int = 0x400;
diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs
index b646647..89b292d 100644
--- a/src/unix/notbsd/linux/s390x.rs
+++ b/src/unix/notbsd/linux/s390x.rs
@@ -576,7 +576,6 @@
pub const IEXTEN: ::tcflag_t = 0x00008000;
pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CPU_SETSIZE: ::c_int = 0x400;
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index da6b928..b20d043 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -675,6 +675,7 @@
pub const ICRNL: ::tcflag_t = 0x00000100;
pub const IXANY: ::tcflag_t = 0x00000800;
pub const IMAXBEL: ::tcflag_t = 0x00002000;
+pub const IUTF8: ::tcflag_t = 0x00004000;
pub const OPOST: ::tcflag_t = 0x1;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CRTSCTS: ::tcflag_t = 0x80000000;
@@ -728,6 +729,10 @@
pub const AT_FDCWD: ::c_int = -100;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
+pub const AT_REMOVEDIR: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
+pub const AT_EMPTY_PATH: ::c_int = 0x1000;
pub const LOG_CRON: ::c_int = 9 << 3;
pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
@@ -746,6 +751,9 @@
pub const P_PID: idtype_t = 1;
pub const P_PGID: idtype_t = 2;
+pub const UTIME_OMIT: c_long = 1073741822;
+pub const UTIME_NOW: c_long = 1073741823;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@@ -917,44 +925,26 @@
offset: off64_t)
-> *mut ::c_void;
pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
+ pub fn openat64(fd: ::c_int,
+ path: *const c_char,
+ oflag: ::c_int, ...) -> ::c_int;
pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
offset: off64_t) -> ::ssize_t;
pub fn pwrite64(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
offset: off64_t) -> ::ssize_t;
+ pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
pub fn readdir64_r(dirp: *mut ::DIR, entry: *mut ::dirent64,
result: *mut *mut ::dirent64) -> ::c_int;
pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
+ pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int;
- pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
+
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::c_int;
pub fn ppoll(fds: *mut ::pollfd,
nfds: nfds_t,
timeout: *const ::timespec,
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index 55ac0a2..757d581 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -3,36 +3,36 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
-pub type clockid_t = ::c_int;
-pub type blkcnt_t = i64;
-pub type clock_t = i64;
-pub type daddr_t = i64;
-pub type dev_t = u64;
-pub type fsblkcnt_t = u64;
-pub type fsfilcnt_t = u64;
-pub type ino_t = i64;
-pub type key_t = i32;
-pub type major_t = u32;
-pub type minor_t = u32;
-pub type mode_t = u32;
-pub type nlink_t = u32;
-pub type rlim_t = u64;
-pub type speed_t = u32;
-pub type tcflag_t = u32;
-pub type time_t = i64;
-pub type wchar_t = i32;
+pub type clockid_t = ::c_int;
+pub type blkcnt_t = ::c_long;
+pub type clock_t = ::c_long;
+pub type daddr_t = ::c_long;
+pub type dev_t = ::c_ulong;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type ino_t = ::c_ulong;
+pub type key_t = ::c_int;
+pub type major_t = ::c_uint;
+pub type minor_t = ::c_uint;
+pub type mode_t = ::c_uint;
+pub type nlink_t = ::c_uint;
+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 wchar_t = ::c_int;
pub type nfds_t = ::c_ulong;
pub type suseconds_t = ::c_long;
-pub type off_t = i64;
+pub type off_t = ::c_long;
pub type useconds_t = ::c_uint;
-pub type socklen_t = u32;
-pub type sa_family_t = u8;
+pub type socklen_t = ::c_uint;
+pub type sa_family_t = u16;
pub type pthread_t = ::c_uint;
pub type pthread_key_t = ::c_uint;
-pub type blksize_t = u32;
-pub type fflags_t = u32;
+pub type blksize_t = ::c_int;
+pub type fflags_t = ::c_int;
pub type nl_item = ::c_int;
pub type id_t = ::c_int;
pub type idtype_t = ::c_uint;
@@ -340,6 +340,14 @@
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
+
+ pub struct port_event {
+ pub portev_events: ::c_int,
+ pub portev_source: ::c_ushort,
+ pub portev_pad: ::c_ushort,
+ pub portev_object: ::uintptr_t,
+ pub portev_user: ::uintptr_t,
+ }
}
pub const LC_CTYPE: ::c_int = 0;
@@ -441,7 +449,13 @@
pub const SS_ONSTACK: ::c_int = 1;
pub const SS_DISABLE: ::c_int = 2;
+pub const FIOCLEX: ::c_int = 0x20006601;
+pub const FIONCLEX: ::c_int = 0x20006602;
+pub const FIONREAD: ::c_int = 0x4004667f;
pub const FIONBIO: ::c_int = 0x8004667e;
+pub const FIOASYNC: ::c_int = 0x8004667d;
+pub const FIOSETOWN: ::c_int = 0x8004667c;
+pub const FIOGETOWN: ::c_int = 0x4004667b;
pub const SIGCHLD: ::c_int = 18;
pub const SIGBUS: ::c_int = 10;
@@ -485,6 +499,8 @@
pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
+pub const O_SEARCH: ::c_int = 0x200000;
+pub const O_EXEC: ::c_int = 0x400000;
pub const O_APPEND: ::c_int = 8;
pub const O_CREAT: ::c_int = 256;
pub const O_EXCL: ::c_int = 1024;
@@ -609,7 +625,7 @@
pub const ENOEXEC: ::c_int = 8;
pub const EBADF: ::c_int = 9;
pub const ECHILD: ::c_int = 10;
-pub const EDEADLK: ::c_int = 45;
+pub const EAGAIN: ::c_int = 11;
pub const ENOMEM: ::c_int = 12;
pub const EACCES: ::c_int = 13;
pub const EFAULT: ::c_int = 14;
@@ -633,11 +649,65 @@
pub const EPIPE: ::c_int = 32;
pub const EDOM: ::c_int = 33;
pub const ERANGE: ::c_int = 34;
+pub const ENOMSG: ::c_int = 35;
+pub const EIDRM: ::c_int = 36;
+pub const ECHRNG: ::c_int = 37;
+pub const EL2NSYNC: ::c_int = 38;
+pub const EL3HLT: ::c_int = 39;
+pub const EL3RST: ::c_int = 40;
+pub const ELNRNG: ::c_int = 41;
+pub const EUNATCH: ::c_int = 42;
+pub const ENOCSI: ::c_int = 43;
+pub const EL2HLT: ::c_int = 44;
+pub const EDEADLK: ::c_int = 45;
+pub const ENOLCK: ::c_int = 46;
+pub const ECANCELED: ::c_int = 47;
pub const ENOTSUP: ::c_int = 48;
-pub const EAGAIN: ::c_int = 11;
-pub const EWOULDBLOCK: ::c_int = 11;
-pub const EINPROGRESS: ::c_int = 150;
-pub const EALREADY: ::c_int = 149;
+pub const EDQUOT: ::c_int = 49;
+pub const EBADE: ::c_int = 50;
+pub const EBADR: ::c_int = 51;
+pub const EXFULL: ::c_int = 52;
+pub const ENOANO: ::c_int = 53;
+pub const EBADRQC: ::c_int = 54;
+pub const EBADSLT: ::c_int = 55;
+pub const EDEADLOCK: ::c_int = 56;
+pub const EBFONT: ::c_int = 57;
+pub const EOWNERDEAD: ::c_int = 58;
+pub const ENOTRECOVERABLE: ::c_int = 59;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENONET: ::c_int = 64;
+pub const ENOPKG: ::c_int = 65;
+pub const EREMOTE: ::c_int = 66;
+pub const ENOLINK: ::c_int = 67;
+pub const EADV: ::c_int = 68;
+pub const ESRMNT: ::c_int = 69;
+pub const ECOMM: ::c_int = 70;
+pub const EPROTO: ::c_int = 71;
+pub const ELOCKUNMAPPED: ::c_int = 72;
+pub const ENOTACTIVE: ::c_int = 73;
+pub const EMULTIHOP: ::c_int = 74;
+pub const EADI: ::c_int = 75;
+pub const EBADMSG: ::c_int = 77;
+pub const ENAMETOOLONG: ::c_int = 78;
+pub const EOVERFLOW: ::c_int = 79;
+pub const ENOTUNIQ: ::c_int = 80;
+pub const EBADFD: ::c_int = 81;
+pub const EREMCHG: ::c_int = 82;
+pub const ELIBACC: ::c_int = 83;
+pub const ELIBBAD: ::c_int = 84;
+pub const ELIBSCN: ::c_int = 85;
+pub const ELIBMAX: ::c_int = 86;
+pub const ELIBEXEC: ::c_int = 87;
+pub const EILSEQ: ::c_int = 88;
+pub const ENOSYS: ::c_int = 89;
+pub const ELOOP: ::c_int = 90;
+pub const ERESTART: ::c_int = 91;
+pub const ESTRPIPE: ::c_int = 92;
+pub const ENOTEMPTY: ::c_int = 93;
+pub const EUSERS: ::c_int = 94;
pub const ENOTSOCK: ::c_int = 95;
pub const EDESTADDRREQ: ::c_int = 96;
pub const EMSGSIZE: ::c_int = 97;
@@ -662,26 +732,11 @@
pub const ETOOMANYREFS: ::c_int = 144;
pub const ETIMEDOUT: ::c_int = 145;
pub const ECONNREFUSED: ::c_int = 146;
-pub const ELOOP: ::c_int = 90;
-pub const ENAMETOOLONG: ::c_int = 78;
pub const EHOSTDOWN: ::c_int = 147;
pub const EHOSTUNREACH: ::c_int = 148;
-pub const ENOTEMPTY: ::c_int = 93;
-pub const EUSERS: ::c_int = 94;
-pub const EDQUOT: ::c_int = 49;
-pub const ESTALE: ::c_int = 151;
-pub const EREMOTE: ::c_int = 66;
-pub const ENOLCK: ::c_int = 46;
-pub const ENOSYS: ::c_int = 89;
-pub const EIDRM: ::c_int = 36;
-pub const ENOMSG: ::c_int = 35;
-pub const EOVERFLOW: ::c_int = 79;
-pub const ECANCELED: ::c_int = 47;
-pub const EILSEQ: ::c_int = 88;
-pub const EBADMSG: ::c_int = 77;
-pub const EMULTIHOP: ::c_int = 74;
-pub const ENOLINK: ::c_int = 67;
-pub const EPROTO: ::c_int = 71;
+pub const EWOULDBLOCK: ::c_int = EAGAIN;
+pub const EALREADY: ::c_int = 149;
+pub const EINPROGRESS: ::c_int = 150;
pub const EAI_SYSTEM: ::c_int = 11;
@@ -957,6 +1012,16 @@
pub const RTLD_FIRST: ::c_int = 0x2000;
pub const RTLD_CONFGEN: ::c_int = 0x10000;
+pub const PORT_SOURCE_AIO: ::c_int = 1;
+pub const PORT_SOURCE_TIMER: ::c_int = 2;
+pub const PORT_SOURCE_USER: ::c_int = 3;
+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;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -1052,33 +1117,10 @@
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 openat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
+
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::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: ::size_t) -> ::c_int;
@@ -1138,4 +1180,15 @@
flags: ::c_int) -> ::ssize_t;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+
+ pub fn port_create() -> ::c_int;
+ pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t,
+ events: ::c_int, user: ::uintptr_t) -> ::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: *const ::timespec) -> ::c_int;
+ pub fn port_getn(port: ::c_int, pe_list: *mut port_event, max: ::c_uint,
+ nget: *mut ::c_uint, timeout: *const ::timespec)
+ -> ::c_int;
}