summaryrefslogtreecommitdiff
path: root/libc/src/unix/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-01-15 09:30:24 -0800
committerDaniel Mueller <deso@posteo.net>2018-01-15 09:30:24 -0800
commitd8a58488bd56ef9c09e167173124c3519bc7405d (patch)
treef52c843b4862a8ce80b3912805638be5846166fc /libc/src/unix/mod.rs
parent7e6a449f276cd85ebd9201ef1a62aff3bc4d1595 (diff)
downloadnitrocli-d8a58488bd56ef9c09e167173124c3519bc7405d.tar.gz
nitrocli-d8a58488bd56ef9c09e167173124c3519bc7405d.tar.bz2
Update libc crate to 0.2.36
Import subrepo libc/:libc at 16a0f4a3d6c836f88f50c58f5d0a74a32cbf0193
Diffstat (limited to 'libc/src/unix/mod.rs')
-rw-r--r--libc/src/unix/mod.rs73
1 files changed, 59 insertions, 14 deletions
diff --git a/libc/src/unix/mod.rs b/libc/src/unix/mod.rs
index fcbc3eb..57067e0 100644
--- a/libc/src/unix/mod.rs
+++ b/libc/src/unix/mod.rs
@@ -34,9 +34,14 @@ s! {
pub tv_usec: suseconds_t,
}
+ // linux x32 compatibility
+ // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
pub struct timespec {
pub tv_sec: time_t,
- pub tv_nsec: c_long,
+ #[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 {
@@ -48,19 +53,47 @@ s! {
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,
pub ru_ixrss: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad2: u32,
pub ru_idrss: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad3: u32,
pub ru_isrss: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad4: u32,
pub ru_minflt: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad5: u32,
pub ru_majflt: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad6: u32,
pub ru_nswap: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad7: u32,
pub ru_inblock: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad8: u32,
pub ru_oublock: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad9: u32,
pub ru_msgsnd: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad10: u32,
pub ru_msgrcv: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad11: u32,
pub ru_nsignals: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad12: u32,
pub ru_nvcsw: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad13: u32,
pub ru_nivcsw: c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ __pad14: u32,
#[cfg(any(target_env = "musl", target_os = "emscripten"))]
__reserved: [c_long; 16],
@@ -138,6 +171,19 @@ s! {
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 SIG_DFL: sighandler_t = 0 as sighandler_t;
@@ -163,16 +209,8 @@ pub const S_ISUID: ::c_int = 0x800;
pub const S_ISGID: ::c_int = 0x400;
pub const S_ISVTX: ::c_int = 0x200;
-pub const POLLIN: ::c_short = 0x1;
-pub const POLLPRI: ::c_short = 0x2;
-pub const POLLOUT: ::c_short = 0x4;
-pub const POLLERR: ::c_short = 0x8;
-pub const POLLHUP: ::c_short = 0x10;
-pub const POLLNVAL: ::c_short = 0x20;
-
pub const IF_NAMESIZE: ::size_t = 16;
-
-pub const RTLD_LAZY: ::c_int = 0x1;
+pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
pub const LOG_EMERG: ::c_int = 0;
pub const LOG_ALERT: ::c_int = 1;
@@ -234,8 +272,8 @@ cfg_if! {
// on dox builds don't pull in anything
} else if #[cfg(target_os = "l4re")] {
// required libraries for L4Re are linked externally, ATM
- } else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
- // cargo build, don't pull in anything extra as the libstd dep
+ } else if #[cfg(feature = "use_std")] {
+ // cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
} else if #[cfg(any(all(target_env = "musl", not(target_arch = "mips"))))] {
#[link(name = "c", kind = "static", cfg(target_feature = "crt-static"))]
@@ -264,7 +302,7 @@ cfg_if! {
extern {}
} else if #[cfg(target_os = "fuchsia")] {
#[link(name = "c")]
- #[link(name = "mxio")]
+ #[link(name = "fdio")]
extern {}
} else if #[cfg(target_env = "newlib")] {
#[link(name = "c")]
@@ -708,7 +746,8 @@ extern {
#[cfg_attr(any(
all(target_os = "linux", not(target_env = "musl")),
target_os = "freebsd",
- target_os = "dragonfly"),
+ target_os = "dragonfly",
+ target_os = "haiku"),
link_name = "__res_init")]
#[cfg_attr(any(target_os = "macos", target_os = "ios"),
link_name = "res_9_init")]
@@ -728,12 +767,18 @@ extern {
pub fn gmtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
pub fn localtime(time_p: *const time_t) -> *mut tm;
+ #[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
+ pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
dev: ::dev_t) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::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 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")]