Merge pull request #93 from alexcrichton/nix-additions

Add a load of constants/definitions from nix
This commit is contained in:
Alex Crichton 2015-12-16 09:03:14 -08:00
commit 0ac0bc0cce
21 changed files with 1536 additions and 36 deletions

View File

@ -20,34 +20,38 @@ DATE=$(echo $TRAVIS_RUST_VERSION | sed s/nightly-//)
EXTRA_TARGETS=https://people.mozilla.org/~acrichton/libc-test/$DATE
install() {
sudo apt-get update
sudo apt-get install -y $@
if [ "$TRAVIS" = "true" ]; then
sudo apt-get update
sudo apt-get install -y $@
fi
}
mkdir -p .cargo
cp ci/cargo-config .cargo/config
case "$TARGET" in
*-apple-ios | *-rumprun-*)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \
tar xzf - -C `rustc --print sysroot`/lib/rustlib
;;
if [ "$TRAVIS" = "true" ]; then
case "$TARGET" in
*-apple-ios | *-rumprun-*)
curl -s $EXTRA_TARGETS/$TARGET.tar.gz | \
tar xzf - -C `rustc --print sysroot`/lib/rustlib
;;
*)
# Download the rustlib folder from the relevant portion of main distribution's
# tarballs.
dir=rust-std-$TARGET
pkg=rust-std
if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
pkg=rust
dir=rustc
fi
curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \
tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
$pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET
;;
*)
# Download the rustlib folder from the relevant portion of main distribution's
# tarballs.
dir=rust-std-$TARGET
pkg=rust-std
if [ "$TRAVIS_RUST_VERSION" = "1.0.0" ]; then
pkg=rust
dir=rustc
fi
curl -s $MAIN_TARGETS/$pkg-$TRAVIS_RUST_VERSION-$TARGET.tar.gz | \
tar xzf - -C $HOME/rust/lib/rustlib --strip-components=4 \
$pkg-$TRAVIS_RUST_VERSION-$TARGET/$dir/lib/rustlib/$TARGET
;;
esac
esac
fi
# Pull a pre-built docker image for testing android, then run tests entirely
# within that image. Note that this is using the same rustc installation that

View File

