Newer
Older
//! Definitions found commonly among almost all Unix derivatives
//!
//! More functions and definitions can be found in the more specific modules
//! according to the platform in question.
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
pub type pid_t = i32;
pub type uid_t = u32;
pub type gid_t = u32;
pub type in_addr_t = u32;
pub type in_port_t = u16;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub struct group {
pub gr_name: *mut ::c_char,
pub gr_passwd: *mut ::c_char,
pub gr_gid: ::gid_t,
pub gr_mem: *mut *mut ::c_char,
}
pub actime: time_t,
pub modtime: time_t,
}
pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
// linux x32 compatibility
// See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
pub tv_nsec: i64,
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
pub tv_nsec: ::c_long,
}
pub struct rlimit {
pub rlim_cur: rlim_t,
pub rlim_max: rlim_t,
}
pub struct rusage {
pub ru_utime: timeval,
pub ru_stime: timeval,
pub ru_maxrss: c_long,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad1: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad2: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad3: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad4: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad5: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad6: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad7: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad8: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad9: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad10: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad11: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad12: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad13: u32,
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
__pad14: u32,
#[cfg(any(target_env = "musl", target_os = "emscripten"))]
pub struct ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
#[cfg(target_os = "android")]
pub struct hostent {
pub h_name: *mut ::c_char,
pub h_aliases: *mut *mut ::c_char,
pub h_addrtype: ::c_int,
pub h_length: ::c_int,
pub h_addr_list: *mut *mut ::c_char,
}
pub struct iovec {
pub iov_base: *mut ::c_void,
pub iov_len: ::size_t,
}
pub struct pollfd {
pub fd: ::c_int,
pub events: ::c_short,
pub revents: ::c_short,
}
pub struct winsize {
pub ws_row: ::c_ushort,
pub ws_col: ::c_ushort,
pub ws_xpixel: ::c_ushort,
pub ws_ypixel: ::c_ushort,
}
pub struct linger {
pub l_onoff: ::c_int,
pub l_linger: ::c_int,
}
pub struct sigval {
// Actually a union of an int and a void*
pub sival_ptr: *mut ::c_void
}
pub struct itimerval {
pub it_interval: ::timeval,
pub it_value: ::timeval,
}
// <sys/times.h>
pub struct tms {
pub tms_utime: ::clock_t,
pub tms_stime: ::clock_t,
pub tms_cutime: ::clock_t,
pub tms_cstime: ::clock_t,
}
pub struct servent {
pub s_name: *mut ::c_char,
pub s_aliases: *mut *mut ::c_char,
pub s_port: ::c_int,
pub s_proto: *mut ::c_char,
}
pub struct protoent {
pub p_name: *mut ::c_char,
pub p_aliases: *mut *mut ::c_char,
pub p_proto: ::c_int,
}
pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
pub const SIG_IGN: sighandler_t = 1 as sighandler_t;
pub const SIG_ERR: sighandler_t = !0 as sighandler_t;
pub const DT_FIFO: u8 = 1;
pub const DT_CHR: u8 = 2;
pub const DT_DIR: u8 = 4;
pub const DT_BLK: u8 = 6;
pub const DT_REG: u8 = 8;
pub const DT_LNK: u8 = 10;
pub const DT_SOCK: u8 = 12;
cfg_if! {
if #[cfg(not(target_os = "redox"))] {
pub const FD_CLOEXEC: ::c_int = 0x1;
}
}
pub const USRQUOTA: ::c_int = 0;
pub const GRPQUOTA: ::c_int = 1;
pub const SIGIOT: ::c_int = 6;
pub const S_ISUID: ::mode_t = 0x800;
pub const S_ISGID: ::mode_t = 0x400;
pub const S_ISVTX: ::mode_t = 0x200;
cfg_if! {
if #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] {
pub const IF_NAMESIZE: ::size_t = 16;
pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
}
}
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
pub const LOG_EMERG: ::c_int = 0;
pub const LOG_ALERT: ::c_int = 1;
pub const LOG_CRIT: ::c_int = 2;
pub const LOG_ERR: ::c_int = 3;
pub const LOG_WARNING: ::c_int = 4;
pub const LOG_NOTICE: ::c_int = 5;
pub const LOG_INFO: ::c_int = 6;
pub const LOG_DEBUG: ::c_int = 7;
pub const LOG_KERN: ::c_int = 0;
pub const LOG_USER: ::c_int = 1 << 3;
pub const LOG_MAIL: ::c_int = 2 << 3;
pub const LOG_DAEMON: ::c_int = 3 << 3;
pub const LOG_AUTH: ::c_int = 4 << 3;
pub const LOG_SYSLOG: ::c_int = 5 << 3;
pub const LOG_LPR: ::c_int = 6 << 3;
pub const LOG_NEWS: ::c_int = 7 << 3;
pub const LOG_UUCP: ::c_int = 8 << 3;
pub const LOG_LOCAL0: ::c_int = 16 << 3;
pub const LOG_LOCAL1: ::c_int = 17 << 3;
pub const LOG_LOCAL2: ::c_int = 18 << 3;
pub const LOG_LOCAL3: ::c_int = 19 << 3;
pub const LOG_LOCAL4: ::c_int = 20 << 3;
pub const LOG_LOCAL5: ::c_int = 21 << 3;
pub const LOG_LOCAL6: ::c_int = 22 << 3;
pub const LOG_LOCAL7: ::c_int = 23 << 3;
pub const LOG_PID: ::c_int = 0x01;
pub const LOG_CONS: ::c_int = 0x02;
pub const LOG_ODELAY: ::c_int = 0x04;
pub const LOG_NDELAY: ::c_int = 0x08;
pub const LOG_NOWAIT: ::c_int = 0x10;
pub const LOG_PRIMASK: ::c_int = 7;
pub const LOG_FACMASK: ::c_int = 0x3f8;
Raphael Cohn
committed
pub const PRIO_MIN: ::c_int = -20;
pub const PRIO_MAX: ::c_int = 20;
pub const IPPROTO_ICMP: ::c_int = 1;
pub const IPPROTO_ICMPV6: ::c_int = 58;
pub const IPPROTO_TCP: ::c_int = 6;
pub const IPPROTO_UDP: ::c_int = 17;
pub const IPPROTO_IP: ::c_int = 0;
pub const IPPROTO_IPV6: ::c_int = 41;
pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
pub const INADDR_ANY: in_addr_t = 0;
pub const INADDR_BROADCAST: in_addr_t = 4294967295;
pub const INADDR_NONE: in_addr_t = 4294967295;
pub const ARPOP_REQUEST: u16 = 1;
pub const ARPOP_REPLY: u16 = 2;
pub const ATF_COM: ::c_int = 0x02;
pub const ATF_PERM: ::c_int = 0x04;
pub const ATF_PUBL: ::c_int = 0x08;
pub const ATF_USETRAILERS: ::c_int = 0x10;
// required libraries for L4Re are linked externally, ATM
} else if #[cfg(feature = "std")] {
// cargo build, don't pull in anything extra as the libstd dep
} else if #[cfg(all(target_os = "linux",
target_env = "gnu",
feature = "rustc-dep-of-std"))] {
#[link(name = "util", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "rt", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "pthread", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "m", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "dl", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "c", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "gcc_eh", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "gcc", kind = "static-nobundle",
cfg(target_feature = "crt-static"))]
#[link(name = "util", cfg(not(target_feature = "crt-static")))]
#[link(name = "rt", cfg(not(target_feature = "crt-static")))]
#[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
#[link(name = "m", cfg(not(target_feature = "crt-static")))]
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
} else if #[cfg(target_env = "musl")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static",
cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "rustc-dep-of-std",
} else if #[cfg(target_os = "emscripten")] {
#[link(name = "c")]
extern {}
} else if #[cfg(all(target_os = "netbsd",
feature = "rustc-dep-of-std",
target_vendor = "rumprun"))] {
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
// in automatically by the linker. We avoid passing it explicitly, as it
// causes some versions of binutils to crash with an assertion failure.
#[link(name = "m")]
extern {}
} else if #[cfg(any(target_os = "macos",
target_os = "ios",
#[link(name = "c")]
#[link(name = "m")]
extern {}
} else if #[cfg(target_os = "haiku")] {
#[link(name = "root")]
#[link(name = "network")]
extern {}
} else if #[cfg(target_env = "newlib")] {
#[link(name = "c")]
#[link(name = "m")]
extern {}
} else if #[cfg(target_os = "hermit")] {
// no_default_libraries is set to false for HermitCore, so only a link
// to "pthread" needs to be added.
#[link(name = "pthread")]
extern {}
} else if #[cfg(target_env = "illumos")] {
#[link(name = "c")]
#[link(name = "m")]
extern {}
} else if #[cfg(target_os = "redox")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static-nobundle",
cfg(target_feature = "crt-static")))]
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", cfg(not(target_feature = "crt-static"))))]
extern {}
} else {
#[link(name = "c")]
#[link(name = "m")]
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos_t {} // FIXME: fill this out with a struct
pub fn isalnum(c: c_int) -> c_int;
pub fn isalpha(c: c_int) -> c_int;
pub fn iscntrl(c: c_int) -> c_int;
pub fn isdigit(c: c_int) -> c_int;
pub fn isgraph(c: c_int) -> c_int;
pub fn islower(c: c_int) -> c_int;
pub fn isprint(c: c_int) -> c_int;
pub fn ispunct(c: c_int) -> c_int;
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 tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn qsort(
base: *mut c_void,
num: size_t,
size: size_t,
compar: ::Option<
unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
>,
);
pub fn bsearch(
key: *const c_void,
base: *const c_void,
num: size_t,
size: size_t,
compar: ::Option<
unsafe extern "C" fn(*const c_void, *const c_void) -> c_int,
>,
) -> *mut c_void;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fopen$UNIX2003"
)]
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
#[cfg_attr(
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 fmemopen(
buf: *mut c_void,
size: size_t,
mode: *const c_char,
) -> *mut FILE;
pub fn open_memstream(
ptr: *mut *mut c_char,
sizeloc: *mut size_t,
) -> *mut FILE;
pub fn open_wmemstream(
ptr: *mut *mut wchar_t,
sizeloc: *mut size_t,
) -> *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 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 fputc(c: c_int, stream: *mut FILE) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fputs$UNIX2003"
)]
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;
#[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 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);
#[cfg_attr(target_os = "netbsd", link_name = "__fgetpos50")]
pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__fsetpos50")]
pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
pub fn feof(stream: *mut FILE) -> c_int;
pub fn ferror(stream: *mut FILE) -> c_int;
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
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 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;
pub fn free(p: *mut c_void);
pub fn abort() -> !;
pub fn exit(status: c_int) -> !;
pub fn _exit(status: c_int) -> !;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "system$UNIX2003"
)]
pub fn system(s: *const c_char) -> c_int;
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 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 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;
pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strdup(cs: *const c_char) -> *mut c_char;
pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
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 strlen(cs: *const c_char) -> size_t;
pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "strerror$UNIX2003"
)]
pub fn strerror(n: c_int) -> *mut c_char;
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 memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
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 memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
}
#[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 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 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;
#[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 getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
#[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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 listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
#[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
target_vendor = "nintendo")))]
#[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 shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
#[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", not(target_arch = "aarch64")),
link_name = "fstat$INODE64"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
link_name = "fstat@FBSD_1.0"
)]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", not(target_arch = "aarch64")),
link_name = "stat$INODE64"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
link_name = "stat@FBSD_1.0"
)]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
#[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"
)]
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"
)]
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"
)]
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(target_os = "netbsd", link_name = "__opendir30")]
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
#[cfg_attr(
all(target_os = "macos", not(target_arch = "aarch64")),
link_name = "readdir$INODE64"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
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_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;
#[cfg_attr(
all(target_os = "macos", not(target_arch = "aarch64")),
link_name = "fstatat$INODE64"
)]
link_name = "fstatat@FBSD_1.1"
)]
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
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 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 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;
#[cfg_attr(target_os = "illumos", link_name = "getloginx")]
#[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 getpgrp() -> pid_t;
pub fn getpid() -> pid_t;
pub fn getppid() -> pid_t;
pub fn getuid() -> uid_t;
pub fn isatty(fd: ::c_int) -> ::c_int;
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
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 read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
pub fn setgid(gid: gid_t) -> ::c_int;
pub fn setpgid(pid: pid_t, pgid: pid_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 = "nanosleep$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__nanosleep50")]
pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "ttyname_r$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
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 = "wait$UNIX2003"
)]