summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--README.md5
-rw-r--r--ci/landing-page-footer.html10
-rw-r--r--ci/landing-page-head.html11
-rw-r--r--libc-test/Cargo.lock8
-rw-r--r--libc-test/build.rs12
-rw-r--r--src/unix/bsd/apple/mod.rs118
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs32
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs20
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs150
-rw-r--r--src/unix/bsd/mod.rs9
-rw-r--r--src/unix/bsd/openbsdlike/bitrig.rs69
-rw-r--r--src/unix/bsd/openbsdlike/mod.rs87
-rw-r--r--src/unix/bsd/openbsdlike/netbsd.rs47
-rw-r--r--src/unix/bsd/openbsdlike/openbsd.rs27
-rw-r--r--src/unix/mod.rs14
-rw-r--r--src/unix/notbsd/android/mod.rs26
-rw-r--r--src/unix/notbsd/linux/mips.rs25
-rw-r--r--src/unix/notbsd/linux/mod.rs80
-rw-r--r--src/unix/notbsd/linux/musl/mod.rs5
-rw-r--r--src/unix/notbsd/linux/other/mod.rs25
-rw-r--r--src/unix/notbsd/mod.rs68
-rw-r--r--src/unix/solaris/mod.rs139
23 files changed, 939 insertions, 50 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f9cead1726..36c6d199d3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "libc"
-version = "0.2.8"
+version = "0.2.9"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
diff --git a/README.md b/README.md
index a822744dce..920d705ee8 100644
--- a/README.md
+++ b/README.md
@@ -101,9 +101,8 @@ Tested:
* [`i686-apple-darwin`](https://doc.rust-lang.org/libc/i686-apple-darwin/libc/)
* [`x86_64-apple-darwin`](https://doc.rust-lang.org/libc/x86_64-apple-darwin/libc/)
(OSX)
- * [`i686-apple-ios`](https://doc.rust-lang.org/libc/i686-apple-ios/libc/)
- * [`x86_64-apple-ios`](https://doc.rust-lang.org/libc/x86_64-apple-ios/libc/)
- (iOS)
+ * `i686-apple-ios`
+ * `x86_64-apple-ios`
* [`i686-unknown-linux-gnu`](https://doc.rust-lang.org/libc/i686-unknown-linux-gnu/libc/)
* [`x86_64-unknown-linux-gnu`](https://doc.rust-lang.org/libc/x86_64-unknown-linux-gnu/libc/)
(Linux)
diff --git a/ci/landing-page-footer.html b/ci/landing-page-footer.html
index fc69fa88eb..941cc8d2b4 100644
--- a/ci/landing-page-footer.html
+++ b/ci/landing-page-footer.html
@@ -1,7 +1,3 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta charset="utf-8">
- </head>
- <body>
- <ul>
+ </ul>
+ </body>
+</html>
diff --git a/ci/landing-page-head.html b/ci/landing-page-head.html
index de3c63c01f..fc69fa88eb 100644
--- a/ci/landing-page-head.html
+++ b/ci/landing-page-head.html
@@ -1,4 +1,7 @@
- </ul>
- </body>
-</html>
-
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ </head>
+ <body>
+ <ul>
diff --git a/libc-test/Cargo.lock b/libc-test/Cargo.lock
index 0174f0c7a1..007ba034ec 100644
--- a/libc-test/Cargo.lock
+++ b/libc-test/Cargo.lock
@@ -3,7 +3,7 @@ name = "libc-test"
version = "0.1.0"
dependencies = [
"ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
- "libc 0.2.8",
+ "libc 0.2.9",
]
[[package]]
@@ -41,19 +41,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
-version = "0.2.7"
+version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
-version = "0.2.8"
+version = "0.2.9"
[[package]]
name = "log"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 8212ea52e4..1685d22bd0 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -38,6 +38,7 @@ fn main() {
cfg.header("errno.h")
.header("fcntl.h")
.header("limits.h")
+ .header("locale.h")
.header("stddef.h")
.header("stdint.h")
.header("stdio.h")
@@ -99,10 +100,12 @@ fn main() {
if android {
cfg.header("arpa/inet.h");
cfg.header("time64.h");
+ cfg.header("xlocale.h");
} else if !windows {
cfg.header("glob.h");
cfg.header("ifaddrs.h");
cfg.header("sys/statvfs.h");
+ cfg.header("langinfo.h");
if !openbsd && !freebsd && !dragonfly {
cfg.header("sys/quota.h");
@@ -113,6 +116,7 @@ fn main() {
if !netbsd && !openbsd {
cfg.header("execinfo.h");
+ cfg.header("xlocale.h");
}
}
}
@@ -129,6 +133,12 @@ fn main() {
if bsdlike {
cfg.header("sys/event.h");
+
+ if freebsd {
+ cfg.header("libutil.h");
+ } else {
+ cfg.header("util.h");
+ }
}
if linux {
@@ -138,6 +148,7 @@ fn main() {
cfg.header("sys/xattr.h");
cfg.header("sys/ipc.h");
cfg.header("sys/shm.h");
+ cfg.header("pty.h");
}
if linux || android {
@@ -304,6 +315,7 @@ fn main() {
// weird signed extension or something like that?
"MS_NOUSER" => true,
+ "MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13
// These OSX constants are flagged as deprecated
"NOTE_EXIT_REPARENTED" |
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 70cd42c7ae..fc18a6d14a 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -18,6 +18,7 @@ pub type fsblkcnt_t = ::c_uint;
pub type fsfilcnt_t = ::c_uint;
pub type speed_t = ::c_ulong;
pub type tcflag_t = ::c_ulong;
+pub type nl_item = ::c_int;
pub enum timezone {}
@@ -257,8 +258,117 @@ s! {
pub trailers: *mut ::iovec,
pub trl_cnt: ::c_int,
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
+pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+ | LC_CTYPE_MASK
+ | LC_MESSAGES_MASK
+ | LC_MONETARY_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK;
+
+pub const CODESET: ::nl_item = 0;
+pub const D_T_FMT: ::nl_item = 1;
+pub const D_FMT: ::nl_item = 2;
+pub const T_FMT: ::nl_item = 3;
+pub const T_FMT_AMPM: ::nl_item = 4;
+pub const AM_STR: ::nl_item = 5;
+pub const PM_STR: ::nl_item = 6;
+
+pub const DAY_1: ::nl_item = 7;
+pub const DAY_2: ::nl_item = 8;
+pub const DAY_3: ::nl_item = 9;
+pub const DAY_4: ::nl_item = 10;
+pub const DAY_5: ::nl_item = 11;
+pub const DAY_6: ::nl_item = 12;
+pub const DAY_7: ::nl_item = 13;
+
+pub const ABDAY_1: ::nl_item = 14;
+pub const ABDAY_2: ::nl_item = 15;
+pub const ABDAY_3: ::nl_item = 16;
+pub const ABDAY_4: ::nl_item = 17;
+pub const ABDAY_5: ::nl_item = 18;
+pub const ABDAY_6: ::nl_item = 19;
+pub const ABDAY_7: ::nl_item = 20;
+
+pub const MON_1: ::nl_item = 21;
+pub const MON_2: ::nl_item = 22;
+pub const MON_3: ::nl_item = 23;
+pub const MON_4: ::nl_item = 24;
+pub const MON_5: ::nl_item = 25;
+pub const MON_6: ::nl_item = 26;
+pub const MON_7: ::nl_item = 27;
+pub const MON_8: ::nl_item = 28;
+pub const MON_9: ::nl_item = 29;
+pub const MON_10: ::nl_item = 30;
+pub const MON_11: ::nl_item = 31;
+pub const MON_12: ::nl_item = 32;
+
+pub const ABMON_1: ::nl_item = 33;
+pub const ABMON_2: ::nl_item = 34;
+pub const ABMON_3: ::nl_item = 35;
+pub const ABMON_4: ::nl_item = 36;
+pub const ABMON_5: ::nl_item = 37;
+pub const ABMON_6: ::nl_item = 38;
+pub const ABMON_7: ::nl_item = 39;
+pub const ABMON_8: ::nl_item = 40;
+pub const ABMON_9: ::nl_item = 41;
+pub const ABMON_10: ::nl_item = 42;
+pub const ABMON_11: ::nl_item = 43;
+pub const ABMON_12: ::nl_item = 44;
+
+pub const ERA: ::nl_item = 45;
+pub const ERA_D_FMT: ::nl_item = 46;
+pub const ERA_D_T_FMT: ::nl_item = 47;
+pub const ERA_T_FMT: ::nl_item = 48;
+pub const ALT_DIGITS: ::nl_item = 49;
+
+pub const RADIXCHAR: ::nl_item = 50;
+pub const THOUSEP: ::nl_item = 51;
+
+pub const YESEXPR: ::nl_item = 52;
+pub const NOEXPR: ::nl_item = 53;
+
+pub const YESSTR: ::nl_item = 54;
+pub const NOSTR: ::nl_item = 55;
+
+pub const CRNCYSTR: ::nl_item = 56;
+
+pub const D_MD_ORDER: ::nl_item = 57;
+
pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: ::c_int = 0;
pub const RAND_MAX: ::c_int = 2147483647;
@@ -1000,6 +1110,14 @@ extern {
name: *mut ::c_char,
termp: *mut termios,
winp: *mut ::winsize) -> ::pid_t;
+ pub fn duplocale(base: ::locale_t) -> ::locale_t;
+ pub fn freelocale(loc: ::locale_t) -> ::c_int;
+ pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
+ 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 querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
}
cfg_if! {
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 865244265f..141b2ad25d 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -2,6 +2,7 @@ pub type clock_t = u64;
pub type ino_t = u64;
pub type nlink_t = u32;
pub type blksize_t = i64;
+pub type clockid_t = ::c_ulong;
pub type c_long = i64;
pub type c_ulong = u64;
@@ -96,23 +97,24 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
-pub const CLOCK_REALTIME: ::c_ulong = 0;
-pub const CLOCK_VIRTUAL: ::c_ulong = 1;
-pub const CLOCK_PROF: ::c_ulong = 2;
-pub const CLOCK_MONOTONIC: ::c_ulong = 4;
-pub const CLOCK_UPTIME: ::c_ulong = 5;
-pub const CLOCK_UPTIME_PRECISE: ::c_ulong = 7;
-pub const CLOCK_UPTIME_FAST: ::c_ulong = 8;
-pub const CLOCK_REALTIME_PRECISE: ::c_ulong = 9;
-pub const CLOCK_REALTIME_FAST: ::c_ulong = 10;
-pub const CLOCK_MONOTONIC_PRECISE: ::c_ulong = 11;
-pub const CLOCK_MONOTONIC_FAST: ::c_ulong = 12;
-pub const CLOCK_SECOND: ::c_ulong = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: ::c_ulong = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: ::c_ulong = 15;
+pub const CLOCK_REALTIME: clockid_t = 0;
+pub const CLOCK_VIRTUAL: clockid_t = 1;
+pub const CLOCK_PROF: clockid_t = 2;
+pub const CLOCK_MONOTONIC: clockid_t = 4;
+pub const CLOCK_UPTIME: clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
+pub const CLOCK_SECOND: clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_gettime(clk_id: ::c_ulong, tp: *mut ::timespec) -> ::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;
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 5171735343..ae521f28c5 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -3,6 +3,7 @@ pub type clock_t = i32;
pub type ino_t = u32;
pub type nlink_t = u16;
pub type blksize_t = u32;
+pub type clockid_t = ::c_int;
pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
@@ -60,8 +61,20 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
-pub const CLOCK_REALTIME: ::c_int = 0;
-pub const CLOCK_MONOTONIC: ::c_int = 4;
+pub const CLOCK_REALTIME: clockid_t = 0;
+pub const CLOCK_VIRTUAL: clockid_t = 1;
+pub const CLOCK_PROF: clockid_t = 2;
+pub const CLOCK_MONOTONIC: clockid_t = 4;
+pub const CLOCK_UPTIME: clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
+pub const CLOCK_SECOND: clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
extern {
pub fn __error() -> *mut ::c_int;
@@ -69,7 +82,8 @@ extern {
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::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 posix_fallocate(fd: ::c_int, offset: ::off_t,
len: ::off_t) -> ::c_int;
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 1276a974e0..b32d4fb5bb 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -9,6 +9,7 @@ pub type pthread_rwlock_t = *mut ::c_void;
pub type pthread_key_t = ::c_int;
pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
+pub type nl_item = ::c_int;
pub enum timezone {}
@@ -120,8 +121,130 @@ s! {
pub trailers: *mut ::iovec,
pub trl_cnt: ::c_int,
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
+pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+ | LC_CTYPE_MASK
+ | LC_MESSAGES_MASK
+ | LC_MONETARY_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK;
+
+pub const CODESET: ::nl_item = 0;
+pub const D_T_FMT: ::nl_item = 1;
+pub const D_FMT: ::nl_item = 2;
+pub const T_FMT: ::nl_item = 3;
+pub const T_FMT_AMPM: ::nl_item = 4;
+pub const AM_STR: ::nl_item = 5;
+pub const PM_STR: ::nl_item = 6;
+
+pub const DAY_1: ::nl_item = 7;
+pub const DAY_2: ::nl_item = 8;
+pub const DAY_3: ::nl_item = 9;
+pub const DAY_4: ::nl_item = 10;
+pub const DAY_5: ::nl_item = 11;
+pub const DAY_6: ::nl_item = 12;
+pub const DAY_7: ::nl_item = 13;
+
+pub const ABDAY_1: ::nl_item = 14;
+pub const ABDAY_2: ::nl_item = 15;
+pub const ABDAY_3: ::nl_item = 16;
+pub const ABDAY_4: ::nl_item = 17;
+pub const ABDAY_5: ::nl_item = 18;
+pub const ABDAY_6: ::nl_item = 19;
+pub const ABDAY_7: ::nl_item = 20;
+
+pub const MON_1: ::nl_item = 21;
+pub const MON_2: ::nl_item = 22;
+pub const MON_3: ::nl_item = 23;
+pub const MON_4: ::nl_item = 24;
+pub const MON_5: ::nl_item = 25;
+pub const MON_6: ::nl_item = 26;
+pub const MON_7: ::nl_item = 27;
+pub const MON_8: ::nl_item = 28;
+pub const MON_9: ::nl_item = 29;
+pub const MON_10: ::nl_item = 30;
+pub const MON_11: ::nl_item = 31;
+pub const MON_12: ::nl_item = 32;
+
+pub const ABMON_1: ::nl_item = 33;
+pub const ABMON_2: ::nl_item = 34;
+pub const ABMON_3: ::nl_item = 35;
+pub const ABMON_4: ::nl_item = 36;
+pub const ABMON_5: ::nl_item = 37;
+pub const ABMON_6: ::nl_item = 38;
+pub const ABMON_7: ::nl_item = 39;
+pub const ABMON_8: ::nl_item = 40;
+pub const ABMON_9: ::nl_item = 41;
+pub const ABMON_10: ::nl_item = 42;
+pub const ABMON_11: ::nl_item = 43;
+pub const ABMON_12: ::nl_item = 44;
+
+pub const ERA: ::nl_item = 45;
+pub const ERA_D_FMT: ::nl_item = 46;
+pub const ERA_D_T_FMT: ::nl_item = 47;
+pub const ERA_T_FMT: ::nl_item = 48;
+pub const ALT_DIGITS: ::nl_item = 49;
+
+pub const RADIXCHAR: ::nl_item = 50;
+pub const THOUSEP: ::nl_item = 51;
+
+pub const YESEXPR: ::nl_item = 52;
+pub const NOEXPR: ::nl_item = 53;
+
+pub const YESSTR: ::nl_item = 54;
+pub const NOSTR: ::nl_item = 55;
+
+pub const CRNCYSTR: ::nl_item = 56;
+
+pub const D_MD_ORDER: ::nl_item = 57;
+
+pub const ALTMON_1: ::nl_item = 58;
+pub const ALTMON_2: ::nl_item = 59;
+pub const ALTMON_3: ::nl_item = 60;
+pub const ALTMON_4: ::nl_item = 61;
+pub const ALTMON_5: ::nl_item = 62;
+pub const ALTMON_6: ::nl_item = 63;
+pub const ALTMON_7: ::nl_item = 64;
+pub const ALTMON_8: ::nl_item = 65;
+pub const ALTMON_9: ::nl_item = 66;
+pub const ALTMON_10: ::nl_item = 67;
+pub const ALTMON_11: ::nl_item = 68;
+pub const ALTMON_12: ::nl_item = 69;
+
pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: ::c_int = 0;
pub const EOF: ::c_int = -1;
@@ -541,6 +664,7 @@ pub const RTLD_NODELETE: ::c_int = 0x1000;
pub const RTLD_NOLOAD: ::c_int = 0x2000;
pub const RTLD_GLOBAL: ::c_int = 0x100;
+#[link(name = "util")]
extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -570,7 +694,6 @@ extern {
newp: *const ::c_void,
newlen: ::size_t)
-> ::c_int;
- pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
param: *const sched_param) -> ::c_int;
@@ -590,6 +713,31 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t,
info: *mut siginfo_t) -> ::c_int;
+ pub fn openpty(amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::c_int;
+ pub fn forkpty(amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::pid_t;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ pub fn duplocale(base: ::locale_t) -> ::locale_t;
+ pub fn freelocale(loc: ::locale_t) -> ::c_int;
+ 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 querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
+ pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
+ pub fn pthread_attr_get_np(tid: ::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;
}
cfg_if! {
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index b633003aa5..a280fc9263 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -122,6 +122,14 @@ s! {
}
}
+pub const LC_ALL: ::c_int = 0;
+pub const LC_COLLATE: ::c_int = 1;
+pub const LC_CTYPE: ::c_int = 2;
+pub const LC_MONETARY: ::c_int = 3;
+pub const LC_NUMERIC: ::c_int = 4;
+pub const LC_TIME: ::c_int = 5;
+pub const LC_MESSAGES: ::c_int = 6;
+
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONBIO: ::c_ulong = 0x8004667e;
@@ -282,6 +290,7 @@ pub const NOFLSH: ::tcflag_t = 0x80000000;
pub const WNOHANG: ::c_int = 1;
pub const RTLD_NOW: ::c_int = 0x2;
+pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
diff --git a/src/unix/bsd/openbsdlike/bitrig.rs b/src/unix/bsd/openbsdlike/bitrig.rs
index b6c51dec36..32e7b3061d 100644
--- a/src/unix/bsd/openbsdlike/bitrig.rs
+++ b/src/unix/bsd/openbsdlike/bitrig.rs
@@ -106,8 +106,69 @@ s! {
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
+pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
+pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
+pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
+pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
+ | LC_CTYPE_MASK
+ | LC_MESSAGES_MASK
+ | LC_MONETARY_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK;
+
+pub const ERA: ::nl_item = 52;
+pub const ERA_D_FMT: ::nl_item = 53;
+pub const ERA_D_T_FMT: ::nl_item = 54;
+pub const ERA_T_FMT: ::nl_item = 55;
+pub const ALT_DIGITS: ::nl_item = 56;
+
+pub const D_MD_ORDER: ::nl_item = 57;
+
+pub const ALTMON_1: ::nl_item = 58;
+pub const ALTMON_2: ::nl_item = 59;
+pub const ALTMON_3: ::nl_item = 60;
+pub const ALTMON_4: ::nl_item = 61;
+pub const ALTMON_5: ::nl_item = 62;
+pub const ALTMON_6: ::nl_item = 63;
+pub const ALTMON_7: ::nl_item = 64;
+pub const ALTMON_8: ::nl_item = 65;
+pub const ALTMON_9: ::nl_item = 66;
+pub const ALTMON_10: ::nl_item = 67;
+pub const ALTMON_11: ::nl_item = 68;
+pub const ALTMON_12: ::nl_item = 69;
+
pub const O_CLOEXEC: ::c_int = 0x10000;
pub const MS_SYNC : ::c_int = 0x0002;
@@ -244,4 +305,12 @@ extern {
newp: *mut ::c_void,
newlen: ::size_t)
-> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ pub fn duplocale(base: ::locale_t) -> ::locale_t;
+ pub fn freelocale(loc: ::locale_t) -> ::c_int;
+ 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 querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
}
diff --git a/src/unix/bsd/openbsdlike/mod.rs b/src/unix/bsd/openbsdlike/mod.rs
index 1a2bdffa8b..6debacf5f7 100644
--- a/src/unix/bsd/openbsdlike/mod.rs
+++ b/src/unix/bsd/openbsdlike/mod.rs
@@ -8,6 +8,8 @@ pub type pthread_key_t = ::c_int;
pub type rlim_t = u64;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
+pub type nl_item = c_long;
+pub type clockid_t = ::c_int;
pub enum timezone {}
@@ -51,6 +53,65 @@ s! {
}
}
+pub const D_T_FMT: ::nl_item = 0;
+pub const D_FMT: ::nl_item = 1;
+pub const T_FMT: ::nl_item = 2;
+pub const T_FMT_AMPM: ::nl_item = 3;
+pub const AM_STR: ::nl_item = 4;
+pub const PM_STR: ::nl_item = 5;
+
+pub const DAY_1: ::nl_item = 6;
+pub const DAY_2: ::nl_item = 7;
+pub const DAY_3: ::nl_item = 8;
+pub const DAY_4: ::nl_item = 9;
+pub const DAY_5: ::nl_item = 10;
+pub const DAY_6: ::nl_item = 11;
+pub const DAY_7: ::nl_item = 12;
+
+pub const ABDAY_1: ::nl_item = 13;
+pub const ABDAY_2: ::nl_item = 14;
+pub const ABDAY_3: ::nl_item = 15;
+pub const ABDAY_4: ::nl_item = 16;
+pub const ABDAY_5: ::nl_item = 17;
+pub const ABDAY_6: ::nl_item = 18;
+pub const ABDAY_7: ::nl_item = 19;
+
+pub const MON_1: ::nl_item = 20;
+pub const MON_2: ::nl_item = 21;
+pub const MON_3: ::nl_item = 22;
+pub const MON_4: ::nl_item = 23;
+pub const MON_5: ::nl_item = 24;
+pub const MON_6: ::nl_item = 25;
+pub const MON_7: ::nl_item = 26;
+pub const MON_8: ::nl_item = 27;
+pub const MON_9: ::nl_item = 28;
+pub const MON_10: ::nl_item = 29;
+pub const MON_11: ::nl_item = 30;
+pub const MON_12: ::nl_item = 31;
+
+pub const ABMON_1: ::nl_item = 32;
+pub const ABMON_2: ::nl_item = 33;
+pub const ABMON_3: ::nl_item = 34;
+pub const ABMON_4: ::nl_item = 35;
+pub const ABMON_5: ::nl_item = 36;
+pub const ABMON_6: ::nl_item = 37;
+pub const ABMON_7: ::nl_item = 38;
+pub const ABMON_8: ::nl_item = 39;
+pub const ABMON_9: ::nl_item = 40;
+pub const ABMON_10: ::nl_item = 41;
+pub const ABMON_11: ::nl_item = 42;
+pub const ABMON_12: ::nl_item = 43;
+
+pub const RADIXCHAR: ::nl_item = 44;
+pub const THOUSEP: ::nl_item = 45;
+pub const YESSTR: ::nl_item = 46;
+pub const YESEXPR: ::nl_item = 47;
+pub const NOSTR: ::nl_item = 48;
+pub const NOEXPR: ::nl_item = 49;
+pub const CRNCYSTR: ::nl_item = 50;
+
+pub const CODESET: ::nl_item = 51;
+
pub const EXIT_FAILURE : ::c_int = 1;
pub const EXIT_SUCCESS : ::c_int = 0;
pub const RAND_MAX : ::c_int = 2147483647;
@@ -258,8 +319,16 @@ pub const _SC_XOPEN_SHM : ::c_int = 30;
pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
-pub const CLOCK_REALTIME : ::c_int = 0;
-pub const CLOCK_MONOTONIC : ::c_int = 3;
+// http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2
+// The man page says clock_gettime(3) can accept various values as clockid_t but
+// http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161
+// the implementation rejects anything other than the below two
+//
+// http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
+// https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
+// Basically the same goes for NetBSD
+pub const CLOCK_REALTIME: clockid_t = 0;
+pub const CLOCK_MONOTONIC: clockid_t = 3;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -376,11 +445,14 @@ pub const Q_SETQUOTA: ::c_int = 0x400;
pub const RTLD_GLOBAL: ::c_int = 0x100;
+#[link(name = "util")]
extern {
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
+ pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
- pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int;
@@ -393,6 +465,15 @@ extern {
flags: ::c_int) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
+ pub fn openpty(amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::c_int;
+ pub fn forkpty(amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize) -> ::pid_t;
}
cfg_if! {
diff --git a/src/unix/bsd/openbsdlike/netbsd.rs b/src/unix/bsd/openbsdlike/netbsd.rs
index 3640d2ec01..1c008dcdc9 100644
--- a/src/unix/bsd/openbsdlike/netbsd.rs
+++ b/src/unix/bsd/openbsdlike/netbsd.rs
@@ -190,8 +190,49 @@ s! {
pub dli_sname: *const ::c_char,
pub dli_saddr: *const ::c_void,
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
+pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
+pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
+pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC);
+pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES);
+pub const LC_ALL_MASK: ::c_int = !0;
+
+pub const ERA: ::nl_item = 52;
+pub const ERA_D_FMT: ::nl_item = 53;
+pub const ERA_D_T_FMT: ::nl_item = 54;
+pub const ERA_T_FMT: ::nl_item = 55;
+pub const ALT_DIGITS: ::nl_item = 56;
+
pub const O_CLOEXEC: ::c_int = 0x400000;
pub const O_ALT_IO: ::c_int = 0x40000;
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
@@ -384,4 +425,10 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t,
info: *mut siginfo_t) -> ::c_int;
+ pub fn duplocale(base: ::locale_t) -> ::locale_t;
+ pub fn freelocale(loc: ::locale_t);
+ pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
+ pub fn newlocale(mask: ::c_int,
+ locale: *const ::c_char,
+ base: ::locale_t) -> ::locale_t;
}
diff --git a/src/unix/bsd/openbsdlike/openbsd.rs b/src/unix/bsd/openbsdlike/openbsd.rs
index 73d14ea979..0277145569 100644
--- a/src/unix/bsd/openbsdlike/openbsd.rs
+++ b/src/unix/bsd/openbsdlike/openbsd.rs
@@ -109,6 +109,33 @@ s! {
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
pub const O_CLOEXEC: ::c_int = 0x10000;
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 1b576ebe95..de996b651a 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -14,6 +14,7 @@ pub type sighandler_t = ::size_t;
pub type cc_t = ::c_uchar;
pub enum DIR {}
+pub enum locale_t {}
s! {
pub struct utimbuf {
@@ -143,7 +144,9 @@ pub const IF_NAMESIZE: ::size_t = 16;
pub const RTLD_LAZY: ::c_int = 0x1;
cfg_if! {
- if #[cfg(not(stdbuild))] {
+ if #[cfg(dox)] {
+ // on dox builds don't pull in anything
+ } else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
} else if #[cfg(all(target_env = "musl", not(any(target_arch = "mips",
@@ -505,8 +508,8 @@ extern {
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
oldset: *mut sigset_t) -> ::c_int;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
-
- // #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
+ #[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
+ link_name = "__xpg_strerror_r")]
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
buflen: ::size_t) -> ::c_int;
@@ -610,6 +613,10 @@ extern {
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 localeconv() -> *mut lconv;
}
// TODO: get rid of this cfg(not(...))
@@ -711,6 +718,7 @@ extern {
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
+ pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
}
cfg_if! {
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 0a01bcc1c5..3f78e01921 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -302,6 +302,31 @@ pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const RUSAGE_CHILDREN: ::c_int = -1;
+pub const LC_PAPER: ::c_int = 7;
+pub const LC_NAME: ::c_int = 8;
+pub const LC_ADDRESS: ::c_int = 9;
+pub const LC_TELEPHONE: ::c_int = 10;
+pub const LC_MEASUREMENT: ::c_int = 11;
+pub const LC_IDENTIFICATION: ::c_int = 12;
+pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
+pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
+pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
+pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
+pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
+pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
+pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
+ | ::LC_NUMERIC_MASK
+ | ::LC_TIME_MASK
+ | ::LC_COLLATE_MASK
+ | ::LC_MONETARY_MASK
+ | ::LC_MESSAGES_MASK
+ | LC_PAPER_MASK
+ | LC_NAME_MASK
+ | LC_ADDRESS_MASK
+ | LC_TELEPHONE_MASK
+ | LC_MEASUREMENT_MASK
+ | LC_IDENTIFICATION_MASK;
+
pub const MAP_ANON: ::c_int = 0x0020;
pub const MAP_ANONYMOUS: ::c_int = 0x0020;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -543,6 +568,7 @@ pub const TIOCCONS: ::c_int = 0x541D;
pub const RTLD_GLOBAL: ::c_int = 0x2;
pub const RTLD_NOLOAD: ::c_int = 0x4;
pub const RTLD_NOW: ::c_int = 0;
+pub const RTLD_DEFAULT: *mut ::c_void = -1isize as *mut ::c_void;
f! {
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int {
diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs
index 1e8603da80..de17e488b8 100644
--- a/src/unix/notbsd/linux/mips.rs
+++ b/src/unix/notbsd/linux/mips.rs
@@ -294,6 +294,31 @@ pub const EOWNERDEAD: ::c_int = 165;
pub const ENOTRECOVERABLE: ::c_int = 166;
pub const ERFKILL: ::c_int = 167;
+pub const LC_PAPER: ::c_int = 7;
+pub const LC_NAME: ::c_int = 8;
+pub const LC_ADDRESS: ::c_int = 9;
+pub const LC_TELEPHONE: ::c_int = 10;
+pub const LC_MEASUREMENT: ::c_int = 11;
+pub const LC_IDENTIFICATION: ::c_int = 12;
+pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
+pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
+pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
+pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
+pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
+pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
+pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
+ | ::LC_NUMERIC_MASK
+ | ::LC_TIME_MASK
+ | ::LC_COLLATE_MASK
+ | ::LC_MONETARY_MASK
+ | ::LC_MESSAGES_MASK
+ | LC_PAPER_MASK
+ | LC_NAME_MASK
+ | LC_ADDRESS_MASK
+ | LC_TELEPHONE_MASK
+ | LC_MEASUREMENT_MASK
+ | LC_IDENTIFICATION_MASK;
+
pub const MAP_NORESERVE: ::c_int = 0x400;
pub const MAP_ANON: ::c_int = 0x800;
pub const MAP_ANONYMOUS: ::c_int = 0x800;
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index 28de796e9c..c31ed0c086 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -15,6 +15,7 @@ pub type key_t = ::c_int;
pub type shmatt_t = ::c_ulong;
pub type mqd_t = ::c_int;
pub type nfds_t = ::c_ulong;
+pub type nl_item = ::c_int;
pub enum fpos64_t {} // TODO: fill this out with a struct
@@ -178,6 +179,74 @@ s! {
}
}
+pub const ABDAY_1: ::nl_item = 0x20000;
+pub const ABDAY_2: ::nl_item = 0x20001;
+pub const ABDAY_3: ::nl_item = 0x20002;
+pub const ABDAY_4: ::nl_item = 0x20003;
+pub const ABDAY_5: ::nl_item = 0x20004;
+pub const ABDAY_6: ::nl_item = 0x20005;
+pub const ABDAY_7: ::nl_item = 0x20006;
+
+pub const DAY_1: ::nl_item = 0x20007;
+pub const DAY_2: ::nl_item = 0x20008;
+pub const DAY_3: ::nl_item = 0x20009;
+pub const DAY_4: ::nl_item = 0x2000A;
+pub const DAY_5: ::nl_item = 0x2000B;
+pub const DAY_6: ::nl_item = 0x2000C;
+pub const DAY_7: ::nl_item = 0x2000D;
+
+pub const ABMON_1: ::nl_item = 0x2000E;
+pub const ABMON_2: ::nl_item = 0x2000F;
+pub const ABMON_3: ::nl_item = 0x20010;
+pub const ABMON_4: ::nl_item = 0x20011;
+pub const ABMON_5: ::nl_item = 0x20012;
+pub const ABMON_6: ::nl_item = 0x20013;
+pub const ABMON_7: ::nl_item = 0x20014;
+pub const ABMON_8: ::nl_item = 0x20015;
+pub const ABMON_9: ::nl_item = 0x20016;
+pub const ABMON_10: ::nl_item = 0x20017;
+pub const ABMON_11: ::nl_item = 0x20018;
+pub const ABMON_12: ::nl_item = 0x20019;
+
+pub const MON_1: ::nl_item = 0x2001A;
+pub const MON_2: ::nl_item = 0x2001B;
+pub const MON_3: ::nl_item = 0x2001C;
+pub const MON_4: ::nl_item = 0x2001D;
+pub const MON_5: ::nl_item = 0x2001E;
+pub const MON_6: ::nl_item = 0x2001F;
+pub const MON_7: ::nl_item = 0x20020;
+pub const MON_8: ::nl_item = 0x20021;
+pub const MON_9: ::nl_item = 0x20022;
+pub const MON_10: ::nl_item = 0x20023;
+pub const MON_11: ::nl_item = 0x20024;
+pub const MON_12: ::nl_item = 0x20025;
+
+pub const AM_STR: ::nl_item = 0x20026;
+pub const PM_STR: ::nl_item = 0x20027;
+
+pub const D_T_FMT: ::nl_item = 0x20028;
+pub const D_FMT: ::nl_item = 0x20029;
+pub const T_FMT: ::nl_item = 0x2002A;
+pub const T_FMT_AMPM: ::nl_item = 0x2002B;
+
+pub const ERA: ::nl_item = 0x2002C;
+pub const ERA_D_FMT: ::nl_item = 0x2002E;
+pub const ALT_DIGITS: ::nl_item = 0x2002F;
+pub const ERA_D_T_FMT: ::nl_item = 0x20030;
+pub const ERA_T_FMT: ::nl_item = 0x20031;
+
+pub const CODESET: ::nl_item = 14;
+
+pub const CRNCYSTR: ::nl_item = 0x4000F;
+
+pub const RADIXCHAR: ::nl_item = 0x10000;
+pub const THOUSEP: ::nl_item = 0x10001;
+
+pub const YESEXPR: ::nl_item = 0x50000;
+pub const NOEXPR: ::nl_item = 0x50001;
+pub const YESSTR: ::nl_item = 0x50002;
+pub const NOSTR: ::nl_item = 0x50003;
+
pub const FILENAME_MAX: ::c_uint = 4096;
pub const L_tmpnam: ::c_uint = 20;
pub const _PC_NAME_MAX: ::c_int = 3;
@@ -398,6 +467,7 @@ f! {
}
}
+#[link(name = "util")]
extern {
pub fn shm_open(name: *const c_char, oflag: ::c_int,
mode: mode_t) -> ::c_int;
@@ -531,6 +601,16 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t,
info: *mut siginfo_t) -> ::c_int;
+ pub fn openpty(amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize) -> ::c_int;
+ pub fn forkpty(amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize) -> ::pid_t;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
}
cfg_if! {
diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs
index 1cbfd8f25e..cd04d851a5 100644
--- a/src/unix/notbsd/linux/musl/mod.rs
+++ b/src/unix/notbsd/linux/musl/mod.rs
@@ -148,6 +148,11 @@ pub const TIOCINQ: ::c_ulong = ::FIONREAD;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const RTLD_NOLOAD: ::c_int = 0x4;
+// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
+// kernel 3.10). See also notbsd/mod.rs
+pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+pub const CLOCK_TAI: ::clockid_t = 11;
+
extern {
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index 3ac57fe7e9..18b96f523a 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -143,6 +143,31 @@ pub const O_FSYNC: ::c_int = 0x101000;
pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
+pub const LC_PAPER: ::c_int = 7;
+pub const LC_NAME: ::c_int = 8;
+pub const LC_ADDRESS: ::c_int = 9;
+pub const LC_TELEPHONE: ::c_int = 10;
+pub const LC_MEASUREMENT: ::c_int = 11;
+pub const LC_IDENTIFICATION: ::c_int = 12;
+pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER);
+pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
+pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
+pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
+pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
+pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
+pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
+ | ::LC_NUMERIC_MASK
+ | ::LC_TIME_MASK
+ | ::LC_COLLATE_MASK
+ | ::LC_MONETARY_MASK
+ | ::LC_MESSAGES_MASK
+ | LC_PAPER_MASK
+ | LC_NAME_MASK
+ | LC_ADDRESS_MASK
+ | LC_TELEPHONE_MASK
+ | LC_MEASUREMENT_MASK
+ | LC_IDENTIFICATION_MASK;
+
pub const MAP_ANON: ::c_int = 0x0020;
pub const MAP_ANONYMOUS: ::c_int = 0x0020;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index d9d2013178..9914c0bb0a 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -5,6 +5,7 @@ pub type pthread_key_t = ::c_uint;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type loff_t = ::c_longlong;
+pub type clockid_t = ::c_int;
pub enum timezone {}
@@ -131,6 +132,33 @@ s! {
pub machine: [::c_char; 65],
pub domainname: [::c_char; 65]
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
// intentionally not public, only used for fd_set
@@ -176,8 +204,20 @@ pub const SIGTRAP: ::c_int = 5;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
-pub const CLOCK_REALTIME: ::c_int = 0;
-pub const CLOCK_MONOTONIC: ::c_int = 1;
+pub const CLOCK_REALTIME: clockid_t = 0;
+pub const CLOCK_MONOTONIC: clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
+pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
+pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
+pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
+pub const CLOCK_BOOTTIME: clockid_t = 7;
+pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
+pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
+// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
+// 2014.) See also musl/mod.rs
+// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
+// pub const CLOCK_TAI: clockid_t = 11;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -244,6 +284,21 @@ pub const PROT_READ: ::c_int = 1;
pub const PROT_WRITE: ::c_int = 2;
pub const PROT_EXEC: ::c_int = 4;
+pub const LC_CTYPE: ::c_int = 0;
+pub const LC_NUMERIC: ::c_int = 1;
+pub const LC_TIME: ::c_int = 2;
+pub const LC_COLLATE: ::c_int = 3;
+pub const LC_MONETARY: ::c_int = 4;
+pub const LC_MESSAGES: ::c_int = 5;
+pub const LC_ALL: ::c_int = 6;
+pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
+pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
+pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
+pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
+// LC_ALL_MASK defined per platform
+
pub const MAP_FILE: ::c_int = 0x0000;
pub const MAP_SHARED: ::c_int = 0x0001;
pub const MAP_PRIVATE: ::c_int = 0x0002;
@@ -631,7 +686,8 @@ extern {
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
- pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::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 prctl(option: ::c_int, ...) -> ::c_int;
pub fn pthread_getattr_np(native: ::pthread_t,
attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -700,6 +756,12 @@ extern {
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 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 uselocale(loc: ::locale_t) -> ::locale_t;
}
cfg_if! {
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index 4ad520c8ff..e91caaf4e0 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -1,6 +1,7 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type clockid_t = ::c_int;
pub type blkcnt_t = i64;
pub type clock_t = i64;
@@ -30,6 +31,7 @@ pub type pthread_t = ::uintptr_t;
pub type pthread_key_t = ::c_uint;
pub type blksize_t = u32;
pub type fflags_t = u32;
+pub type nl_item = ::c_int;
pub enum timezone {}
@@ -271,8 +273,121 @@ s! {
pub c_lflag: ::tcflag_t,
pub c_cc: [::cc_t; ::NCCS]
}
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
}
+pub const LC_CTYPE: ::c_int = 0;
+pub const LC_NUMERIC: ::c_int = 1;
+pub const LC_TIME: ::c_int = 2;
+pub const LC_COLLATE: ::c_int = 3;
+pub const LC_MONETARY: ::c_int = 4;
+pub const LC_MESSAGES: ::c_int = 5;
+pub const LC_ALL: ::c_int = 6;
+pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
+pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
+pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
+pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
+pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
+pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
+pub const LC_ALL_MASK: ::c_int = LC_CTYPE_MASK
+ | LC_NUMERIC_MASK
+ | LC_TIME_MASK
+ | LC_COLLATE_MASK
+ | LC_MONETARY_MASK
+ | LC_MESSAGES_MASK;
+
+pub const DAY_1: ::nl_item = 1;
+pub const DAY_2: ::nl_item = 2;
+pub const DAY_3: ::nl_item = 3;
+pub const DAY_4: ::nl_item = 4;
+pub const DAY_5: ::nl_item = 5;
+pub const DAY_6: ::nl_item = 6;
+pub const DAY_7: ::nl_item = 7;
+
+pub const ABDAY_1: ::nl_item = 8;
+pub const ABDAY_2: ::nl_item = 9;
+pub const ABDAY_3: ::nl_item = 10;
+pub const ABDAY_4: ::nl_item = 11;
+pub const ABDAY_5: ::nl_item = 12;
+pub const ABDAY_6: ::nl_item = 13;
+pub const ABDAY_7: ::nl_item = 14;
+
+pub const MON_1: ::nl_item = 15;
+pub const MON_2: ::nl_item = 16;
+pub const MON_3: ::nl_item = 17;
+pub const MON_4: ::nl_item = 18;
+pub const MON_5: ::nl_item = 19;
+pub const MON_6: ::nl_item = 20;
+pub const MON_7: ::nl_item = 21;
+pub const MON_8: ::nl_item = 22;
+pub const MON_9: ::nl_item = 23;
+pub const MON_10: ::nl_item = 24;
+pub const MON_11: ::nl_item = 25;
+pub const MON_12: ::nl_item = 26;
+
+pub const ABMON_1: ::nl_item = 27;
+pub const ABMON_2: ::nl_item = 28;
+pub const ABMON_3: ::nl_item = 29;
+pub const ABMON_4: ::nl_item = 30;
+pub const ABMON_5: ::nl_item = 31;
+pub const ABMON_6: ::nl_item = 32;
+pub const ABMON_7: ::nl_item = 33;
+pub const ABMON_8: ::nl_item = 34;
+pub const ABMON_9: ::nl_item = 35;
+pub const ABMON_10: ::nl_item = 36;
+pub const ABMON_11: ::nl_item = 37;
+pub const ABMON_12: ::nl_item = 38;
+
+pub const RADIXCHAR: ::nl_item = 39;
+pub const THOUSEP: ::nl_item = 40;
+pub const YESSTR: ::nl_item = 41;
+pub const NOSTR: ::nl_item = 42;
+pub const CRNCYSTR: ::nl_item = 43;
+
+pub const D_T_FMT: ::nl_item = 44;
+pub const D_FMT: ::nl_item = 45;
+pub const T_FMT: ::nl_item = 46;
+pub const AM_STR: ::nl_item = 47;
+pub const PM_STR: ::nl_item = 48;
+
+pub const CODESET: ::nl_item = 49;
+pub const T_FMT_AMPM: ::nl_item = 50;
+pub const ERA: ::nl_item = 51;
+pub const ERA_D_FMT: ::nl_item = 52;
+pub const ERA_D_T_FMT: ::nl_item = 53;
+pub const ERA_T_FMT: ::nl_item = 54;
+pub const ALT_DIGITS: ::nl_item = 55;
+pub const YESEXPR: ::nl_item = 56;
+pub const NOEXPR: ::nl_item = 57;
+pub const _DATE_FMT: ::nl_item = 58;
+pub const MAXSTRMSG: ::nl_item = 58;
+
pub const SA_ONSTACK: ::c_int = 0x00000001;
pub const SA_RESETHAND: ::c_int = 0x00000002;
pub const SA_RESTART: ::c_int = 0x00000004;
@@ -540,8 +655,18 @@ pub const PTHREAD_STACK_MIN: ::size_t = 4096;
pub const SIGSTKSZ: ::size_t = 8192;
-pub const CLOCK_REALTIME: ::c_int = 3;
-pub const CLOCK_MONOTONIC: ::c_int = 4;
+// https://illumos.org/man/3c/clock_gettime
+// https://github.com/illumos/illumos-gate/
+// blob/HEAD/usr/src/lib/libc/amd64/sys/__clock_gettime.s
+// clock_gettime(3c) doesn't seem to accept anything other than CLOCK_REALTIME
+// or __CLOCK_REALTIME0
+//
+// https://github.com/illumos/illumos-gate/
+// blob/HEAD/usr/src/uts/common/sys/time_impl.h
+// Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4
+// __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
+pub const CLOCK_REALTIME: clockid_t = 3;
+pub const CLOCK_MONOTONIC: clockid_t = 4;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -752,7 +877,8 @@ extern {
pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::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 getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -766,5 +892,12 @@ extern {
buflen: ::size_t) -> *const passwd;
pub fn readdir(dirp: *mut ::DIR) -> *const ::dirent;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ 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 uselocale(loc: ::locale_t) -> ::locale_t;
}