@ -6,6 +6,7 @@ use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
let x86_64 = target.contains("x86_64");
let windows = target.contains("windows");
let mingw = target.contains("windows-gnu");
let linux = target.contains("unknown-linux");
@ -20,7 +21,7 @@ fn main() {
let mut cfg = ctest::TestGenerator::new();
// Pull in extra goodies on linux/mingw
if target.contains("unknown-linux") {
if linux || android {
cfg.define("_GNU_SOURCE", None);
} else if windows {
cfg.define("_WIN32_WINNT", Some("0x8000"));
@ -81,6 +82,12 @@ fn main() {
cfg.header("utime.h");
cfg.header("pwd.h");
cfg.header("grp.h");
cfg.header("sys/utsname.h");
cfg.header("sys/ptrace.h");
cfg.header("sys/mount.h");
cfg.header("sys/uio.h");
cfg.header("sched.h");
cfg.header("termios.h");
}
if android {
@ -89,6 +96,7 @@ fn main() {
} else if !windows {
cfg.header("glob.h");
cfg.header("ifaddrs.h");
cfg.header("sys/quota.h");
cfg.header("sys/statvfs.h");
if !musl {
@ -109,22 +117,36 @@ fn main() {
}
}
if bsdlike {
cfg.header("sys/event.h");
}
if linux {
cfg.header("mqueue.h");
cfg.header("sys/signalfd.h");
cfg.header("sys/xattr.h");
cfg.header("sys/ipc.h");
cfg.header("sys/shm.h");
}
if linux || android {
cfg.header("netpacket/packet.h");
cfg.header("net/ethernet.h");
cfg.header("malloc.h");
cfg.header("net/ethernet.h");
cfg.header("netpacket/packet.h");
cfg.header("sched.h");
cfg.header("sys/epoll.h");
cfg.header("sys/eventfd.h");
cfg.header("sys/prctl.h");
/* linux kernel header */
cfg.header("sys/vfs.h");
if !musl {
cfg.header("linux/netlink.h");
cfg.header("linux/magic.h");
cfg.header("linux/fs.h");
if !mips {
cfg.header("linux/quota.h");
}
}
cfg.header("sched.h");
}
if freebsd {
@ -132,6 +154,12 @@ fn main() {
cfg.header("sched.h");
}
if netbsd {
cfg.header("ufs/ufs/quota.h");
cfg.header("ufs/ufs/quota1.h");
cfg.header("sys/ioctl_compat.h");
}
cfg.type_name(move |ty, is_struct| {
match ty {
// Just pass all these through, no need for a "struct" prefix
@ -182,6 +210,7 @@ fn main() {
s.replace("e_nsec", ".tv_nsec")
}
}
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
s => s.to_string(),
}
});
@ -198,6 +227,10 @@ fn main() {
cfg.skip_struct(move |ty| {
match ty {
"sockaddr_nl" => musl,
// The alignment of this is 4 on 64-bit OSX...
"kevent" if apple && x86_64 => true,
_ => false
}
});
@ -239,6 +272,19 @@ fn main() {
// work around super old mips toolchain
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
// weird signed extension or something like that?
"MS_NOUSER" => true,
// These OSX constants are flagged as deprecated
"NOTE_EXIT_REPARENTED" |
"NOTE_REAP" if apple => true,
// The linux/quota.h header file which defines these can't be
// included with sys/quota.h currently on MIPS, so we don't include
// it and just ignore these constants
"QFMT_VFS_OLD" |
"QFMT_VFS_V0" if mips && linux => true,
_ => false,
}
});
@ -265,6 +311,10 @@ fn main() {
// Rust, but is close enough to *mut
"timegm" if apple => true,
// OSX's daemon is deprecated in 10.5 so we'll get a warning (which
// we turn into an error) so just ignore it.
"daemon" if apple => true,
// These functions presumably exist on netbsd but don't look like
// they're implemented on rumprun yet, just let them slide for now.
// Some of them look like they have headers but then don't have
@ -275,6 +325,8 @@ fn main() {
"pthread_stackseg_np" |
"shm_open" |
"shm_unlink" |
"syscall" |
"ptrace" |
"sigaltstack" if rumprun => true,
_ => false,

View File

@ -26,6 +26,10 @@ mod imp {
#[lang = "copy"]
pub trait Copy {}
#[lang = "sync"]
pub trait Sync {}
impl<T> Sync for T {}
#[lang = "sized"]
pub trait Sized {}

View File

@ -16,6 +16,8 @@ pub type pthread_key_t = c_ulong;
pub type sigset_t = u32;
pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type speed_t = ::c_ulong;
pub type tcflag_t = ::c_ulong;
pub enum timezone {}
@ -178,6 +180,68 @@ s! {
pub sin_addr: ::in_addr,
pub sin_zero: [::c_char; 8],
}
pub struct statfs {
pub f_bsize: ::uint32_t,
pub f_iosize: ::int32_t,
pub f_blocks: ::uint64_t,
pub f_bfree: ::uint64_t,
pub f_bavail: ::uint64_t,
pub f_files: ::uint64_t,
pub f_ffree: ::uint64_t,
pub f_fsid: ::fsid_t,
pub f_owner: ::uid_t,
pub f_type: ::uint32_t,
pub f_flags: ::uint32_t,
pub f_fssubtype: ::uint32_t,
pub f_fstypename: [::c_char; 16],
pub f_mntonname: [::c_char; 1024],
pub f_mntfromname: [::c_char; 1024],
pub f_reserved: [::uint32_t; 8],
}
// FIXME: this should have align 4 but it's got align 8 on 64-bit
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::int16_t,
pub flags: ::uint16_t,
pub fflags: ::uint32_t,
pub data: ::intptr_t,
pub udata: *mut ::c_void,
}
pub struct kevent64_s {
pub ident: ::uint64_t,
pub filter: ::int16_t,
pub flags: ::uint16_t,
pub fflags: ::uint32_t,
pub data: ::int64_t,
pub udata: ::uint64_t,
pub ext: [::uint64_t; 2],
}
pub struct dqblk {
pub dqb_bhardlimit: ::uint64_t,
pub dqb_bsoftlimit: ::uint64_t,
pub dqb_curbytes: ::uint64_t,
pub dqb_ihardlimit: ::uint32_t,
pub dqb_isoftlimit: ::uint32_t,
pub dqb_curinodes: ::uint32_t,
pub dqb_btime: ::uint32_t,
pub dqb_itime: ::uint32_t,
pub dqb_id: ::uint32_t,
pub dqb_spare: [::uint32_t; 4],
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
}
pub const EXIT_FAILURE: ::c_int = 1;
@ -206,6 +270,7 @@ pub const O_EXCL: ::c_int = 2048;
pub const O_NOCTTY: ::c_int = 131072;
pub const O_TRUNC: ::c_int = 1024;
pub const O_CLOEXEC: ::c_int = 0x1000000;
pub const O_DIRECTORY: ::c_int = 0x100000;
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@ -697,6 +762,53 @@ pub const ST_NOSUID: ::c_ulong = 2;
pub const HW_AVAILCPU: ::c_int = 25;
pub const EVFILT_AIO: ::int16_t = 0xfffd;
pub const EVFILT_PROC: ::int16_t = 0xfffb;
pub const EVFILT_READ: ::int16_t = 0xffff;
pub const EVFILT_SIGNAL: ::int16_t = 0xfffa;
pub const EVFILT_SYSCOUNT: ::int16_t = 0xe;
pub const EVFILT_TIMER: ::int16_t = 0xfff9;
pub const EVFILT_VNODE: ::int16_t = 0xfffc;
pub const EVFILT_WRITE: ::int16_t = 0xfffe;
pub const EVFILT_FS: ::int16_t = 0xfff7;
pub const EVFILT_MACHPORT: ::int16_t = 0xfff8;
pub const EVFILT_USER: ::int16_t = 0xfff6;
pub const EVFILT_VM: ::int16_t = 0xfff4;
pub const EV_DISPATCH: ::uint16_t = 0x80;
pub const EV_FLAG0: ::uint16_t = 0x1000;
pub const EV_OOBAND: ::uint16_t = 0x2000;
pub const EV_POLL: ::uint16_t = 0x1000;
pub const EV_RECEIPT: ::uint16_t = 0x40;
pub const NOTE_ABSOLUTE: ::uint32_t = 0x8;
pub const NOTE_EXITSTATUS: ::uint32_t = 0x04000000;
pub const NOTE_EXIT_REPARENTED: ::uint32_t = 0x00080000;
pub const NOTE_FFAND: ::uint32_t = 0x40000000;
pub const NOTE_FFCOPY: ::uint32_t = 0xc0000000;
pub const NOTE_FFCTRLMASK: ::uint32_t = 0xc0000000;
pub const NOTE_FFLAGSMASK: ::uint32_t = 0x00ffffff;
pub const NOTE_FFNOP: ::uint32_t = 0x0;
pub const NOTE_FFOR: ::uint32_t = 0x80000000;
pub const NOTE_NONE: ::uint32_t = 0x80;
pub const NOTE_NSECONDS: ::uint32_t = 0x4;
pub const NOTE_REAP: ::uint32_t = 0x10000000;
pub const NOTE_SECONDS: ::uint32_t = 0x1;
pub const NOTE_SIGNAL: ::uint32_t = 0x8000000;
pub const NOTE_TRIGGER: ::uint32_t = 0x01000000;
pub const NOTE_USECONDS: ::uint32_t = 0x2;
pub const NOTE_VM_ERROR: ::uint32_t = 0x10000000;
pub const NOTE_VM_PRESSURE: ::uint32_t = 0x80000000;
pub const NOTE_VM_PRESSURE_SUDDEN_TERMINATE: ::uint32_t = 0x20000000;
pub const NOTE_VM_PRESSURE_TERMINATE: ::uint32_t = 0x40000000;
pub const NOTE_PCTRLMASK: ::uint32_t = 0xfff00000;
pub const TAB3: ::c_int = 0x00000004;
pub const VT0: ::c_int = 0x00000000;
pub const VT1: ::c_int = 0x00010000;
pub const IUTF8: ::tcflag_t = 0x00004000;
pub const CRTSCTS: ::tcflag_t = 0x00030000;
extern {
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
@ -730,6 +842,36 @@ extern {
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn kevent(kq: ::c_int,
changelist: *const ::kevent,
nchanges: ::c_int,
eventlist: *mut ::kevent,
nevents: ::c_int,
timeout: *const ::timespec) -> ::c_int;
pub fn kevent64(kq: ::c_int,
changelist: *const ::kevent64_s,
nchanges: ::c_int,
eventlist: *mut ::kevent64_s,
nevents: ::c_int,
flags: ::c_uint,
timeout: *const ::timespec) -> ::c_int;
pub fn mount(src: *const ::c_char,
target: *const ::c_char,
flags: ::c_int,
data: *mut ::c_void) -> ::c_int;
pub fn ptrace(requeset: ::c_int,
pid: ::pid_t,
addr: *mut ::c_char,
data: ::c_int) -> ::c_int;
pub fn quotactl(special: *const ::c_char,
cmd: ::c_int,
id: ::c_int,
data: *mut ::c_char) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
}
cfg_if! {

View File

@ -1,6 +1,7 @@
pub const PTHREAD_STACK_MIN: ::size_t = 1024;
pub const KERN_PROC_PATHNAME: ::c_int = 9;
pub const SIGSTKSZ: ::size_t = 40960;
pub const MADV_INVAL: ::c_int = 10;
extern {
pub fn __dfly_error() -> *const ::c_int;

View File

@ -74,6 +74,36 @@ s! {
pub tm_gmtoff: ::c_long,
pub tm_zone: *mut ::c_char,
}
pub struct utsname {
pub sysname: [::c_char; 256],
pub nodename: [::c_char; 256],
pub release: [::c_char; 256],
pub version: [::c_char; 256],
pub machine: [::c_char; 256],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
pub msg_flags: ::c_int,
}
pub struct flock {
pub l_start: ::off_t,
pub l_len: ::off_t,
pub l_pid: ::pid_t,
pub l_type: ::c_short,
pub l_whence: ::c_short,
}
pub struct fsid_t {
__fsid_val: [::int32_t; 2],
}
}
pub const FIOCLEX: ::c_ulong = 0x20006601;
@ -91,7 +121,25 @@ pub const SA_NOCLDWAIT: ::c_int = 0x0020;
pub const SIGCHLD: ::c_int = 20;
pub const SIGBUS: ::c_int = 10;
pub const SIGUSR1: ::c_int = 30;
pub const SIGUSR2: ::c_int = 31;
pub const SIGCONT: ::c_int = 19;
pub const SIGSTOP: ::c_int = 17;
pub const SIGTSTP: ::c_int = 18;
pub const SIGURG: ::c_int = 16;
pub const SIGIO: ::c_int = 23;
pub const SIGSYS: ::c_int = 12;
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
pub const SIGXFSZ: ::c_int = 25;
pub const SIGVTALRM: ::c_int = 26;
pub const SIGPROF: ::c_int = 27;
pub const SIGWINCH: ::c_int = 28;
pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
@ -103,6 +151,135 @@ pub const NI_MAXHOST: ::socklen_t = 1025;
pub const CTL_HW: ::c_int = 6;
pub const HW_NCPU: ::c_int = 3;
pub const EV_ADD: ::uint16_t = 0x1;
pub const EV_CLEAR: ::uint16_t = 0x20;
pub const EV_DELETE: ::uint16_t = 0x2;
pub const EV_DISABLE: ::uint16_t = 0x8;
pub const EV_ENABLE: ::uint16_t = 0x4;
pub const EV_EOF: ::uint16_t = 0x8000;
pub const EV_ERROR: ::uint16_t = 0x4000;
pub const EV_FLAG1: ::uint16_t = 0x2000;
pub const EV_ONESHOT: ::uint16_t = 0x10;
pub const EV_SYSFLAGS: ::uint16_t = 0xf000;
pub const NOTE_ATTRIB: ::uint32_t = 0x8;
pub const NOTE_CHILD: ::uint32_t = 0x4;
pub const NOTE_DELETE: ::uint32_t = 0x1;
pub const NOTE_EXEC: ::uint32_t = 0x20000000;
pub const NOTE_EXIT: ::uint32_t = 0x80000000;
pub const NOTE_EXTEND: ::uint32_t = 0x4;
pub const NOTE_FORK: ::uint32_t = 0x40000000;
pub const NOTE_LINK: ::uint32_t = 0x10;
pub const NOTE_LOWAT: ::uint32_t = 0x1;
pub const NOTE_PDATAMASK: ::uint32_t = 0x000fffff;
pub const NOTE_RENAME: ::uint32_t = 0x20;
pub const NOTE_REVOKE: ::uint32_t = 0x40;
pub const NOTE_TRACK: ::uint32_t = 0x1;
pub const NOTE_TRACKERR: ::uint32_t = 0x2;
pub const NOTE_WRITE: ::uint32_t = 0x2;
pub const NCCS: usize = 20;
pub const O_ASYNC: ::c_int = 0x40;
pub const O_FSYNC: ::c_int = 0x80;
pub const O_NDELAY: ::c_int = 0x4;
pub const O_NOFOLLOW: ::c_int = 0x100;
pub const F_GETLK: ::c_int = 7;
pub const F_GETOWN: ::c_int = 5;
pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;
pub const F_SETOWN: ::c_int = 6;
pub const MNT_FORCE: ::c_int = 0x80000;
pub const Q_SYNC: ::c_int = 0x600;
pub const Q_QUOTAON: ::c_int = 0x100;
pub const Q_QUOTAOFF: ::c_int = 0x200;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
pub const TCIOFF: ::c_int = 3;
pub const TCION: ::c_int = 4;
pub const TCOOFF: ::c_int = 1;
pub const TCOON: ::c_int = 2;
pub const TCIFLUSH: ::c_int = 1;
pub const TCOFLUSH: ::c_int = 2;
pub const TCIOFLUSH: ::c_int = 3;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
pub const TCSAFLUSH: ::c_int = 2;
pub const NL0: ::c_int = 0x00000000;
pub const NL1: ::c_int = 0x00000100;
pub const TAB0: ::c_int = 0x00000000;
pub const TAB1: ::c_int = 0x00000400;
pub const TAB2: ::c_int = 0x00000800;
pub const CR0: ::c_int = 0x00000000;
pub const CR1: ::c_int = 0x00001000;
pub const CR2: ::c_int = 0x00002000;
pub const CR3: ::c_int = 0x00003000;
pub const FF0: ::c_int = 0x00000000;
pub const FF1: ::c_int = 0x00004000;
pub const BS0: ::c_int = 0x00000000;
pub const BS1: ::c_int = 0x00008000;
pub const VEOF: usize = 0;
pub const VEOL: usize = 1;
pub const VEOL2: usize = 2;
pub const VERASE: usize = 3;
pub const VWERASE: usize = 4;
pub const VKILL: usize = 5;
pub const VREPRINT: usize = 6;
pub const VINTR: usize = 8;
pub const VQUIT: usize = 9;
pub const VSUSP: usize = 10;
pub const VSTART: usize = 12;
pub const VSTOP: usize = 13;
pub const VLNEXT: usize = 14;
pub const VDISCARD: usize = 15;
pub const VMIN: usize = 16;
pub const VTIME: usize = 17;
pub const IGNBRK: ::tcflag_t = 0x00000001;
pub const BRKINT: ::tcflag_t = 0x00000002;
pub const IGNPAR: ::tcflag_t = 0x00000004;
pub const PARMRK: ::tcflag_t = 0x00000008;
pub const INPCK: ::tcflag_t = 0x00000010;
pub const ISTRIP: ::tcflag_t = 0x00000020;
pub const INLCR: ::tcflag_t = 0x00000040;
pub const IGNCR: ::tcflag_t = 0x00000080;
pub const ICRNL: ::tcflag_t = 0x00000100;
pub const IXON: ::tcflag_t = 0x00000200;
pub const IXOFF: ::tcflag_t = 0x00000400;
pub const IXANY: ::tcflag_t = 0x00000800;
pub const IMAXBEL: ::tcflag_t = 0x00002000;
pub const OPOST: ::tcflag_t = 0x1;
pub const ONLCR: ::tcflag_t = 0x2;
pub const CSIZE: ::tcflag_t = 0x00000300;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CS6: ::tcflag_t = 0x00000100;
pub const CS7: ::tcflag_t = 0x00000200;
pub const CS8: ::tcflag_t = 0x00000300;
pub const CSTOPB: ::tcflag_t = 0x00000400;
pub const CREAD: ::tcflag_t = 0x00000800;
pub const PARENB: ::tcflag_t = 0x00001000;
pub const PARODD: ::tcflag_t = 0x00002000;
pub const HUPCL: ::tcflag_t = 0x00004000;
pub const CLOCAL: ::tcflag_t = 0x00008000;
pub const ECHOKE: ::tcflag_t = 0x00000001;
pub const ECHOE: ::tcflag_t = 0x00000002;
pub const ECHOK: ::tcflag_t = 0x00000004;
pub const ECHO: ::tcflag_t = 0x00000008;
pub const ECHONL: ::tcflag_t = 0x00000010;
pub const ECHOPRT: ::tcflag_t = 0x00000020;
pub const ECHOCTL: ::tcflag_t = 0x00000040;
pub const ISIG: ::tcflag_t = 0x00000080;
pub const ICANON: ::tcflag_t = 0x00000100;
pub const IEXTEN: ::tcflag_t = 0x00000400;
pub const EXTPROC: ::tcflag_t = 0x00000800;
pub const TOSTOP: ::tcflag_t = 0x00400000;
pub const FLUSHO: ::tcflag_t = 0x00800000;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@ -151,6 +328,9 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
}
cfg_if! {

View File

@ -214,11 +214,6 @@ 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_GETOWN : ::c_int = 5;
pub const F_SETOWN : ::c_int = 6;
pub const F_GETLK : ::c_int = 7;
pub const F_SETLK : ::c_int = 8;
pub const F_SETLKW : ::c_int = 9;
pub const SIGTRAP : ::c_int = 5;
@ -358,6 +353,7 @@ pub const KERN_PROC_ARGV: ::c_int = 1;
extern {
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::size_t) -> ::size_t;

View File

@ -4,6 +4,8 @@ pub type dev_t = u64;
pub type blksize_t = ::int32_t;
pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
s! {
pub struct dirent {
@ -92,10 +94,6 @@ s! {
pub f_mntfromname: [::c_char; 1024],
}
pub struct fsid_t {
__fsid_val: [::int32_t; 2],
}
pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
@ -166,9 +164,45 @@ s! {
ptr_owner: ::pthread_t,
ptr_private: *mut ::c_void,
}
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::uint32_t,
pub flags: ::uint32_t,
pub fflags: ::uint32_t,
pub data: ::int64_t,
pub udata: ::intptr_t,
}
pub struct dqblk {
pub dqb_bhardlimit: ::uint32_t,
pub dqb_bsoftlimit: ::uint32_t,
pub dqb_curblocks: ::uint32_t,
pub dqb_ihardlimit: ::uint32_t,
pub dqb_isoftlimit: ::uint32_t,
pub dqb_curinodes: ::uint32_t,
pub dqb_btime: ::int32_t,
pub dqb_itime: ::int32_t,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::c_int,
pub c_ospeed: ::c_int,
}
}
pub const O_CLOEXEC: ::c_int = 0x400000;
pub const O_ALT_IO: ::c_int = 0x40000;
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
pub const O_SEARCH: ::c_int = 0x800000;
pub const O_EXLOCK: ::c_int = 0x20;
pub const O_SHLOCK: ::c_int = 0x10;
pub const O_DIRECTORY: ::c_int = 0x200000;
pub const MS_SYNC : ::c_int = 0x4;
pub const MS_INVALIDATE : ::c_int = 0x2;
@ -185,6 +219,10 @@ pub const ENOTSUP : ::c_int = 86;
pub const ELAST : ::c_int = 96;
pub const F_DUPFD_CLOEXEC : ::c_int = 12;
pub const F_CLOSEM: ::c_int = 10;
pub const F_GETNOSIGPIPE: ::c_int = 13;
pub const F_SETNOSIGPIPE: ::c_int = 14;
pub const F_MAXFD: ::c_int = 11;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
@ -198,6 +236,7 @@ pub const O_DSYNC : ::c_int = 0x10000;
pub const MAP_RENAME : ::c_int = 0x20;
pub const MAP_NORESERVE : ::c_int = 0x40;
pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
pub const MAP_WIRED: ::c_int = 0x800;
pub const _SC_IOV_MAX : ::c_int = 32;
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
@ -273,6 +312,19 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 2;
pub const KERN_PROC_ARGS: ::c_int = 48;
pub const EVFILT_AIO: ::int16_t = 2;
pub const EVFILT_PROC: ::int16_t = 4;
pub const EVFILT_READ: ::int16_t = 0;
pub const EVFILT_SIGNAL: ::int16_t = 5;
pub const EVFILT_SYSCOUNT: ::int16_t = 7;
pub const EVFILT_TIMER: ::int16_t = 6;
pub const EVFILT_VNODE: ::int16_t = 3;
pub const EVFILT_WRITE: ::int16_t = 1;
pub const NOTE_PCTRLMASK: ::uint32_t = 0xf0000000;
pub const CRTSCTS: ::tcflag_t = 0x00010000;
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
@ -289,4 +341,22 @@ extern {
newp: *const ::c_void,
newlen: ::size_t)
-> ::c_int;
#[link_name = "__kevent50"]
pub fn kevent(kq: ::c_int,
changelist: *const ::kevent,
nchanges: ::size_t,
eventlist: *mut ::kevent,
nevents: ::size_t,
timeout: *const ::timespec) -> ::c_int;
#[link_name = "__mount50"]
pub fn mount(src: *const ::c_char,
target: *const ::c_char,
flags: ::c_int,
data: *mut ::c_void,
size: ::size_t) -> ::c_int;
pub fn ptrace(requeset: ::c_int,
pid: ::pid_t,
addr: *mut ::c_void,
data: ::c_int) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
}

View File

@ -9,6 +9,7 @@ pub type gid_t = u32;
pub type in_addr_t = u32;
pub type in_port_t = u16;
pub type sighandler_t = ::size_t;
pub type cc_t = ::c_uchar;
pub enum DIR {}
@ -85,6 +86,11 @@ s! {
pub h_length: ::c_int,
pub h_addr_list: *mut *mut ::c_char,
}
pub struct iovec {
pub iov_base: *mut ::c_void,
pub iov_len: ::size_t,
}
}
pub const WNOHANG: ::c_int = 1;
@ -100,6 +106,17 @@ pub const DT_REG: u8 = 8;
pub const DT_LNK: u8 = 10;
pub const DT_SOCK: u8 = 12;
pub const FD_CLOEXEC: ::c_int = 0x1;
pub const USRQUOTA: ::c_int = 0;
pub const GRPQUOTA: ::c_int = 1;
pub const SIGIOT: ::c_int = 6;
pub const S_ISUID: ::c_int = 0x800;
pub const S_ISGID: ::c_int = 0x400;
pub const S_ISVTX: ::c_int = 0x200;
cfg_if! {
if #[cfg(feature = "default")] {
// cargo build, don't pull in anything extra as the libstd dep
@ -371,6 +388,7 @@ extern {
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
#[cfg_attr(arget_os = "netbsd", link_name = "__gettimeofday50")]
pub fn gettimeofday(tp: *mut ::timeval,
tz: *mut ::c_void) -> ::c_int;
@ -492,6 +510,20 @@ extern {
link_name = "mktime$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
pub fn mktime(tm: *mut tm) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
dev: ::dev_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "writev$UNIX2003")]
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "readv$UNIX2003")]
pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn chroot(name: *const ::c_char) -> ::c_int;
}
// TODO: get rid of this #[cfg(not(...))]
@ -609,6 +641,26 @@ extern {
pub fn timegm(tm: *mut ::tm) -> time_t;
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "sendmsg$UNIX2003")]
pub fn sendmsg(fd: ::c_int, msg: *const msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "recvmsg$UNIX2003")]
pub fn recvmsg(fd: ::c_int, msg: *mut msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "tcdrain$UNIX2003")]
pub fn tcdrain(fd: ::c_int) -> ::c_int;
pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t;
pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
pub fn tcsetattr(fd: ::c_int,
optional_actions: ::c_int,
termios: *const ::termios) -> ::c_int;
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
}
cfg_if! {

View File

@ -20,6 +20,8 @@ pub type pthread_t = c_long;
pub type pthread_mutexattr_t = ::c_long;
pub type sigset_t = c_ulong;
pub type time64_t = i64;
pub type fsfilcnt_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulong;
s! {
pub struct stat {
@ -96,6 +98,52 @@ s! {
pub si_code: ::c_int,
pub _pad: [::c_int; 29],
}
pub struct statfs {
pub f_type: ::uint32_t,
pub f_bsize: ::uint32_t,
pub f_blocks: ::uint64_t,
pub f_bfree: ::uint64_t,
pub f_bavail: ::uint64_t,
pub f_files: ::uint64_t,
pub f_ffree: ::uint64_t,
pub f_fsid: ::__fsid_t,
pub f_namelen: ::uint32_t,
pub f_frsize: ::uint32_t,
pub f_flags: ::uint32_t,
pub f_spare: [::uint32_t; 4],
}
pub struct __fsid_t {
__val: [::c_int; 2],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::c_int,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::size_t,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::size_t,
pub msg_flags: ::c_uint,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
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 const BUFSIZ: ::c_uint = 1024;
@ -191,7 +239,28 @@ pub const SA_NOCLDWAIT: ::c_ulong = 0x00000002;
pub const SIGCHLD: ::c_int = 17;
pub const SIGBUS: ::c_int = 7;
pub const SIGUSR1: ::c_int = 10;
pub const SIGUSR2: ::c_int = 12;
pub const SIGCONT: ::c_int = 18;
pub const SIGSTOP: ::c_int = 19;
pub const SIGTSTP: ::c_int = 20;
pub const SIGURG: ::c_int = 23;
pub const SIGIO: ::c_int = 29;
pub const SIGSYS: ::c_int = 31;
pub const SIGSTKFLT: ::c_int = 16;
pub const SIGUNUSED: ::c_int = 31;
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
pub const SIGXFSZ: ::c_int = 25;
pub const SIGVTALRM: ::c_int = 26;
pub const SIGPROF: ::c_int = 27;
pub const SIGWINCH: ::c_int = 28;
pub const SIGPOLL: ::c_int = 29;
pub const SIGPWR: ::c_int = 30;
pub const SIG_SETMASK: ::c_int = 2;
pub const SIG_BLOCK: ::c_int = 0x000000;
pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const RUSAGE_CHILDREN: ::c_int = -1;
@ -317,9 +386,93 @@ pub const O_EXCL: ::c_int = 128;
pub const O_NOCTTY: ::c_int = 256;
pub const O_NONBLOCK: ::c_int = 2048;
pub const O_SYNC: ::c_int = 0x1000;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const NI_MAXHOST: ::size_t = 1025;
pub const NCCS: usize = 19;
pub const TCXONC: ::c_int = 0x540A;
pub const TCFLSH: ::c_int = 0x540B;
pub const TCSBRKP: ::c_int = 0x5425;
pub const TCGETS: ::c_int = 0x5401;
pub const TCSANOW: ::c_int = 0x5402;
pub const TCSADRAIN: ::c_int = 0x5403;
pub const TCSAFLUSH: ::c_int = 0x5404;
pub const IUTF8: ::tcflag_t = 0x00004000;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
pub const VMIN: usize = 6;
pub const IEXTEN: ::tcflag_t = 0x00008000;
pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;
pub const MS_RMT_MASK: ::c_ulong = 0x51;
pub const MS_VERBOSE: ::c_ulong = 0x8000;
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
pub const MADV_HUGEPAGE: ::c_int = 14;
pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const PTRACE_TRACEME: ::c_int = 0;
pub const PTRACE_PEEKTEXT: ::c_int = 1;
pub const PTRACE_PEEKDATA: ::c_int = 2;
pub const PTRACE_PEEKUSER: ::c_int = 3;
pub const PTRACE_POKETEXT: ::c_int = 4;
pub const PTRACE_POKEDATA: ::c_int = 5;
pub const PTRACE_POKEUSER: ::c_int = 6;
pub const PTRACE_CONT: ::c_int = 7;
pub const PTRACE_KILL: ::c_int = 8;
pub const PTRACE_SINGLESTEP: ::c_int = 9;
pub const PTRACE_ATTACH: ::c_int = 16;
pub const PTRACE_DETACH: ::c_int = 17;
pub const PTRACE_SYSCALL: ::c_int = 24;
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
pub const PTRACE_GETFPREGS: ::c_int = 14;
pub const PTRACE_SETFPREGS: ::c_int = 15;
pub const PTRACE_GETREGS: ::c_int = 12;
pub const PTRACE_SETREGS: ::c_int = 13;
pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
f! {
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int {
*set = 0;
@ -340,6 +493,37 @@ f! {
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int {
(*set & (signum as sigset_t)) as ::c_int
}
pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t {
(*termios).c_cflag & ::CBAUD
}
pub fn cfgetospeed(termios: *const ::termios) -> ::speed_t {
(*termios).c_cflag & ::CBAUD
}
pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
(*termios).c_cflag = ((*termios).c_cflag & !::CBAUD) | (speed & ::CBAUD);
return 0
}
pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
(*termios).c_cflag = ((*termios).c_cflag & !::CBAUD) | (speed & ::CBAUD);
return 0
}
pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int {
ioctl(fd, TCGETS, termios)
}
pub fn tcsetattr(fd: ::c_int,
optional_actions: ::c_int,
termios: *const ::termios) -> ::c_int {
ioctl(fd, optional_actions, termios)
}
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int {
ioctl(fd, TCXONC, action as *mut ::c_void)
}
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int {
ioctl(fd, TCFLSH, action as *mut ::c_void)
}
pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int {
ioctl(fd, TCSBRKP, duration as *mut ::c_void)
}
}
extern {
@ -372,6 +556,11 @@ extern {
sevlen: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn timegm64(tm: *const ::tm) -> time64_t;
pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_uint) -> ::c_int;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_uint) -> ::c_int;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
}
cfg_if! {

View File

@ -125,6 +125,50 @@ s! {
__unused4: ::c_ulong,
__unused5: ::c_ulong
}
pub struct statfs {
pub f_type: ::c_long,
pub f_bsize: ::c_long,
pub f_frsize: ::c_long,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_files: ::fsblkcnt_t,
pub f_ffree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_fsid: ::fsid_t,
pub f_namelen: ::c_long,
f_spare: [::c_long; 6],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::size_t,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::size_t,
pub msg_flags: ::c_int,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
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_sysid: ::c_long,
pub l_pid: ::pid_t,
pad: [::c_long; 4],
}
}
pub const BUFSIZ: ::c_uint = 8192;
@ -134,6 +178,9 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const O_ACCMODE: ::c_int = 3;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
@ -154,6 +201,9 @@ pub const O_NONBLOCK: ::c_int = 128;
pub const O_SYNC: ::c_int = 0x10;
pub const O_RSYNC: ::c_int = 0x10;
pub const O_DSYNC: ::c_int = 0x10;
pub const O_FSYNC: ::c_int = 0x10;
pub const O_ASYNC: ::c_int = 0x1000;
pub const O_NDELAY: ::c_int = 0x80;
pub const EDEADLK: ::c_int = 45;
pub const ENAMETOOLONG: ::c_int = 78;
@ -283,10 +333,104 @@ pub const SA_NOCLDWAIT: ::c_uint = 0x00010000;
pub const SIGCHLD: ::c_int = 18;
pub const SIGBUS: ::c_int = 10;
pub const SIGTTIN: ::c_int = 26;
pub const SIGTTOU: ::c_int = 27;
pub const SIGXCPU: ::c_int = 30;
pub const SIGXFSZ: ::c_int = 31;
pub const SIGVTALRM: ::c_int = 28;
pub const SIGPROF: ::c_int = 29;
pub const SIGWINCH: ::c_int = 20;
pub const SIGUSR1: ::c_int = 16;
pub const SIGUSR2: ::c_int = 17;
pub const SIGCONT: ::c_int = 25;
pub const SIGSTOP: ::c_int = 23;
pub const SIGTSTP: ::c_int = 24;
pub const SIGURG: ::c_int = 21;
pub const SIGIO: ::c_int = 22;
pub const SIGSYS: ::c_int = 12;
pub const SIGPOLL: ::c_int = 22;
pub const SIGPWR: ::c_int = 19;
pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
pub const PTHREAD_STACK_MIN: ::size_t = 131072;
pub const MS_VERBOSE: ::c_ulong = 0x8000;
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
pub const VEOF: usize = 16;
pub const VEOL: usize = 17;
pub const VEOL2: usize = 6;
pub const VMIN: usize = 4;
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 TCSANOW: ::c_int = 0x540e;
pub const TCSADRAIN: ::c_int = 0x540f;
pub const TCSAFLUSH: ::c_int = 0x5410;
pub const CPU_SETSIZE: ::c_int = 0x400;
pub const PTRACE_TRACEME: ::c_uint = 0;
pub const PTRACE_PEEKTEXT: ::c_uint = 1;
pub const PTRACE_PEEKDATA: ::c_uint = 2;
pub const PTRACE_PEEKUSER: ::c_uint = 3;
pub const PTRACE_POKETEXT: ::c_uint = 4;
pub const PTRACE_POKEDATA: ::c_uint = 5;
pub const PTRACE_POKEUSER: ::c_uint = 6;
pub const PTRACE_CONT: ::c_uint = 7;
pub const PTRACE_KILL: ::c_uint = 8;
pub const PTRACE_SINGLESTEP: ::c_uint = 9;
pub const PTRACE_ATTACH: ::c_uint = 16;
pub const PTRACE_DETACH: ::c_uint = 17;
pub const PTRACE_SYSCALL: ::c_uint = 24;
pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
pub const EFD_NONBLOCK: ::c_int = 0x80;
pub const F_GETLK: ::c_int = 14;
pub const F_GETOWN: ::c_int = 23;
pub const F_SETOWN: ::c_int = 24;
pub const SFD_NONBLOCK: ::c_int = 0x80;
extern {
pub fn sysctl(name: *mut ::c_int,
namelen: ::c_int,
@ -311,4 +455,6 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_uint) -> ::c_int;
pub fn eventfd(init: ::c_int, flags: ::c_int) -> ::c_int;
pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
}

View File

@ -127,6 +127,57 @@ s! {
pub nl_pid: u32,
pub nl_groups: u32
}
pub struct dqblk {
pub dqb_bhardlimit: ::uint64_t,
pub dqb_bsoftlimit: ::uint64_t,
pub dqb_curspace: ::uint64_t,
pub dqb_ihardlimit: ::uint64_t,
pub dqb_isoftlimit: ::uint64_t,
pub dqb_curinodes: ::uint64_t,
pub dqb_btime: ::uint64_t,
pub dqb_itime: ::uint64_t,
pub dqb_valid: ::uint32_t,
}
pub struct signalfd_siginfo {
pub ssi_signo: ::uint32_t,
pub ssi_errno: ::int32_t,
pub ssi_code: ::int32_t,
pub ssi_pid: ::uint32_t,
pub ssi_uid: ::uint32_t,
pub ssi_fd: ::int32_t,
pub ssi_tid: ::uint32_t,
pub ssi_band: ::uint32_t,
pub ssi_overrun: ::uint32_t,
pub ssi_trapno: ::uint32_t,
pub ssi_status: ::int32_t,
pub ssi_int: ::int32_t,
pub ssi_ptr: ::uint64_t,
pub ssi_utime: ::uint64_t,
pub ssi_stime: ::uint64_t,
pub ssi_addr: ::uint64_t,
_pad: [::uint8_t; 48],
}
pub struct fsid_t {
__val: [::c_int; 2],
}
pub struct mq_attr {
pub mq_flags: ::c_long,
pub mq_maxmsg: ::c_long,
pub mq_msgsize: ::c_long,
pub mq_curmsgs: ::c_long,
pad: [::c_long; 4]
}
pub struct cpu_set_t {
#[cfg(target_pointer_width = "32")]
bits: [u32; 32],
#[cfg(target_pointer_width = "64")]
bits: [u64; 16],
}
}
pub const FILENAME_MAX: ::c_uint = 4096;
@ -312,6 +363,31 @@ pub const SHM_UNLOCK: ::c_int = 12;
pub const SHM_HUGETLB: ::c_int = 0o4000;
pub const SHM_NORESERVE: ::c_int = 0o10000;
pub const MS_RELATIME: ::c_ulong = 0x200000;
pub const MS_KERNMOUNT: ::c_ulong = 0x400000;
pub const MS_I_VERSION: ::c_ulong = 0x800000;
pub const MS_STRICTATIME: ::c_ulong = 0x01000000;
pub const MS_RMT_MASK: ::c_ulong = 0x800051;
pub const EPOLLRDHUP: ::c_int = 0x2000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
pub const QFMT_VFS_OLD: ::c_int = 1;
pub const QFMT_VFS_V0: ::c_int = 2;
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const EFD_SEMAPHORE: ::c_int = 0x1;
pub const NCCS: usize = 32;
pub const CLONE_NEWUTS: ::c_uint = 0x04000000;
pub const CLONE_NEWIPC: ::c_uint = 0x08000000;
pub const CLONE_NEWUSER: ::c_uint = 0x10000000;
pub const CLONE_NEWPID: ::c_uint = 0x20000000;
pub const CLONE_NEWNET: ::c_uint = 0x40000000;
pub const CLONE_IO: ::c_uint = 0x80000000;
extern {
pub fn shm_open(name: *const c_char, oflag: ::c_int,
mode: mode_t) -> ::c_int;
@ -387,6 +463,51 @@ extern {
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
pub fn signalfd(fd: ::c_int,
mask: *const ::sigset_t,
flags: ::c_int) -> ::c_int;
pub fn pwritev(fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
offset: ::off_t) -> ::ssize_t;
pub fn preadv(fd: ::c_int,
iov: *const ::iovec,
iovcnt: ::c_int,
offset: ::off_t) -> ::ssize_t;
pub fn quotactl(cmd: ::c_int,
special: *const ::c_char,
id: ::c_int,
data: *mut ::c_char) -> ::c_int;
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
pub fn mq_receive(mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint) -> ::ssize_t;
pub fn mq_send(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
msq_prio: ::c_uint) -> ::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 sched_getaffinity(pid: ::pid_t,
cpusetsize: ::size_t,
cpuset: *mut cpu_set_t) -> ::c_int;
pub fn sched_setaffinity(pid: ::pid_t,
cpusetsize: ::size_t,
cpuset: *const cpu_set_t) -> ::c_int;
pub fn epoll_pwait(epfd: ::c_int,
events: *mut ::epoll_event,
maxevents: ::c_int,
timeout: ::c_int,
sigmask: *const ::sigset_t) -> ::c_int;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn unshare(flags: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_long, ...) -> ::c_long;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
}
cfg_if! {

View File

@ -107,6 +107,52 @@ s! {
__pad1: ::c_ulong,
__pad2: ::c_ulong,
}
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_fsid: ::fsid_t,
pub f_namelen: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_flags: ::c_ulong,
pub f_spare: [::c_ulong; 4],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
__pad1: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
__pad2: ::socklen_t,
pub msg_flags: ::c_int,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
pub c_cc: [::cc_t; ::NCCS],
pub __c_ispeed: ::speed_t,
pub __c_ospeed: ::speed_t,
}
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 const BUFSIZ: ::c_uint = 1024;
@ -114,6 +160,11 @@ pub const TMP_MAX: ::c_uint = 10000;
pub const FOPEN_MAX: ::c_uint = 1000;
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
pub const O_ACCMODE: ::c_int = 0o10000003;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const RUSAGE_CHILDREN: ::c_int = 1;
pub const NI_MAXHOST: ::socklen_t = 255;
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
@ -274,7 +325,28 @@ pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
pub const SIGCHLD: ::c_int = 17;
pub const SIGBUS: ::c_int = 7;
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
pub const SIGXFSZ: ::c_int = 25;
pub const SIGVTALRM: ::c_int = 26;
pub const SIGPROF: ::c_int = 27;
pub const SIGWINCH: ::c_int = 28;
pub const SIGUSR1: ::c_int = 10;
pub const SIGUSR2: ::c_int = 12;
pub const SIGCONT: ::c_int = 18;
pub const SIGSTOP: ::c_int = 19;
pub const SIGTSTP: ::c_int = 20;
pub const SIGURG: ::c_int = 23;
pub const SIGIO: ::c_int = 29;
pub const SIGSYS: ::c_int = 31;
pub const SIGSTKFLT: ::c_int = 16;
pub const SIGUNUSED: ::c_int = 31;
pub const SIGPOLL: ::c_int = 29;
pub const SIGPWR: ::c_int = 30;
pub const SIG_SETMASK: ::c_int = 2;
pub const SIG_BLOCK: ::c_int = 0x000000;
pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
@ -285,6 +357,75 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const CPU_SETSIZE: ::c_int = 128;
pub const EXTPROC: ::tcflag_t = 0x00010000;
pub const QFMT_VFS_V1: ::c_int = 4;
pub const PTRACE_TRACEME: ::c_int = 0;
pub const PTRACE_PEEKTEXT: ::c_int = 1;
pub const PTRACE_PEEKDATA: ::c_int = 2;
pub const PTRACE_PEEKUSER: ::c_int = 3;
pub const PTRACE_POKETEXT: ::c_int = 4;
pub const PTRACE_POKEDATA: ::c_int = 5;
pub const PTRACE_POKEUSER: ::c_int = 6;
pub const PTRACE_CONT: ::c_int = 7;
pub const PTRACE_KILL: ::c_int = 8;
pub const PTRACE_SINGLESTEP: ::c_int = 9;
pub const PTRACE_ATTACH: ::c_int = 16;
pub const PTRACE_DETACH: ::c_int = 17;
pub const PTRACE_SYSCALL: ::c_int = 24;
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
pub const PTRACE_GETREGSET: ::c_int = 0x4204;
pub const PTRACE_SETREGSET: ::c_int = 0x4205;
pub const PTRACE_SEIZE: ::c_int = 0x4206;
pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
pub const PTRACE_LISTEN: ::c_int = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
pub const MADV_DODUMP: ::c_int = 17;
pub const MADV_DONTDUMP: ::c_int = 16;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const MS_NOSEC: ::c_ulong = 0x10000000;
pub const MS_BORN: ::c_ulong = 0x20000000;
pub const MADV_HUGEPAGE: ::c_int = 14;
pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
pub const VMIN: usize = 6;
pub const IEXTEN: ::tcflag_t = 0x00008000;
pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;
pub const SFD_NONBLOCK: ::c_int = 0x0800;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
pub const TCSAFLUSH: ::c_int = 2;
extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
@ -294,4 +435,6 @@ extern {
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
}

View File

@ -1,2 +1,6 @@
pub type c_char = u8;
pub type wchar_t = u32;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;

View File

@ -8,6 +8,7 @@ pub type suseconds_t = i32;
pub type ino_t = u32;
pub type off_t = i32;
pub type blkcnt_t = i32;
pub type __fsword_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
@ -16,6 +17,13 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
s! {
pub struct stat {
pub st_dev: ::dev_t,

View File

@ -1,2 +1,6 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;

View File

@ -8,6 +8,10 @@ pub type blksize_t = i32;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
s! {
pub struct stat {
pub st_dev: ::dev_t,

View File

@ -8,6 +8,7 @@ pub type suseconds_t = i64;
pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;
pub type __fsword_t = ::c_long;
s! {
pub struct sigset_t {

View File

@ -8,6 +8,17 @@ pub type blksize_t = i64;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
s! {
pub struct stat {
pub st_dev: ::dev_t,

View File

@ -33,11 +33,57 @@ s! {
__unused5: *mut ::c_void,
}
pub struct ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
}
pub struct statfs {
pub f_type: __fsword_t,
pub f_bsize: __fsword_t,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_fsid: ::fsid_t,
pub f_namelen: __fsword_t,
pub f_frsize: __fsword_t,
f_spare: [__fsword_t; 5],
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::size_t,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::size_t,
pub msg_flags: ::c_int,
}
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
pub c_lflag: ::tcflag_t,
pub c_line: ::cc_t,
pub c_cc: [::cc_t; ::NCCS],
pub c_ispeed: ::speed_t,
pub c_ospeed: ::speed_t,
}
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 const RLIMIT_RSS: ::c_int = 5;
@ -57,6 +103,7 @@ pub const O_NONBLOCK: ::c_int = 2048;
pub const O_SYNC: ::c_int = 1052672;
pub const O_RSYNC: ::c_int = 1052672;
pub const O_DSYNC: ::c_int = 4096;
pub const O_FSYNC: ::c_int = 0x101000;
pub const MAP_ANON: ::c_int = 0x0020;
pub const MAP_ANONYMOUS: ::c_int = 0x0020;
@ -194,7 +241,28 @@ pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
pub const SIGCHLD: ::c_int = 17;
pub const SIGBUS: ::c_int = 7;
pub const SIGUSR1: ::c_int = 10;
pub const SIGUSR2: ::c_int = 12;
pub const SIGCONT: ::c_int = 18;
pub const SIGSTOP: ::c_int = 19;
pub const SIGTSTP: ::c_int = 20;
pub const SIGURG: ::c_int = 23;
pub const SIGIO: ::c_int = 29;
pub const SIGSYS: ::c_int = 31;
pub const SIGSTKFLT: ::c_int = 16;
pub const SIGUNUSED: ::c_int = 31;
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
pub const SIGXFSZ: ::c_int = 25;
pub const SIGVTALRM: ::c_int = 26;
pub const SIGPROF: ::c_int = 27;
pub const SIGWINCH: ::c_int = 28;
pub const SIGPOLL: ::c_int = 29;
pub const SIGPWR: ::c_int = 30;
pub const SIG_SETMASK: ::c_int = 2;
pub const SIG_BLOCK: ::c_int = 0x000000;
pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
@ -209,10 +277,104 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const O_ACCMODE: ::c_int = 3;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
pub const MS_VERBOSE: ::c_ulong = 0x8000;
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
pub const VMIN: usize = 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;
pub const EXTPROC: ::tcflag_t = 0x00010000;
pub const QFMT_VFS_V1: ::c_int = 4;
pub const PTRACE_TRACEME: ::c_uint = 0;
pub const PTRACE_PEEKTEXT: ::c_uint = 1;
pub const PTRACE_PEEKDATA: ::c_uint = 2;
pub const PTRACE_PEEKUSER: ::c_uint = 3;
pub const PTRACE_POKETEXT: ::c_uint = 4;
pub const PTRACE_POKEDATA: ::c_uint = 5;
pub const PTRACE_POKEUSER: ::c_uint = 6;
pub const PTRACE_CONT: ::c_uint = 7;
pub const PTRACE_KILL: ::c_uint = 8;
pub const PTRACE_SINGLESTEP: ::c_uint = 9;
pub const PTRACE_ATTACH: ::c_uint = 16;
pub const PTRACE_DETACH: ::c_uint = 17;
pub const PTRACE_SYSCALL: ::c_uint = 24;
pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
pub const PTRACE_GETREGSET: ::c_uint = 0x4204;
pub const PTRACE_SETREGSET: ::c_uint = 0x4205;
pub const PTRACE_SEIZE: ::c_uint = 0x4206;
pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
pub const PTRACE_LISTEN: ::c_uint = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
pub const MADV_DODUMP: ::c_int = 17;
pub const MADV_DONTDUMP: ::c_int = 16;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const MS_NOSEC: ::c_ulong = 0x10000000;
pub const MS_BORN: ::c_ulong = 0x20000000;
pub const MADV_HUGEPAGE: ::c_int = 14;
pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const EFD_NONBLOCK: ::c_int = 0x800;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
pub const SFD_NONBLOCK: ::c_int = 0x0800;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
pub const TCSAFLUSH: ::c_int = 2;
cfg_if! {
if #[cfg(any(target_arch = "arm", target_arch = "x86",
target_arch = "x86_64"))] {
@ -246,6 +408,8 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
pub fn eventfd(init: ::c_int, flags: ::c_int) -> ::c_int;
pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
}
cfg_if! {

View File

@ -3,6 +3,9 @@ use dox::mem;
pub type rlim_t = c_ulong;
pub type sa_family_t = u16;
pub type pthread_key_t = ::c_uint;
pub type mqd_t = ::c_int;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub enum timezone {}
@ -105,6 +108,22 @@ s! {
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
#[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"),
repr(packed))]
pub struct epoll_event {
pub events: ::uint32_t,
pub u64: ::uint64_t,
}
pub struct utsname {
pub sysname: [::c_char; 65],
pub nodename: [::c_char; 65],
pub release: [::c_char; 65],
pub version: [::c_char; 65],
pub machine: [::c_char; 65],
pub domainname: [::c_char; 65]
}
}
// intentionally not public, only used for fd_set
@ -213,6 +232,29 @@ pub const MCL_FUTURE: ::c_int = 0x0002;
pub const MS_ASYNC: ::c_int = 0x0001;
pub const MS_INVALIDATE: ::c_int = 0x0002;
pub const MS_SYNC: ::c_int = 0x0004;
pub const MS_RDONLY: ::c_ulong = 0x01;
pub const MS_NOSUID: ::c_ulong = 0x02;
pub const MS_NODEV: ::c_ulong = 0x04;
pub const MS_NOEXEC: ::c_ulong = 0x08;
pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
pub const MS_REMOUNT: ::c_ulong = 0x20;
pub const MS_MANDLOCK: ::c_ulong = 0x40;
pub const MS_DIRSYNC: ::c_ulong = 0x80;
pub const MS_NOATIME: ::c_ulong = 0x0400;
pub const MS_NODIRATIME: ::c_ulong = 0x0800;
pub const MS_BIND: ::c_ulong = 0x1000;
pub const MS_MOVE: ::c_ulong = 0x2000;
pub const MS_REC: ::c_ulong = 0x4000;
pub const MS_SILENT: ::c_ulong = 0x8000;
pub const MS_POSIXACL: ::c_ulong = 0x010000;
pub const MS_UNBINDABLE: ::c_ulong = 0x020000;
pub const MS_PRIVATE: ::c_ulong = 0x040000;
pub const MS_SLAVE: ::c_ulong = 0x080000;
pub const MS_SHARED: ::c_ulong = 0x100000;
pub const MS_ACTIVE: ::c_ulong = 0x40000000;
pub const MS_NOUSER: ::c_ulong = 0x80000000;
pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
pub const EPERM: ::c_int = 1;
pub const ENOENT: ::c_int = 2;
@ -342,6 +384,145 @@ pub const PATH_MAX: ::c_int = 4096;
pub const FD_SETSIZE: usize = 1024;
pub const EPOLLIN: ::c_int = 0x1;
pub const EPOLLPRI: ::c_int = 0x2;
pub const EPOLLOUT: ::c_int = 0x4;
pub const EPOLLRDNORM: ::c_int = 0x40;
pub const EPOLLRDBAND: ::c_int = 0x80;
pub const EPOLLWRNORM: ::c_int = 0x100;
pub const EPOLLWRBAND: ::c_int = 0x200;
pub const EPOLLMSG: ::c_int = 0x400;
pub const EPOLLERR: ::c_int = 0x8;
pub const EPOLLHUP: ::c_int = 0x10;
pub const EPOLLET: ::c_int = 0x80000000;
pub const EPOLL_CTL_ADD: ::c_int = 1;
pub const EPOLL_CTL_MOD: ::c_int = 3;
pub const EPOLL_CTL_DEL: ::c_int = 2;
pub const MNT_DETACH: ::c_int = 0x2;
pub const MNT_EXPIRE: ::c_int = 0x4;
pub const Q_GETFMT: ::c_int = 0x800004;
pub const Q_GETINFO: ::c_int = 0x800005;
pub const Q_SETINFO: ::c_int = 0x800006;
pub const QIF_BLIMITS: ::uint32_t = 1;
pub const QIF_SPACE: ::uint32_t = 2;
pub const QIF_ILIMITS: ::uint32_t = 4;
pub const QIF_INODES: ::uint32_t = 8;
pub const QIF_BTIME: ::uint32_t = 16;
pub const QIF_ITIME: ::uint32_t = 32;
pub const QIF_LIMITS: ::uint32_t = 5;
pub const QIF_USAGE: ::uint32_t = 10;
pub const QIF_TIMES: ::uint32_t = 48;
pub const QIF_ALL: ::uint32_t = 63;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const MNT_FORCE: ::c_int = 0x1;
pub const Q_SYNC: ::c_int = 0x800001;
pub const Q_QUOTAON: ::c_int = 0x800002;
pub const Q_QUOTAOFF: ::c_int = 0x800003;
pub const Q_GETQUOTA: ::c_int = 0x800007;
pub const Q_SETQUOTA: ::c_int = 0x800008;
pub const TCIOFF: ::c_int = 2;
pub const TCION: ::c_int = 3;
pub const TCOOFF: ::c_int = 0;
pub const TCOON: ::c_int = 1;
pub const TCIFLUSH: ::c_int = 0;
pub const TCOFLUSH: ::c_int = 1;
pub const TCIOFLUSH: ::c_int = 2;
pub const NL0: ::c_int = 0x00000000;
pub const NL1: ::c_int = 0x00000100;
pub const TAB0: ::c_int = 0x00000000;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
pub const TAB3: ::c_int = 0x00001800;
pub const CR0: ::c_int = 0x00000000;
pub const CR1: ::c_int = 0x00000200;
pub const CR2: ::c_int = 0x00000400;
pub const CR3: ::c_int = 0x00000600;
pub const FF0: ::c_int = 0x00000000;
pub const FF1: ::c_int = 0x00008000;
pub const BS0: ::c_int = 0x00000000;
pub const BS1: ::c_int = 0x00002000;
pub const VT0: ::c_int = 0x00000000;
pub const VT1: ::c_int = 0x00004000;
pub const VERASE: usize = 2;
pub const VWERASE: usize = 14;
pub const VKILL: usize = 3;
pub const VREPRINT: usize = 12;
pub const VINTR: usize = 0;
pub const VQUIT: usize = 1;
pub const VSUSP: usize = 10;
pub const VSTART: usize = 8;
pub const VSTOP: usize = 9;
pub const VLNEXT: usize = 15;
pub const VDISCARD: usize = 13;
pub const VTIME: usize = 5;
pub const IGNBRK: ::tcflag_t = 0x00000001;
pub const BRKINT: ::tcflag_t = 0x00000002;
pub const IGNPAR: ::tcflag_t = 0x00000004;
pub const PARMRK: ::tcflag_t = 0x00000008;
pub const INPCK: ::tcflag_t = 0x00000010;
pub const ISTRIP: ::tcflag_t = 0x00000020;
pub const INLCR: ::tcflag_t = 0x00000040;
pub const IGNCR: ::tcflag_t = 0x00000080;
pub const ICRNL: ::tcflag_t = 0x00000100;
pub const IXON: ::tcflag_t = 0x00000400;
pub const IXOFF: ::tcflag_t = 0x00001000;
pub const IXANY: ::tcflag_t = 0x00000800;
pub const IMAXBEL: ::tcflag_t = 0x00002000;
pub const OPOST: ::tcflag_t = 0x1;
pub const ONLCR: ::tcflag_t = 0x4;
pub const CSIZE: ::tcflag_t = 0x00000030;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CS6: ::tcflag_t = 0x00000010;
pub const CS7: ::tcflag_t = 0x00000020;
pub const CS8: ::tcflag_t = 0x00000030;
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 CRTSCTS: ::tcflag_t = 0x80000000;
pub const ECHOKE: ::tcflag_t = 0x00000800;
pub const ECHOE: ::tcflag_t = 0x00000010;
pub const ECHOK: ::tcflag_t = 0x00000020;
pub const ECHO: ::tcflag_t = 0x00000008;
pub const ECHONL: ::tcflag_t = 0x00000040;
pub const ECHOPRT: ::tcflag_t = 0x00000400;
pub const ECHOCTL: ::tcflag_t = 0x00000200;
pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
pub const CLONE_VM: ::c_int = 0x100;
pub const CLONE_FS: ::c_int = 0x200;
pub const CLONE_FILES: ::c_int = 0x400;
pub const CLONE_SIGHAND: ::c_int = 0x800;
pub const CLONE_PTRACE: ::c_int = 0x2000;
pub const CLONE_VFORK: ::c_int = 0x4000;
pub const CLONE_PARENT: ::c_int = 0x8000;
pub const CLONE_THREAD: ::c_int = 0x10000;
pub const CLONE_NEWNS: ::c_int = 0x20000;
pub const CLONE_SYSVSEM: ::c_int = 0x40000;
pub const CLONE_SETTLS: ::c_int = 0x80000;
pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
pub const CLONE_DETACHED: ::c_int = 0x400000;
pub const CLONE_UNTRACED: ::c_int = 0x800000;
pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@ -402,6 +583,29 @@ extern {
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
pub fn epoll_create(size: ::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_wait(epfd: ::c_int,
events: *mut epoll_event,
maxevents: ::c_int,
timeout: ::c_int) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn mount(src: *const ::c_char,
target: *const ::c_char,
fstype: *const ::c_char,
flags: ::c_ulong,
data: *const ::c_void) -> ::c_int;
pub fn umount(target: *const ::c_char) -> ::c_int;
pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
child_stack: *mut ::c_void,
flags: ::c_int,
arg: *mut ::c_void, ...) -> ::c_int;
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
}
cfg_if! {