aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/uclibc
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
committerDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
commitbcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2 (patch)
treee7470179e1bfb3fff279450e402ddcaf038ae086 /libc/src/unix/uclibc
parentab3c2a935b1ba655de2f3fec35da2c14b69966dc (diff)
downloadnitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.gz
nitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.bz2
Update libc crate to 0.2.30
Import subrepo libc/:libc at 3520512a8c9cb55661910318a6fb169a75c02a59
Diffstat (limited to 'libc/src/unix/uclibc')
-rw-r--r--libc/src/unix/uclibc/mod.rs121
-rw-r--r--libc/src/unix/uclibc/x86_64/l4re.rs46
-rw-r--r--libc/src/unix/uclibc/x86_64/mod.rs349
3 files changed, 485 insertions, 31 deletions
diff --git a/libc/src/unix/uclibc/mod.rs b/libc/src/unix/uclibc/mod.rs
index 076ee41..6d32127 100644
--- a/libc/src/unix/uclibc/mod.rs
+++ b/libc/src/unix/uclibc/mod.rs
@@ -11,7 +11,7 @@ pub type id_t = ::c_uint;
pub type useconds_t = u32;
pub type dev_t = u64;
pub type socklen_t = u32;
-pub type pthread_t = c_ulong;
+pub type pthread_t = ::c_ulong;
pub type mode_t = u32;
pub type ino64_t = u64;
pub type off64_t = i64;
@@ -257,6 +257,11 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ pub struct pthread_rwlockattr_t {
+ __lockkind: ::c_int,
+ __pshared: ::c_int,
+ }
+
pub struct pthread_cond_t {
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
@@ -418,14 +423,14 @@ pub const SIGTRAP: ::c_int = 5;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
-// pub const CLOCK_TAI: clockid_t = 11;
+// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+// pub const CLOCK_TAI: ::clockid_t = 11;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const RLIMIT_CPU: ::c_int = 0;
@@ -720,11 +725,6 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
pub const IP_MULTICAST_TTL: ::c_int = 33;
pub const IP_MULTICAST_LOOP: ::c_int = 34;
pub const IP_TTL: ::c_int = 2;
@@ -732,6 +732,9 @@ pub const IP_HDRINCL: ::c_int = 3;
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
+pub const IPV6_JOIN_GROUP: ::c_int = 20;
+pub const IPV6_LEAVE_GROUP: ::c_int = 21;
+
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
pub const TCP_CORK: ::c_int = 3;
@@ -1419,26 +1422,16 @@ f! {
}
extern {
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_nanosleep(clk_id: clockid_t,
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_nanosleep(clk_id: ::clockid_t,
flags: ::c_int,
rqtp: *const ::timespec,
rmtp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn prctl(option: ::c_int, ...) -> ::c_int;
pub fn pthread_getattr_np(native: ::pthread_t,
attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -1453,7 +1446,7 @@ extern {
pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
- param: *const sched_param) -> ::c_int;
+ param: *const ::sched_param) -> ::c_int;
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;
@@ -1462,9 +1455,9 @@ extern {
pub fn epoll_ctl(epfd: ::c_int,
op: ::c_int,
fd: ::c_int,
- event: *mut epoll_event) -> ::c_int;
+ event: *mut ::epoll_event) -> ::c_int;
pub fn epoll_wait(epfd: ::c_int,
- events: *mut epoll_event,
+ events: *mut ::epoll_event,
maxevents: ::c_int,
timeout: ::c_int) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
@@ -1555,7 +1548,7 @@ extern {
pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
clock_id: *mut clockid_t) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
- clock_id: clockid_t) -> ::c_int;
+ clock_id: ::clockid_t) -> ::c_int;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
@@ -1577,6 +1570,14 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;
@@ -1587,6 +1588,7 @@ extern {
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn setpwent();
+ pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn setspent();
pub fn endspent();
@@ -1753,14 +1755,71 @@ extern {
flags: ::c_int) -> ::ssize_t;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
}
cfg_if! {
if #[cfg(target_arch = "mips")] {
mod mips;
pub use self::mips::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
} else {
pub use unsupported_target;
}
}
-
diff --git a/libc/src/unix/uclibc/x86_64/l4re.rs b/libc/src/unix/uclibc/x86_64/l4re.rs
new file mode 100644
index 0000000..f047a82
--- /dev/null
+++ b/libc/src/unix/uclibc/x86_64/l4re.rs
@@ -0,0 +1,46 @@
+/// L4Re specifics
+/// This module contains definitions required by various L4Re libc backends.
+/// Some of them are formally not part of the libc, but are a dependency of the
+/// libc and hence we should provide them here.
+
+pub type l4_umword_t = ::c_ulong; // Unsigned machine word.
+
+s! {
+ /// CPU sets.
+ pub struct l4_sched_cpu_set_t {
+ // from the L4Re docs
+ /// Combination of granularity and offset.
+ ///
+ /// The granularity defines how many CPUs each bit in map describes.
+ /// The offset is the numer of the first CPU described by the first
+ /// bit in the bitmap.
+ /// offset must be a multiple of 2^graularity.
+ ///
+ /// | MSB | LSB |
+ /// | ---------------- | ------------------- |
+ /// | 8bit granularity | 24bit offset .. |
+ gran_offset: l4_umword_t ,
+ /// Bitmap of CPUs.
+ map: l4_umword_t ,
+ }
+}
+
+#[cfg(target_os = "l4re")]
+pub struct pthread_attr_t {
+ pub __detachstate: ::c_int,
+ pub __schedpolicy: ::c_int,
+ pub __schedparam: super::__sched_param,
+ pub __inheritsched: ::c_int,
+ pub __scope: ::c_int,
+ pub __guardsize: ::size_t,
+ pub __stackaddr_set: ::c_int,
+ pub __stackaddr: *mut ::c_void, // better don't use it
+ pub __stacksize: ::size_t,
+ // L4Re specifics
+ pub affinity: l4_sched_cpu_set_t,
+ pub create_flags: ::c_uint,
+}
+
+// L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
+// somewhere in the core libraries. uClibc wants 16k, but that's not enough.
+pub const PTHREAD_STACK_MIN: usize = 65536;
diff --git a/libc/src/unix/uclibc/x86_64/mod.rs b/libc/src/unix/uclibc/x86_64/mod.rs
new file mode 100644
index 0000000..29cefca
--- /dev/null
+++ b/libc/src/unix/uclibc/x86_64/mod.rs
@@ -0,0 +1,349 @@
+//! Definitions for uclibc on 64bit systems
+//!
+pub type blkcnt_t = i64;
+pub type blksize_t = i64;
+pub type clock_t = i64;
+pub type c_char = u8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type fsword_t = ::c_long;
+pub type ino_t = ::c_ulong;
+pub type nlink_t = ::c_uint;
+pub type off_t = ::c_long;
+pub type rlim_t = c_ulong;
+pub type rlim64_t = u64;
+// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
+pub type stat64 = stat;
+pub type suseconds_t = ::c_long;
+pub type time_t = ::c_int;
+pub type wchar_t = ::c_int;
+
+pub type nfds_t = ::c_ulong;
+
+s! {
+ pub struct dirent {
+ pub d_ino: ::ino64_t,
+ pub d_off: ::off64_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct dirent64 {
+ pub d_ino: ::ino64_t,
+ pub d_off: ::off64_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct ipc_perm {
+ pub __key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::c_ushort, // read / write
+ __pad1: ::c_ushort,
+ pub __seq: ::c_ushort,
+ __pad2: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong
+ }
+
+ #[cfg(not(target_os = "l4re"))]
+ pub struct pthread_attr_t {
+ __detachstate: ::c_int,
+ __schedpolicy: ::c_int,
+ __schedparam: __sched_param,
+ __inheritsched: ::c_int,
+ __scope: ::c_int,
+ __guardsize: ::size_t,
+ __stackaddr_set: ::c_int,
+ __stackaddr: *mut ::c_void, // better don't use it
+ __stacksize: ::size_t,
+ }
+
+ pub struct __sched_param {
+ __sched_priority: ::c_int,
+ }
+
+ pub struct siginfo_t {
+ si_signo: ::c_int, // signal number
+ si_errno: ::c_int, // if not zero: error value of signal, see errno.h
+ si_code: ::c_int, // signal code
+ pub _pad: [::c_int; 28], // unported union
+ _align: [usize; 0],
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t, // segment size in bytes
+ pub shm_atime: ::time_t, // time of last shmat()
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong
+ }
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __ignored1: ::c_ulong,
+ __ignored2: ::c_ulong,
+ }
+
+ pub struct sockaddr {
+ pub sa_family: ::sa_family_t,
+ pub sa_data: [::c_char; 14],
+ }
+
+ pub struct sockaddr_in {
+ pub sin_family: ::sa_family_t,
+ pub sin_port: ::in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [u8; 8],
+ }
+
+ pub struct sockaddr_in6 {
+ pub sin6_family: ::sa_family_t,
+ pub sin6_port: ::in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: ::in6_addr,
+ pub sin6_scope_id: u32,
+ }
+
+ // ------------------------------------------------------------
+ // definitions below are *unverified* and might **break** the software
+// pub struct in_addr {
+// pub s_addr: in_addr_t,
+// }
+//
+// pub struct in6_addr {
+// pub s6_addr: [u8; 16],
+// __align: [u32; 0],
+// }
+
+ pub struct stat {
+ pub st_dev: ::c_ulong,
+ pub st_ino: ::ino_t,
+ // According to uclibc/libc/sysdeps/linux/x86_64/bits/stat.h, order of
+ // nlink and mode are swapped on 64 bit systems.
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::c_ulong, // dev_t
+ pub st_size: off_t, // file size
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ 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,
+ st_pad4: [::c_long; 3]
+ }
+
+ pub struct sigaction {
+ pub sa_handler: ::sighandler_t,
+ pub sa_flags: ::c_ulong,
+ pub sa_restorer: *mut ::c_void,
+ pub sa_mask: ::sigset_t,
+ }
+
+ pub struct stack_t { // ToDo
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t
+ }
+
+ pub struct statfs { // ToDo
+ 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 { // ToDo
+ 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 { // ToDo
+ 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 sem_t { // ToDo
+ #[cfg(target_pointer_width = "32")]
+ __size: [::c_char; 16],
+ #[cfg(target_pointer_width = "64")]
+ __size: [::c_char; 32],
+ __align: [::c_long; 0],
+ }
+
+ pub struct pthread_mutex_t { // ToDo
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+ }
+
+ pub struct pthread_mutexattr_t { // ToDo
+ #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64"))]
+ __align: [::c_int; 0],
+ #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64")))]
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+ }
+
+ pub struct pthread_cond_t { // ToDo
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_COND_T],
+ }
+
+ pub struct pthread_condattr_t { // ToDo
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+ }
+
+ pub struct pthread_rwlock_t { // ToDo
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+ }
+
+ pub struct sigset_t { // ToDo
+ __val: [::c_ulong; 16],
+ }
+
+ pub struct sysinfo { // ToDo
+ pub uptime: ::c_long,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub _f: [::c_char; 0],
+ }
+
+ pub struct glob_t { // ToDo
+ pub gl_pathc: ::size_t,
+ pub gl_pathv: *mut *mut c_char,
+ pub gl_offs: ::size_t,
+ pub gl_flags: ::c_int,
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ }
+
+ pub struct rlimit64 { // ToDo
+ pub rlim_cur: rlim64_t,
+ pub rlim_max: rlim64_t,
+ }
+
+ pub struct cpu_set_t { // ToDo
+ #[cfg(target_pointer_width = "32")]
+ bits: [u32; 32],
+ #[cfg(target_pointer_width = "64")]
+ bits: [u64; 16],
+ }
+
+ pub struct fsid_t { // ToDo
+ __val: [::c_int; 2],
+ }
+}
+
+// constants
+pub const EADDRINUSE: ::c_int = 98; // Address already in use
+pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
+pub const ECONNABORTED: ::c_int = 103; // Software caused connection abort
+pub const ECONNREFUSED: ::c_int = 111; // Connection refused
+pub const ECONNRESET: ::c_int = 104; // Connection reset by peer
+pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
+pub const ENOSYS: ::c_int = 38; // Function not implemented
+pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
+pub const ETIMEDOUT: ::c_int = 110; // connection timed out
+pub const O_APPEND: ::c_int = 02000;
+pub const O_ACCMODE: ::c_int = 0003;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_CREAT: ::c_int = 0100;
+pub const O_DIRECTORY: ::c_int = 0200000;
+pub const O_EXCL: ::c_int = 0200;
+pub const O_NONBLOCK: ::c_int = 04000;
+pub const O_TRUNC: ::c_int = 01000;
+pub const NCCS: usize = 32;
+pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals
+pub const PTHREAD_STACK_MIN: usize = 16384;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+extern {
+ pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+}
+
+cfg_if! {
+ if #[cfg(target_os = "l4re")] {
+ mod l4re;
+ pub use self::l4re::*;
+ } else { }
+}
+