summaryrefslogtreecommitdiff
path: root/libc/src/unix/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/mod.rs')
-rw-r--r--libc/src/unix/mod.rs1040
1 files changed, 686 insertions, 354 deletions
diff --git a/libc/src/unix/mod.rs b/libc/src/unix/mod.rs
index 721d241..238da24 100644
--- a/libc/src/unix/mod.rs
+++ b/libc/src/unix/mod.rs
@@ -34,9 +34,11 @@ pub type cc_t = ::c_uchar;
pub enum DIR {}
impl ::Copy for DIR {}
impl ::Clone for DIR {
- fn clone(&self) -> DIR { *self }
+ fn clone(&self) -> DIR {
+ *self
+ }
}
-pub type locale_t = *mut :: c_void;
+pub type locale_t = *mut ::c_void;
s! {
pub struct group {
@@ -358,16 +360,20 @@ cfg_if! {
pub enum FILE {}
impl ::Copy for FILE {}
impl ::Clone for FILE {
- fn clone(&self) -> FILE { *self }
+ fn clone(&self) -> FILE {
+ *self
+ }
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // TODO: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
- fn clone(&self) -> fpos_t { *self }
+ fn clone(&self) -> fpos_t {
+ *self
+ }
}
-extern {
+extern "C" {
pub fn isalnum(c: c_int) -> c_int;
pub fn isalpha(c: c_int) -> c_int;
pub fn iscntrl(c: c_int) -> c_int;
@@ -379,6 +385,7 @@ extern {
pub fn isspace(c: c_int) -> c_int;
pub fn isupper(c: c_int) -> c_int;
pub fn isxdigit(c: c_int) -> c_int;
+ pub fn isblank(c: c_int) -> c_int;
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
#[cfg_attr(
@@ -390,20 +397,28 @@ extern {
all(target_os = "macos", target_arch = "x86"),
link_name = "freopen$UNIX2003"
)]
- pub fn freopen(filename: *const c_char, mode: *const c_char,
- file: *mut FILE) -> *mut FILE;
+ pub fn freopen(
+ filename: *const c_char,
+ mode: *const c_char,
+ file: *mut FILE,
+ ) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int,
- size: size_t) -> c_int;
+ pub fn setvbuf(
+ stream: *mut FILE,
+ buffer: *mut c_char,
+ mode: c_int,
+ size: size_t,
+ ) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
+ -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
@@ -412,14 +427,22 @@ extern {
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t,
- stream: *mut FILE) -> size_t;
+ pub fn fread(
+ ptr: *mut c_void,
+ size: size_t,
+ nobj: size_t,
+ stream: *mut FILE,
+ ) -> size_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fwrite$UNIX2003"
)]
- pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t,
- stream: *mut FILE) -> size_t;
+ pub fn fwrite(
+ ptr: *const c_void,
+ size: size_t,
+ nobj: size_t,
+ stream: *mut FILE,
+ ) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -436,10 +459,16 @@ extern {
link_name = "strtod$UNIX2003"
)]
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(s: *const c_char, endp: *mut *mut c_char,
- base: c_int) -> c_long;
- pub fn strtoul(s: *const c_char, endp: *mut *mut c_char,
- base: c_int) -> c_ulong;
+ pub fn strtol(
+ s: *const c_char,
+ endp: *mut *mut c_char,
+ base: c_int,
+ ) -> c_long;
+ pub fn strtoul(
+ s: *const c_char,
+ endp: *mut *mut c_char,
+ base: c_int,
+ ) -> c_ulong;
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
pub fn malloc(size: size_t) -> *mut c_void;
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
@@ -447,7 +476,7 @@ extern {
pub fn abort() -> !;
pub fn exit(status: c_int) -> !;
pub fn _exit(status: c_int) -> !;
- pub fn atexit(cb: extern fn()) -> c_int;
+ pub fn atexit(cb: extern "C" fn()) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "system$UNIX2003"
@@ -456,11 +485,17 @@ extern {
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(dst: *mut c_char, src: *const c_char,
- n: size_t) -> *mut c_char;
+ pub fn strncpy(
+ dst: *mut c_char,
+ src: *const c_char,
+ n: size_t,
+ ) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(s: *mut c_char, ct: *const c_char,
- n: size_t) -> *mut c_char;
+ pub fn strncat(
+ s: *mut c_char,
+ ct: *const c_char,
+ n: size_t,
+ ) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -472,8 +507,11 @@ extern {
pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(s1: *const c_char, s2: *const c_char,
- n: size_t) -> c_int;
+ pub fn strncasecmp(
+ s1: *const c_char,
+ s2: *const c_char,
+ n: size_t,
+ ) -> c_int;
pub fn strlen(cs: *const c_char) -> size_t;
pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
#[cfg_attr(
@@ -484,90 +522,154 @@ extern {
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(dest: *mut c_char, src: *const wchar_t,
- n: size_t) -> ::size_t;
+ pub fn wcstombs(
+ dest: *mut c_char,
+ src: *const wchar_t,
+ n: size_t,
+ ) -> ::size_t;
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
- pub fn memcpy(dest: *mut c_void, src: *const c_void,
- n: size_t) -> *mut c_void;
- pub fn memmove(dest: *mut c_void, src: *const c_void,
- n: size_t) -> *mut c_void;
+ pub fn memcpy(
+ dest: *mut c_void,
+ src: *const c_void,
+ n: size_t,
+ ) -> *mut c_void;
+ pub fn memmove(
+ dest: *mut c_void,
+ src: *const c_void,
+ n: size_t,
+ ) -> *mut c_void;
pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
}
-extern {
+extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
- pub fn fprintf(stream: *mut ::FILE,
- format: *const ::c_char, ...) -> ::c_int;
+ pub fn fprintf(
+ stream: *mut ::FILE,
+ format: *const ::c_char,
+ ...
+ ) -> ::c_int;
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
- pub fn snprintf(s: *mut ::c_char, n: ::size_t,
- format: *const ::c_char, ...) -> ::c_int;
+ pub fn snprintf(
+ s: *mut ::c_char,
+ n: ::size_t,
+ format: *const ::c_char,
+ ...
+ ) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
#[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
- pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
+ pub fn fscanf(
+ stream: *mut ::FILE,
+ format: *const ::c_char,
+ ...
+ ) -> ::c_int;
#[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
#[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
- pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
+ pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
+ -> ::c_int;
pub fn getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "connect$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "connect$UNIX2003"
+ )]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
- pub fn connect(socket: ::c_int, address: *const sockaddr,
- len: socklen_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "listen$UNIX2003")]
+ pub fn connect(
+ socket: ::c_int,
+ address: *const sockaddr,
+ len: socklen_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "listen$UNIX2003"
+ )]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_listen")]
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "accept$UNIX2003")]
- pub fn accept(socket: ::c_int, address: *mut sockaddr,
- address_len: *mut socklen_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "getpeername$UNIX2003")]
- pub fn getpeername(socket: ::c_int, address: *mut sockaddr,
- address_len: *mut socklen_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "getsockname$UNIX2003")]
- pub fn getsockname(socket: ::c_int, address: *mut sockaddr,
- address_len: *mut socklen_t) -> ::c_int;
- pub fn setsockopt(socket: ::c_int, level: ::c_int, name: ::c_int,
- value: *const ::c_void,
- option_len: socklen_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "socketpair$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "accept$UNIX2003"
+ )]
+ pub fn accept(
+ socket: ::c_int,
+ address: *mut sockaddr,
+ address_len: *mut socklen_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "getpeername$UNIX2003"
+ )]
+ pub fn getpeername(
+ socket: ::c_int,
+ address: *mut sockaddr,
+ address_len: *mut socklen_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "getsockname$UNIX2003"
+ )]
+ pub fn getsockname(
+ socket: ::c_int,
+ address: *mut sockaddr,
+ address_len: *mut socklen_t,
+ ) -> ::c_int;
+ pub fn setsockopt(
+ socket: ::c_int,
+ level: ::c_int,
+ name: ::c_int,
+ value: *const ::c_void,
+ option_len: socklen_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "socketpair$UNIX2003"
+ )]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")]
- pub fn socketpair(domain: ::c_int, type_: ::c_int, protocol: ::c_int,
- socket_vector: *mut ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "sendto$UNIX2003")]
+ pub fn socketpair(
+ domain: ::c_int,
+ type_: ::c_int,
+ protocol: ::c_int,
+ socket_vector: *mut ::c_int,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "sendto$UNIX2003"
+ )]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")]
- pub fn sendto(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
- flags: ::c_int, addr: *const sockaddr,
- addrlen: socklen_t) -> ::ssize_t;
+ pub fn sendto(
+ socket: ::c_int,
+ buf: *const ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ addr: *const sockaddr,
+ addrlen: socklen_t,
+ ) -> ::ssize_t;
pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "chmod$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "chmod$UNIX2003"
+ )]
pub fn chmod(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "fchmod$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "fchmod$UNIX2003"
+ )]
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "fstat@FBSD_1.0"
)]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
@@ -577,119 +679,173 @@ extern {
#[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "stat@FBSD_1.0"
)]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
pub fn pclose(stream: *mut ::FILE) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "fdopen$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "fdopen$UNIX2003"
+ )]
pub fn fdopen(fd: ::c_int, mode: *const c_char) -> *mut ::FILE;
pub fn fileno(stream: *mut ::FILE) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "open$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "open$UNIX2003"
+ )]
pub fn open(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "creat$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "creat$UNIX2003"
+ )]
pub fn creat(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "fcntl$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "fcntl$UNIX2003"
+ )]
pub fn fcntl(fd: ::c_int, cmd: ::c_int, ...) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
- link_name = "opendir$INODE64")]
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "opendir$INODE64$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "opendir$INODE64"
+ )]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "opendir$INODE64$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
#[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "readdir@FBSD_1.0"
)]
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "closedir$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "closedir$UNIX2003"
+ )]
pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
- link_name = "rewinddir$INODE64")]
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "rewinddir$INODE64$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "rewinddir$INODE64"
+ )]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "rewinddir$INODE64$UNIX2003"
+ )]
pub fn rewinddir(dirp: *mut ::DIR);
- pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t, flags: ::c_int) -> ::c_int;
- pub fn fchown(fd: ::c_int,
- owner: ::uid_t,
- group: ::gid_t) -> ::c_int;
- pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
- owner: ::uid_t, group: ::gid_t,
- flags: ::c_int) -> ::c_int;
+ pub fn fchmodat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn fchown(fd: ::c_int, owner: ::uid_t, group: ::gid_t) -> ::c_int;
+ pub fn fchownat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ owner: ::uid_t,
+ group: ::gid_t,
+ flags: ::c_int,
+ ) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "fstatat@FBSD_1.1"
)]
- pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
- buf: *mut stat, flags: ::c_int) -> ::c_int;
- pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char,
- flags: ::c_int) -> ::c_int;
- pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
- newdirfd: ::c_int, newpath: *const ::c_char)
- -> ::c_int;
- pub fn symlinkat(target: *const ::c_char, newdirfd: ::c_int,
- linkpath: *const ::c_char) -> ::c_int;
- pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char,
- flags: ::c_int) -> ::c_int;
+ pub fn fstatat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ buf: *mut stat,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn linkat(
+ olddirfd: ::c_int,
+ oldpath: *const ::c_char,
+ newdirfd: ::c_int,
+ newpath: *const ::c_char,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn renameat(
+ olddirfd: ::c_int,
+ oldpath: *const ::c_char,
+ newdirfd: ::c_int,
+ newpath: *const ::c_char,
+ ) -> ::c_int;
+ pub fn symlinkat(
+ target: *const ::c_char,
+ newdirfd: ::c_int,
+ linkpath: *const ::c_char,
+ ) -> ::c_int;
+ pub fn unlinkat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ flags: ::c_int,
+ ) -> ::c_int;
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
pub fn alarm(seconds: ::c_uint) -> ::c_uint;
pub fn chdir(dir: *const c_char) -> ::c_int;
pub fn fchdir(dirfd: ::c_int) -> ::c_int;
- pub fn chown(path: *const c_char, uid: uid_t,
- gid: gid_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "lchown$UNIX2003")]
- pub fn lchown(path: *const c_char, uid: uid_t,
- gid: gid_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "close$NOCANCEL$UNIX2003")]
- #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
- link_name = "close$NOCANCEL")]
+ pub fn chown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "lchown$UNIX2003"
+ )]
+ pub fn lchown(path: *const c_char, uid: uid_t, gid: gid_t) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "close$NOCANCEL$UNIX2003"
+ )]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "close$NOCANCEL"
+ )]
pub fn close(fd: ::c_int) -> ::c_int;
pub fn dup(fd: ::c_int) -> ::c_int;
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
- pub fn execl(path: *const c_char,
- arg0: *const c_char, ...) -> ::c_int;
- pub fn execle(path: *const ::c_char,
- arg0: *const ::c_char, ...) -> ::c_int;
- pub fn execlp(file: *const ::c_char,
- arg0: *const ::c_char, ...) -> ::c_int;
- pub fn execv(prog: *const c_char,
- argv: *const *const c_char) -> ::c_int;
- pub fn execve(prog: *const c_char, argv: *const *const c_char,
- envp: *const *const c_char)
- -> ::c_int;
- pub fn execvp(c: *const c_char,
- argv: *const *const c_char) -> ::c_int;
+ pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
+ pub fn execle(
+ path: *const ::c_char,
+ arg0: *const ::c_char,
+ ...
+ ) -> ::c_int;
+ pub fn execlp(
+ file: *const ::c_char,
+ arg0: *const ::c_char,
+ ...
+ ) -> ::c_int;
+ pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
+ pub fn execve(
+ prog: *const c_char,
+ argv: *const *const c_char,
+ envp: *const *const c_char,
+ ) -> ::c_int;
+ pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn fork() -> pid_t;
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char;
pub fn getegid() -> gid_t;
pub fn geteuid() -> uid_t;
pub fn getgid() -> gid_t;
- pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t)
- -> ::c_int;
+ pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
pub fn getlogin() -> *mut c_char;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "getopt$UNIX2003")]
- pub fn getopt(argc: ::c_int, argv: *const *mut c_char,
- optstr: *const c_char) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "getopt$UNIX2003"
+ )]
+ pub fn getopt(
+ argc: ::c_int,
+ argv: *const *mut c_char,
+ optstr: *const c_char,
+ ) -> ::c_int;
pub fn getpgid(pid: pid_t) -> pid_t;
pub fn getpgrp() -> pid_t;
pub fn getpid() -> pid_t;
@@ -700,13 +856,17 @@ extern {
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pub fn pipe(fds: *mut ::c_int) -> ::c_int;
- pub fn posix_memalign(memptr: *mut *mut ::c_void,
- align: ::size_t,
- size: ::size_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "read$UNIX2003")]
+ pub fn posix_memalign(
+ memptr: *mut *mut ::c_void,
+ align: ::size_t,
+ size: ::size_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "read$UNIX2003"
+ )]
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
- -> ::ssize_t;
+ -> ::ssize_t;
pub fn rmdir(path: *const c_char) -> ::c_int;
pub fn seteuid(uid: uid_t) -> ::c_int;
pub fn setegid(gid: gid_t) -> ::c_int;
@@ -714,51 +874,87 @@ extern {
pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
pub fn setsid() -> pid_t;
pub fn setuid(uid: uid_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "sleep$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "sleep$UNIX2003"
+ )]
pub fn sleep(secs: ::c_uint) -> ::c_uint;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "nanosleep$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "nanosleep$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
- pub fn nanosleep(rqtp: *const timespec,
- rmtp: *mut timespec) -> ::c_int;
+ pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
pub fn tcgetpgrp(fd: ::c_int) -> pid_t;
pub fn tcsetpgrp(fd: ::c_int, pgrp: ::pid_t) -> ::c_int;
pub fn ttyname(fd: ::c_int) -> *mut c_char;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "ttyname_r$UNIX2003")]
- pub fn ttyname_r(fd: ::c_int,
- buf: *mut c_char, buflen: ::size_t) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "ttyname_r$UNIX2003"
+ )]
+ pub fn ttyname_r(
+ fd: ::c_int,
+ buf: *mut c_char,
+ buflen: ::size_t,
+ ) -> ::c_int;
pub fn unlink(c: *const c_char) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "wait$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "wait$UNIX2003"
+ )]
pub fn wait(status: *mut ::c_int) -> pid_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "waitpid$UNIX2003")]
- pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int)
- -> pid_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "write$UNIX2003")]
- pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
- -> ::ssize_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pread$UNIX2003")]
- pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t,
- offset: off_t) -> ::ssize_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pwrite$UNIX2003")]
- pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t,
- offset: off_t) -> ::ssize_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "waitpid$UNIX2003"
+ )]
+ pub fn waitpid(
+ pid: pid_t,
+ status: *mut ::c_int,
+ options: ::c_int,
+ ) -> pid_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "write$UNIX2003"
+ )]
+ pub fn write(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ ) -> ::ssize_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pread$UNIX2003"
+ )]
+ pub fn pread(
+ fd: ::c_int,
+ buf: *mut ::c_void,
+ count: ::size_t,
+ offset: off_t,
+ ) -> ::ssize_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pwrite$UNIX2003"
+ )]
+ pub fn pwrite(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ offset: off_t,
+ ) -> ::ssize_t;
pub fn umask(mask: mode_t) -> mode_t;
#[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "kill$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "kill$UNIX2003"
+ )]
pub fn kill(pid: pid_t, sig: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "killpg$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "killpg$UNIX2003"
+ )]
pub fn killpg(pgrp: pid_t, sig: ::c_int) -> ::c_int;
pub fn mlock(addr: *const ::c_void, len: ::size_t) -> ::c_int;
@@ -766,46 +962,61 @@ extern {
pub fn mlockall(flags: ::c_int) -> ::c_int;
pub fn munlockall() -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "mmap$UNIX2003")]
- pub fn mmap(addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- flags: ::c_int,
- fd: ::c_int,
- offset: off_t)
- -> *mut ::c_void;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "munmap$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "mmap$UNIX2003"
+ )]
+ pub fn mmap(
+ addr: *mut ::c_void,
+ len: ::size_t,
+ prot: ::c_int,
+ flags: ::c_int,
+ fd: ::c_int,
+ offset: off_t,
+ ) -> *mut ::c_void;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "munmap$UNIX2003"
+ )]
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
- pub fn if_indextoname(ifindex: ::c_uint,
- ifname: *mut ::c_char) -> *mut ::c_char;
+ pub fn if_indextoname(
+ ifindex: ::c_uint,
+ ifname: *mut ::c_char,
+ ) -> *mut ::c_char;
#[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "lstat@FBSD_1.0"
)]
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "fsync$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "fsync$UNIX2003"
+ )]
pub fn fsync(fd: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "setenv$UNIX2003")]
- pub fn setenv(name: *const c_char, val: *const c_char,
- overwrite: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "unsetenv$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "setenv$UNIX2003"
+ )]
+ pub fn setenv(
+ name: *const c_char,
+ val: *const c_char,
+ overwrite: ::c_int,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "unsetenv$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__unsetenv13")]
pub fn unsetenv(name: *const c_char) -> ::c_int;
- pub fn symlink(path1: *const c_char,
- path2: *const c_char) -> ::c_int;
+ pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
@@ -814,10 +1025,14 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
- #[cfg_attr(any(target_os = "macos", target_os = "ios"),
- link_name = "realpath$DARWIN_EXTSN")]
- pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
- -> *mut ::c_char;
+ #[cfg_attr(
+ any(target_os = "macos", target_os = "ios"),
+ link_name = "realpath$DARWIN_EXTSN"
+ )]
+ pub fn realpath(
+ pathname: *const ::c_char,
+ resolved: *mut ::c_char,
+ ) -> *mut ::c_char;
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
@@ -825,130 +1040,195 @@ extern {
pub fn times(buf: *mut ::tms) -> ::clock_t;
pub fn pthread_self() -> ::pthread_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_join$UNIX2003")]
- pub fn pthread_join(native: ::pthread_t,
- value: *mut *mut ::c_void) -> ::c_int;
- pub fn pthread_exit(value: *mut ::c_void);
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_join$UNIX2003"
+ )]
+ pub fn pthread_join(
+ native: ::pthread_t,
+ value: *mut *mut ::c_void,
+ ) -> ::c_int;
+ pub fn pthread_exit(value: *mut ::c_void) -> !;
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
- pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t,
- stack_size: ::size_t) -> ::c_int;
- pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t,
- state: ::c_int) -> ::c_int;
+ pub fn pthread_attr_setstacksize(
+ attr: *mut ::pthread_attr_t,
+ stack_size: ::size_t,
+ ) -> ::c_int;
+ pub fn pthread_attr_setdetachstate(
+ attr: *mut ::pthread_attr_t,
+ state: ::c_int,
+ ) -> ::c_int;
pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
pub fn sched_yield() -> ::c_int;
- pub fn pthread_key_create(key: *mut pthread_key_t,
- dtor: ::Option<unsafe extern fn(*mut ::c_void)>)
- -> ::c_int;
+ pub fn pthread_key_create(
+ key: *mut pthread_key_t,
+ dtor: ::Option<unsafe extern "C" fn(*mut ::c_void)>,
+ ) -> ::c_int;
pub fn pthread_key_delete(key: pthread_key_t) -> ::c_int;
pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
- pub fn pthread_setspecific(key: pthread_key_t, value: *const ::c_void)
- -> ::c_int;
- pub fn pthread_mutex_init(lock: *mut pthread_mutex_t,
- attr: *const pthread_mutexattr_t) -> ::c_int;
+ pub fn pthread_setspecific(
+ key: pthread_key_t,
+ value: *const ::c_void,
+ ) -> ::c_int;
+ pub fn pthread_mutex_init(
+ lock: *mut pthread_mutex_t,
+ attr: *const pthread_mutexattr_t,
+ ) -> ::c_int;
pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_mutexattr_destroy$UNIX2003")]
- pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
- pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t,
- _type: ::c_int) -> ::c_int;
-
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_cond_init$UNIX2003")]
- pub fn pthread_cond_init(cond: *mut pthread_cond_t,
- attr: *const pthread_condattr_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_cond_wait$UNIX2003")]
- pub fn pthread_cond_wait(cond: *mut pthread_cond_t,
- lock: *mut pthread_mutex_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_cond_timedwait$UNIX2003")]
- pub fn pthread_cond_timedwait(cond: *mut pthread_cond_t,
- lock: *mut pthread_mutex_t,
- abstime: *const ::timespec) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_mutexattr_destroy$UNIX2003"
+ )]
+ pub fn pthread_mutexattr_destroy(
+ attr: *mut pthread_mutexattr_t,
+ ) -> ::c_int;
+ pub fn pthread_mutexattr_settype(
+ attr: *mut pthread_mutexattr_t,
+ _type: ::c_int,
+ ) -> ::c_int;
+
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_cond_init$UNIX2003"
+ )]
+ pub fn pthread_cond_init(
+ cond: *mut pthread_cond_t,
+ attr: *const pthread_condattr_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_cond_wait$UNIX2003"
+ )]
+ pub fn pthread_cond_wait(
+ cond: *mut pthread_cond_t,
+ lock: *mut pthread_mutex_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_cond_timedwait$UNIX2003"
+ )]
+ pub fn pthread_cond_timedwait(
+ cond: *mut pthread_cond_t,
+ lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec,
+ ) -> ::c_int;
pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> ::c_int;
pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> ::c_int;
pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_init$UNIX2003")]
- pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
- attr: *const pthread_rwlockattr_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_destroy$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_init$UNIX2003"
+ )]
+ pub fn pthread_rwlock_init(
+ lock: *mut pthread_rwlock_t,
+ attr: *const pthread_rwlockattr_t,
+ ) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_destroy$UNIX2003"
+ )]
pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_rdlock$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_rdlock$UNIX2003"
+ )]
pub fn pthread_rwlock_rdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_tryrdlock$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_tryrdlock$UNIX2003"
+ )]
pub fn pthread_rwlock_tryrdlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_wrlock$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_wrlock$UNIX2003"
+ )]
pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_trywrlock$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_trywrlock$UNIX2003"
+ )]
pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_rwlock_unlock$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_unlock$UNIX2003"
+ )]
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
- pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
- -> ::c_int;
+ pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t)
+ -> ::c_int;
+ pub fn pthread_rwlockattr_destroy(
+ attr: *mut pthread_rwlockattr_t,
+ ) -> ::c_int;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
- pub fn getsockopt(sockfd: ::c_int,
- level: ::c_int,
- optname: ::c_int,
- optval: *mut ::c_void,
- optlen: *mut ::socklen_t) -> ::c_int;
+ pub fn getsockopt(
+ sockfd: ::c_int,
+ level: ::c_int,
+ optname: ::c_int,
+ optval: *mut ::c_void,
+ optlen: *mut ::socklen_t,
+ ) -> ::c_int;
pub fn raise(signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
- pub fn sigaction(signum: ::c_int,
- act: *const sigaction,
- oldact: *mut sigaction) -> ::c_int;
+ pub fn sigaction(
+ signum: ::c_int,
+ act: *const sigaction,
+ oldact: *mut sigaction,
+ ) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
- pub fn utimes(filename: *const ::c_char,
- times: *const ::timeval) -> ::c_int;
- pub fn dlopen(filename: *const ::c_char,
- flag: ::c_int) -> *mut ::c_void;
+ pub fn utimes(
+ filename: *const ::c_char,
+ times: *const ::timeval,
+ ) -> ::c_int;
+ pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
pub fn dlerror() -> *mut ::c_char;
- pub fn dlsym(handle: *mut ::c_void,
- symbol: *const ::c_char) -> *mut ::c_void;
+ pub fn dlsym(
+ handle: *mut ::c_void,
+ symbol: *const ::c_char,
+ ) -> *mut ::c_void;
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
- pub fn getaddrinfo(node: *const c_char,
- service: *const c_char,
- hints: *const addrinfo,
- res: *mut *mut addrinfo) -> ::c_int;
+ pub fn getaddrinfo(
+ node: *const c_char,
+ service: *const c_char,
+ hints: *const addrinfo,
+ res: *mut *mut addrinfo,
+ ) -> ::c_int;
pub fn freeaddrinfo(res: *mut addrinfo);
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
- #[cfg_attr(any(
- all(target_os = "linux", not(target_env = "musl")),
- target_os = "freebsd",
- target_os = "dragonfly",
- target_os = "haiku"),
- link_name = "__res_init")]
- #[cfg_attr(any(target_os = "macos", target_os = "ios"),
- link_name = "res_9_init")]
+ #[cfg_attr(
+ any(
+ all(target_os = "linux", not(target_env = "musl")),
+ target_os = "freebsd",
+ target_os = "dragonfly",
+ target_os = "haiku"
+ ),
+ link_name = "__res_init"
+ )]
+ #[cfg_attr(
+ any(target_os = "macos", target_os = "ios"),
+ link_name = "res_9_init"
+ )]
pub fn res_init() -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "mktime$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ 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 = "__time50")]
@@ -962,62 +1242,96 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "mknod@FBSD_1.0"
)]
- pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
- dev: ::dev_t) -> ::c_int;
+ pub fn mknod(
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ dev: ::dev_t,
+ ) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
- pub fn getservbyname(name: *const ::c_char,
- proto: *const ::c_char) -> *mut servent;
+ pub fn getservbyname(
+ name: *const ::c_char,
+ proto: *const ::c_char,
+ ) -> *mut servent;
pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
pub fn chroot(name: *const ::c_char) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "usleep$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "usleep$UNIX2003"
+ )]
pub fn usleep(secs: ::c_uint) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "send$UNIX2003")]
- pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t,
- flags: ::c_int) -> ::ssize_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "recv$UNIX2003")]
- pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
- flags: ::c_int) -> ::ssize_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "putenv$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "send$UNIX2003"
+ )]
+ pub fn send(
+ socket: ::c_int,
+ buf: *const ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ ) -> ::ssize_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "recv$UNIX2003"
+ )]
+ pub fn recv(
+ socket: ::c_int,
+ buf: *mut ::c_void,
+ len: ::size_t,
+ flags: ::c_int,
+ ) -> ::ssize_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "putenv$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__putenv50")]
pub fn putenv(string: *mut c_char) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "poll$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "poll$UNIX2003"
+ )]
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
- link_name = "select$1050")]
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "select$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "select$1050"
+ )]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "select$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__select50")]
- pub fn select(nfds: ::c_int,
- readfs: *mut fd_set,
- writefds: *mut fd_set,
- errorfds: *mut fd_set,
- timeout: *mut timeval) -> ::c_int;
+ pub fn select(
+ nfds: ::c_int,
+ readfs: *mut fd_set,
+ writefds: *mut fd_set,
+ errorfds: *mut fd_set,
+ timeout: *mut timeval,
+ ) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
- pub fn setlocale(category: ::c_int,
- locale: *const ::c_char) -> *mut ::c_char;
+ pub fn setlocale(
+ category: ::c_int,
+ locale: *const ::c_char,
+ ) -> *mut ::c_char;
pub fn localeconv() -> *mut lconv;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "sem_wait$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "sem_wait$UNIX2003"
+ )]
pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
pub fn sem_post(sem: *mut sem_t) -> ::c_int;
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
- pub fn readlink(path: *const c_char,
- buf: *mut c_char,
- bufsz: ::size_t)
- -> ::ssize_t;
+ pub fn readlink(
+ path: *const c_char,
+ buf: *mut c_char,
+ bufsz: ::size_t,
+ ) -> ::ssize_t;
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
@@ -1031,10 +1345,11 @@ extern {
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
- pub fn sigprocmask(how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t)
- -> ::c_int;
+ pub fn sigprocmask(
+ how: ::c_int,
+ set: *const sigset_t,
+ oldset: *mut sigset_t,
+ ) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
@@ -1045,32 +1360,44 @@ extern {
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
- link_name = "pselect$1050")]
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pselect$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "pselect$1050"
+ )]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "pselect$UNIX2003"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__pselect50")]
- pub fn pselect(nfds: ::c_int,
- readfs: *mut fd_set,
- writefds: *mut fd_set,
- errorfds: *mut fd_set,
- timeout: *const timespec,
- sigmask: *const sigset_t) -> ::c_int;
- pub fn fseeko(stream: *mut ::FILE,
- offset: ::off_t,
- whence: ::c_int) -> ::c_int;
+ pub fn pselect(
+ nfds: ::c_int,
+ readfs: *mut fd_set,
+ writefds: *mut fd_set,
+ errorfds: *mut fd_set,
+ timeout: *const timespec,
+ sigmask: *const sigset_t,
+ ) -> ::c_int;
+ pub fn fseeko(
+ stream: *mut ::FILE,
+ offset: ::off_t,
+ whence: ::c_int,
+ ) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "tcdrain$UNIX2003")]
+ #[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 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 tcgetsid(fd: ::c_int) -> ::pid_t;
@@ -1085,8 +1412,10 @@ extern {
pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "nice$UNIX2003")]
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "nice$UNIX2003"
+ )]
pub fn nice(incr: ::c_int) -> ::c_int;
pub fn grantpt(fd: ::c_int) -> ::c_int;
@@ -1095,8 +1424,11 @@ extern {
pub fn unlockpt(fd: ::c_int) -> ::c_int;
pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
- pub fn getline (lineptr: *mut *mut c_char, n: *mut size_t,
- stream: *mut FILE) -> ssize_t;
+ pub fn getline(
+ lineptr: *mut *mut c_char,
+ n: *mut size_t,
+ stream: *mut FILE,
+ ) -> ssize_t;
}
cfg_if! {
@@ -1126,7 +1458,7 @@ cfg_if! {
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(
- all(target_os = "freebsd", freebsd11),
+ all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "readdir_r@FBSD_1.0"
)]
/// The 64-bit libc on Solaris and illumos only has readdir_r. If a