summaryrefslogtreecommitdiffstats
path: root/vendor/libc/src/unix/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/libc/src/unix/mod.rs')
-rw-r--r--vendor/libc/src/unix/mod.rs151
1 files changed, 102 insertions, 49 deletions
diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs
index fb9ebf792..826b83518 100644
--- a/vendor/libc/src/unix/mod.rs
+++ b/vendor/libc/src/unix/mod.rs
@@ -32,6 +32,9 @@ cfg_if! {
if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
pub type uid_t = ::c_ushort;
pub type gid_t = ::c_ushort;
+ } else if #[cfg(target_os = "nto")] {
+ pub type uid_t = i32;
+ pub type gid_t = i32;
} else {
pub type uid_t = u32;
pub type gid_t = u32;
@@ -209,25 +212,31 @@ 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_UNKNOWN: u8 = 0;
-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 = "nto"))] {
+ pub const DT_UNKNOWN: u8 = 0;
+ 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;
-
+cfg_if! {
+ if #[cfg(not(target_os = "nto"))]
+ {
+ 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;
@@ -281,9 +290,13 @@ cfg_if! {
pub const LOG_PRIMASK: ::c_int = 7;
pub const LOG_FACMASK: ::c_int = 0x3f8;
-pub const PRIO_MIN: ::c_int = -20;
-pub const PRIO_MAX: ::c_int = 20;
-
+cfg_if! {
+ if #[cfg(not(target_os = "nto"))]
+ {
+ 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;
@@ -361,7 +374,9 @@ cfg_if! {
target_os = "tvos",
target_os = "watchos",
target_os = "android",
- target_os = "openbsd"))] {
+ target_os = "openbsd",
+ target_os = "nto",
+ ))] {
#[link(name = "c")]
#[link(name = "m")]
extern {}
@@ -453,8 +468,6 @@ extern "C" {
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 fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
@@ -492,7 +505,10 @@ extern "C" {
pub fn ferror(stream: *mut FILE) -> c_int;
pub fn clearerr(stream: *mut FILE);
pub fn perror(s: *const c_char);
+ pub fn atof(s: *const c_char) -> c_double;
pub fn atoi(s: *const c_char) -> c_int;
+ pub fn atol(s: *const c_char) -> c_long;
+ pub fn atoll(s: *const c_char) -> c_longlong;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "strtod$UNIX2003"
@@ -500,7 +516,9 @@ extern "C" {
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
pub fn strtof(s: *const c_char, endp: *mut *mut c_char) -> c_float;
pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoll(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_longlong;
pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
+ pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
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;
@@ -508,7 +526,6 @@ extern "C" {
pub fn abort() -> !;
pub fn exit(status: c_int) -> !;
pub fn _exit(status: c_int) -> !;
- pub fn atexit(cb: extern "C" fn()) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "system$UNIX2003"
@@ -1162,8 +1179,6 @@ extern "C" {
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;
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
@@ -1325,8 +1340,6 @@ extern "C" {
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;
-
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigaddset14")]
@@ -1347,23 +1360,6 @@ extern "C" {
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(target_os = "netbsd", link_name = "__pselect50")]
- pub fn pselect(
- nfds: ::c_int,
- readfds: *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(
@@ -1411,7 +1407,8 @@ extern "C" {
cfg_if! {
if #[cfg(not(any(target_os = "emscripten",
target_os = "android",
- target_os = "haiku")))] {
+ target_os = "haiku",
+ target_os = "nto")))] {
extern "C" {
pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int;
pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
@@ -1420,7 +1417,7 @@ cfg_if! {
}
cfg_if! {
- if #[cfg(not(target_env = "uclibc"))] {
+ if #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] {
extern "C" {
pub fn open_wmemstream(
ptr: *mut *mut wchar_t,
@@ -1439,12 +1436,8 @@ cfg_if! {
link_name = "pause$UNIX2003")]
pub fn pause() -> ::c_int;
- pub fn readlinkat(dirfd: ::c_int,
- pathname: *const ::c_char,
- buf: *mut ::c_char,
- bufsiz: ::size_t) -> ::ssize_t;
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::mode_t) -> ::c_int;
+ mode: ::mode_t) -> ::c_int;
pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
flags: ::c_int, ...) -> ::c_int;
@@ -1475,7 +1468,64 @@ cfg_if! {
}
cfg_if! {
- if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
+ if #[cfg(target_os = "nto")] {
+ extern {
+ pub fn readlinkat(dirfd: ::c_int,
+ pathname: *const ::c_char,
+ buf: *mut ::c_char,
+ bufsiz: ::size_t) -> ::c_int;
+ pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::c_int;
+ pub fn pselect(
+ nfds: ::c_int,
+ readfds: *mut fd_set,
+ writefds: *mut fd_set,
+ errorfds: *mut fd_set,
+ timeout: *mut timespec,
+ sigmask: *const sigset_t,
+ ) -> ::c_int;
+ }
+ } else {
+ extern {
+ pub fn readlinkat(dirfd: ::c_int,
+ pathname: *const ::c_char,
+ buf: *mut ::c_char,
+ bufsiz: ::size_t) -> ::ssize_t;
+ 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 atexit(cb: extern "C" fn()) -> 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 readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
+ #[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,
+ readfds: *mut fd_set,
+ writefds: *mut fd_set,
+ errorfds: *mut fd_set,
+ timeout: *const timespec,
+ sigmask: *const sigset_t,
+ ) -> ::c_int;
+ }
+ }
+}
+
+cfg_if! {
+ if #[cfg(not(any(target_os = "solaris",
+ target_os = "illumos",
+ target_os = "nto",
+ )))] {
extern {
pub fn cfmakeraw(termios: *mut ::termios);
pub fn cfsetspeed(termios: *mut ::termios,
@@ -1517,6 +1567,9 @@ cfg_if! {
} else if #[cfg(target_os = "redox")] {
mod redox;
pub use self::redox::*;
+ } else if #[cfg(target_os = "nto")] {
+ mod nto;
+ pub use self::nto::*;
} else {
// Unknown target_os
}