aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/uclibc/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/uclibc/mod.rs')
-rw-r--r--libc/src/unix/uclibc/mod.rs893
1 files changed, 584 insertions, 309 deletions
diff --git a/libc/src/unix/uclibc/mod.rs b/libc/src/unix/uclibc/mod.rs
index e1eda9b..b4fe036 100644
--- a/libc/src/unix/uclibc/mod.rs
+++ b/libc/src/unix/uclibc/mod.rs
@@ -26,14 +26,18 @@ pub type idtype_t = ::c_uint;
pub enum fpos64_t {} // TODO: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
- fn clone(&self) -> fpos64_t { *self }
+ fn clone(&self) -> fpos64_t {
+ *self
+ }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
impl ::Clone for timezone {
- fn clone(&self) -> timezone { *self }
+ fn clone(&self) -> timezone {
+ *self
+ }
}
s! {
@@ -284,6 +288,12 @@ s! {
pub msgtql: ::c_int,
pub msgseg: ::c_ushort,
}
+
+ pub struct ucred {
+ pub pid: ::pid_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ }
}
s_no_extra_traits! {
@@ -738,6 +748,7 @@ pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers.
pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated.
pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol.
pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets.
+
// Not supported
pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets.
pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer.
@@ -745,6 +756,7 @@ pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer.
pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast.
pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type.
pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active.
+
// Dialup device with changing addresses.
pub const IFF_DYNAMIC: ::c_int = 0x8000;
@@ -885,6 +897,22 @@ pub const TCP_INFO: ::c_int = 11;
pub const TCP_QUICKACK: ::c_int = 12;
pub const TCP_CONGESTION: ::c_int = 13;
+// Source:
+// https://github.com/kraj/uClibc/blob/ca1c74d67dd115d059a875150e10b8560a9c35a8
+// /libc/sysdeps/linux/common/bits/in.h
+// Same for all architectures
+pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
+pub const IP_MULTICAST_IF: ::c_int = 32;
+pub const IPV6_MULTICAST_IF: ::c_int = 17;
+pub const IPV6_UNICAST_HOPS: ::c_int = 16;
+
+// Source:
+// https://github.com/kraj/uClibc/tree/ca1c74d67dd115d059a875150e10b8560a9c35a8
+// Same for all architectures
+pub const FUTEX_WAIT: ::c_int = 0;
+pub const FUTEX_PRIVATE_FLAG: ::c_int = 128;
+pub const FUTEX_WAKE: ::c_int = 1;
+
pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
pub const IPV6_V6ONLY: ::c_int = 26;
@@ -940,13 +968,13 @@ 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: ::tcflag_t = 0x00000000;
-pub const NL1: ::tcflag_t = 0x00000100;
+pub const NL0: ::tcflag_t = 0x00000000;
+pub const NL1: ::tcflag_t = 0x00000100;
pub const TAB0: ::tcflag_t = 0x00000000;
-pub const CR0: ::tcflag_t = 0x00000000;
-pub const FF0: ::tcflag_t = 0x00000000;
-pub const BS0: ::tcflag_t = 0x00000000;
-pub const VT0: ::tcflag_t = 0x00000000;
+pub const CR0: ::tcflag_t = 0x00000000;
+pub const FF0: ::tcflag_t = 0x00000000;
+pub const BS0: ::tcflag_t = 0x00000000;
+pub const VT0: ::tcflag_t = 0x00000000;
pub const VERASE: usize = 2;
pub const VKILL: usize = 3;
pub const VINTR: usize = 0;
@@ -1571,17 +1599,20 @@ f! {
}
}
-extern {
- #[cfg_attr(target_os = "linux",
- link_name = "__xpg_strerror_r")]
- pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
- buflen: ::size_t) -> ::c_int;
+extern "C" {
+ #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
+ pub fn strerror_r(
+ errnum: ::c_int,
+ buf: *mut c_char,
+ buflen: ::size_t,
+ ) -> ::c_int;
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
- pub fn sem_init(sem: *mut sem_t,
- pshared: ::c_int,
- value: ::c_uint)
- -> ::c_int;
+ pub fn sem_init(
+ sem: *mut sem_t,
+ pshared: ::c_int,
+ value: ::c_uint,
+ ) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -1590,173 +1621,278 @@ extern {
pub fn srand(seed: ::c_uint);
pub fn fdatasync(fd: ::c_int) -> ::c_int;
- pub fn gettimeofday(tp: *mut ::timeval,
- tz: *mut ::timezone) -> ::c_int;
- pub fn mincore(addr: *mut ::c_void, len: ::size_t,
- vec: *mut ::c_uchar) -> ::c_int;
+ pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::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,
- 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_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 prctl(option: ::c_int, ...) -> ::c_int;
- pub fn pthread_getattr_np(native: ::pthread_t,
- attr: *mut ::pthread_attr_t) -> ::c_int;
- pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
- guardsize: *mut ::size_t) -> ::c_int;
- pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
- stackaddr: *mut *mut ::c_void,
- stacksize: *mut ::size_t) -> ::c_int;
+ pub fn pthread_getattr_np(
+ native: ::pthread_t,
+ attr: *mut ::pthread_attr_t,
+ ) -> ::c_int;
+ pub fn pthread_attr_getguardsize(
+ attr: *const ::pthread_attr_t,
+ guardsize: *mut ::size_t,
+ ) -> ::c_int;
+ pub fn pthread_attr_getstack(
+ attr: *const ::pthread_attr_t,
+ stackaddr: *mut *mut ::c_void,
+ stacksize: *mut ::size_t,
+ ) -> ::c_int;
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
- pub fn setgroups(ngroups: ::size_t,
- ptr: *const ::gid_t) -> ::c_int;
+ pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
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;
+ pub fn sched_setscheduler(
+ pid: ::pid_t,
+ policy: ::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;
pub fn epoll_create(size: ::c_int) -> ::c_int;
pub fn epoll_create1(flags: ::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 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 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 clone(
+ cb: extern "C" 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;
- pub fn memrchr(cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t) -> *mut ::c_void;
+ pub fn memrchr(
+ cx: *const ::c_void,
+ c: ::c_int,
+ n: ::size_t,
+ ) -> *mut ::c_void;
pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sendfile(out_fd: ::c_int,
- in_fd: ::c_int,
- offset: *mut off_t,
- count: ::size_t) -> ::ssize_t;
- pub fn splice(fd_in: ::c_int,
- off_in: *mut ::loff_t,
- fd_out: ::c_int,
- off_out: *mut ::loff_t,
- len: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
- pub fn tee(fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
- pub fn vmsplice(fd: ::c_int,
- iov: *const ::iovec,
- nr_segs: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
-
- pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
- advise: ::c_int) -> ::c_int;
+ pub fn sendfile(
+ out_fd: ::c_int,
+ in_fd: ::c_int,
+ offset: *mut off_t,
+ count: ::size_t,
+ ) -> ::ssize_t;
+ pub fn splice(
+ fd_in: ::c_int,
+ off_in: *mut ::loff_t,
+ fd_out: ::c_int,
+ off_out: *mut ::loff_t,
+ len: ::size_t,
+ flags: ::c_uint,
+ ) -> ::ssize_t;
+ pub fn tee(
+ fd_in: ::c_int,
+ fd_out: ::c_int,
+ len: ::size_t,
+ flags: ::c_uint,
+ ) -> ::ssize_t;
+ pub fn vmsplice(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ nr_segs: ::size_t,
+ flags: ::c_uint,
+ ) -> ::ssize_t;
+
+ pub fn posix_fadvise(
+ fd: ::c_int,
+ offset: ::off_t,
+ len: ::off_t,
+ advise: ::c_int,
+ ) -> ::c_int;
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
- pub fn utimensat(dirfd: ::c_int, path: *const ::c_char,
- times: *const ::timespec, flag: ::c_int) -> ::c_int;
+ pub fn utimensat(
+ dirfd: ::c_int,
+ path: *const ::c_char,
+ times: *const ::timespec,
+ flag: ::c_int,
+ ) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t) -> ::locale_t;
+ pub fn newlocale(
+ mask: ::c_int,
+ locale: *const ::c_char,
+ base: ::locale_t,
+ ) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
- pub fn fstatat64(fildes: ::c_int, path: *const ::c_char,
- buf: *mut stat64, flag: ::c_int) -> ::c_int;
+ pub fn fstatat64(
+ fildes: ::c_int,
+ path: *const ::c_char,
+ buf: *mut stat64,
+ flag: ::c_int,
+ ) -> ::c_int;
pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
- pub fn mmap64(addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- flags: ::c_int,
- fd: ::c_int,
- offset: off64_t)
- -> *mut ::c_void;
+ pub fn mmap64(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ prot: ::c_int,
+ flags: ::c_int,
+ fd: ::c_int,
+ 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 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 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 mknodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn ppoll(fds: *mut ::pollfd,
- nfds: nfds_t,
- timeout: *const ::timespec,
- sigmask: *const sigset_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,
- 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,
- pshared: *mut ::c_int) -> ::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 mknodat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ dev: dev_t,
+ ) -> ::c_int;
+ pub fn ppoll(
+ fds: *mut ::pollfd,
+ nfds: nfds_t,
+ timeout: *const ::timespec,
+ sigmask: *const sigset_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,
+ 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,
+ pshared: *mut ::c_int,
+ ) -> ::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 unshare(flags: ::c_int) -> ::c_int;
- pub fn sem_timedwait(sem: *mut sem_t,
- abstime: *const ::timespec) -> ::c_int;
- pub fn sem_getvalue(sem: *mut sem_t,
- sval: *mut ::c_int) -> ::c_int;
- pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
- flg: ::c_int) -> ::c_int;
- pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
- abstime: *const ::timespec) -> ::c_int;
- pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
- 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;
+ pub fn sem_timedwait(
+ sem: *mut sem_t,
+ abstime: *const ::timespec,
+ ) -> ::c_int;
+ pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int,
+ ) -> ::c_int;
+ pub fn pthread_mutex_timedlock(
+ lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec,
+ ) -> ::c_int;
+ pub fn pthread_mutexattr_setpshared(
+ attr: *mut pthread_mutexattr_t,
+ 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;
pub fn clearenv() -> ::c_int;
- pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
- options: ::c_int) -> ::c_int;
+ pub fn waitid(
+ idtype: idtype_t,
+ id: id_t,
+ infop: *mut ::siginfo_t,
+ options: ::c_int,
+ ) -> ::c_int;
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
@@ -1768,107 +1904,190 @@ extern {
pub fn getspent() -> *mut spwd;
pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
- pub fn shm_open(name: *const c_char, oflag: ::c_int,
- mode: mode_t) -> ::c_int;
+ pub fn shm_open(
+ name: *const c_char,
+ oflag: ::c_int,
+ mode: mode_t,
+ ) -> ::c_int;
// System V IPC
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 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 shmctl(
+ shmid: ::c_int,
+ cmd: ::c_int,
+ buf: *mut ::shmid_ds,
+ ) -> ::c_int;
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
- pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_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) -> ::ssize_t;
- pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
- msgflg: ::c_int) -> ::c_int;
-
- pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
- -> ::c_int;
+ pub fn msgrcv(
+ msqid: ::c_int,
+ msgp: *mut ::c_void,
+ msgsz: ::size_t,
+ msgtyp: ::c_long,
+ msgflg: ::c_int,
+ ) -> ::ssize_t;
+ pub fn msgsnd(
+ msqid: ::c_int,
+ msgp: *const ::c_void,
+ msgsz: ::size_t,
+ msgflg: ::c_int,
+ ) -> ::c_int;
+
+ pub fn mprotect(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ prot: ::c_int,
+ ) -> ::c_int;
pub fn __errno_location() -> *mut ::c_int;
- pub fn fopen64(filename: *const c_char,
- mode: *const c_char) -> *mut ::FILE;
- pub fn freopen64(filename: *const c_char, mode: *const c_char,
- file: *mut ::FILE) -> *mut ::FILE;
+ pub fn fopen64(
+ filename: *const c_char,
+ mode: *const c_char,
+ ) -> *mut ::FILE;
+ pub fn freopen64(
+ filename: *const c_char,
+ mode: *const c_char,
+ file: *mut ::FILE,
+ ) -> *mut ::FILE;
pub fn tmpfile64() -> *mut ::FILE;
pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
- pub fn fseeko64(stream: *mut ::FILE,
- offset: ::off64_t,
- whence: ::c_int) -> ::c_int;
+ pub fn fseeko64(
+ stream: *mut ::FILE,
+ offset: ::off64_t,
+ whence: ::c_int,
+ ) -> ::c_int;
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
- pub fn readahead(fd: ::c_int, offset: ::off64_t,
- count: ::size_t) -> ::ssize_t;
- pub fn getxattr(path: *const c_char, name: *const c_char,
- value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
- pub fn lgetxattr(path: *const c_char, name: *const c_char,
- value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
- pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
- value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
- pub fn setxattr(path: *const c_char, name: *const c_char,
- value: *const ::c_void, size: ::size_t,
- flags: ::c_int) -> ::c_int;
- pub fn lsetxattr(path: *const c_char, name: *const c_char,
- value: *const ::c_void, size: ::size_t,
- flags: ::c_int) -> ::c_int;
- pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
- value: *const ::c_void, size: ::size_t,
- flags: ::c_int) -> ::c_int;
- pub fn listxattr(path: *const c_char, list: *mut c_char,
- size: ::size_t) -> ::ssize_t;
- pub fn llistxattr(path: *const c_char, list: *mut c_char,
- size: ::size_t) -> ::ssize_t;
- pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
- size: ::size_t) -> ::ssize_t;
+ pub fn readahead(
+ fd: ::c_int,
+ offset: ::off64_t,
+ count: ::size_t,
+ ) -> ::ssize_t;
+ pub fn getxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn lgetxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn fgetxattr(
+ filedes: ::c_int,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn setxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn lsetxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn fsetxattr(
+ filedes: ::c_int,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn listxattr(
+ path: *const c_char,
+ list: *mut c_char,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn llistxattr(
+ path: *const c_char,
+ list: *mut c_char,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn flistxattr(
+ filedes: ::c_int,
+ list: *mut c_char,
+ size: ::size_t,
+ ) -> ::ssize_t;
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 quotactl(cmd: ::c_int,
- special: *const ::c_char,
- id: ::c_int,
- data: *mut ::c_char) -> ::c_int;
+ pub fn signalfd(
+ fd: ::c_int,
+ mask: *const ::sigset_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ 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_receive(
+ mqd: ::mqd_t,
+ msg_ptr: *mut ::c_char,
+ msg_len: ::size_t,
+ msg_prio: *mut ::c_uint,
+ ) -> ::ssize_t;
+ pub fn mq_send(
+ mqd: ::mqd_t,
+ msg_ptr: *const ::c_char,
+ msg_len: ::size_t,
+ msg_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 epoll_pwait(epfd: ::c_int,
- events: *mut ::epoll_event,
- maxevents: ::c_int,
- timeout: ::c_int,
- sigmask: *const ::sigset_t) -> ::c_int;
+ pub fn mq_setattr(
+ mqd: ::mqd_t,
+ newattr: *const ::mq_attr,
+ oldattr: *mut ::mq_attr,
+ ) -> ::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 sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
- pub fn sigtimedwait(set: *const sigset_t,
- info: *mut siginfo_t,
- timeout: *const ::timespec) -> ::c_int;
- pub fn sigwaitinfo(set: *const sigset_t,
- info: *mut siginfo_t) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
- pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
- old_limit: *mut ::rlimit) -> ::c_int;
- pub fn prlimit64(pid: ::pid_t,
- resource: ::c_int,
- new_limit: *const ::rlimit64,
- old_limit: *mut ::rlimit64) -> ::c_int;
+ pub fn sigtimedwait(
+ set: *const sigset_t,
+ info: *mut siginfo_t,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
+ -> *mut ::c_char;
+ pub fn prlimit(
+ pid: ::pid_t,
+ resource: ::c_int,
+ new_limit: *const ::rlimit,
+ old_limit: *mut ::rlimit,
+ ) -> ::c_int;
+ pub fn prlimit64(
+ pid: ::pid_t,
+ resource: ::c_int,
+ new_limit: *const ::rlimit64,
+ old_limit: *mut ::rlimit64,
+ ) -> ::c_int;
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
@@ -1876,26 +2095,38 @@ extern {
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
// Not available now on Android
- pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ pub fn mkfifoat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ ) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
- pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
- nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
+ pub fn sync_file_range(
+ fd: ::c_int,
+ offset: ::off64_t,
+ nbytes: ::off64_t,
+ flags: ::c_uint,
+ ) -> ::c_int;
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
- pub fn mremap(addr: *mut ::c_void,
- len: ::size_t,
- new_len: ::size_t,
- flags: ::c_int,
- ...) -> *mut ::c_void;
-
- pub fn glob(pattern: *const c_char,
- flags: ::c_int,
- errfunc: ::Option<extern fn(epath: *const c_char,
- errno: ::c_int) -> ::c_int>,
- pglob: *mut ::glob_t) -> ::c_int;
+ pub fn mremap(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ new_len: ::size_t,
+ flags: ::c_int,
+ ...
+ ) -> *mut ::c_void;
+
+ pub fn glob(
+ pattern: *const c_char,
+ flags: ::c_int,
+ errfunc: ::Option<
+ extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
+ >,
+ pglob: *mut ::glob_t,
+ ) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
@@ -1905,54 +2136,88 @@ extern {
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
- -> ::c_int;
-
- pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
-
- pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
- flags: ::c_int, addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t) -> ::ssize_t;
+ pub fn madvise(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ advice: ::c_int,
+ ) -> ::c_int;
+
+ pub fn msync(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+
+ pub fn recvfrom(
+ socket: ::c_int,
+ buf: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ addr: *mut ::sockaddr,
+ addrlen: *mut ::socklen_t,
+ ) -> ::ssize_t;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
- pub fn bind(socket: ::c_int, address: *const ::sockaddr,
- address_len: ::socklen_t) -> ::c_int;
-
- pub fn writev(fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int) -> ::ssize_t;
- pub fn readv(fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int) -> ::ssize_t;
-
- pub fn sendmsg(fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int) -> ::ssize_t;
- pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
- -> ::ssize_t;
+ pub fn bind(
+ socket: ::c_int,
+ address: *const ::sockaddr,
+ address_len: ::socklen_t,
+ ) -> ::c_int;
+
+ pub fn writev(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ ) -> ::ssize_t;
+ pub fn readv(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ ) -> ::ssize_t;
+
+ pub fn sendmsg(
+ fd: ::c_int,
+ msg: *const ::msghdr,
+ 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(gid: ::gid_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")]
+ pub fn getgrgid_r(
+ gid: ::gid_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 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 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;
@@ -1960,35 +2225,45 @@ extern {
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;
+ 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")]
+ 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 pthread_create(native: *mut ::pthread_t,
- attr: *const ::pthread_attr_t,
- f: extern fn(*mut ::c_void) -> *mut ::c_void,
- value: *mut ::c_void) -> ::c_int;
+ pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(
+ prepare: ::Option<unsafe extern "C" fn()>,
+ parent: ::Option<unsafe extern "C" fn()>,
+ child: ::Option<unsafe extern "C" fn()>,
+ ) -> ::c_int;
+ pub fn pthread_create(
+ native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void,
+ ) -> ::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_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;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
}