aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
committerDaniel Mueller <deso@posteo.net>2018-12-10 21:00:27 -0800
commite2604a756aaddcd5919ee2f1b9cc0055d200f846 (patch)
tree1ea1b9900db20d3aadbddbce18882d0c957247d7 /libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
parent5875df6c958743cf86c75b2cb5fc2efe5ca0de43 (diff)
downloadnitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.gz
nitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.bz2
Update libc crate to 0.2.45
This change updates the libc crate to version 0.2.45. Import subrepo libc/:libc at f5636fc618f8e16968b3178196d73c94ad9f7b05
Diffstat (limited to 'libc/src/unix/bsd/netbsdlike/netbsd/mod.rs')
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/mod.rs160
1 files changed, 150 insertions, 10 deletions
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 4c528b5..55b8f4c 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -1,6 +1,5 @@
use dox::mem;
-pub type c_char = i8;
pub type clock_t = ::c_uint;
pub type suseconds_t = ::c_int;
pub type dev_t = u64;
@@ -9,6 +8,7 @@ pub type fsblkcnt_t = ::uint64_t;
pub type fsfilcnt_t = ::uint64_t;
pub type idtype_t = ::c_int;
pub type mqd_t = ::c_int;
+type __pthread_spin_t = __cpu_simple_lock_nv_t;
s! {
pub struct aiocb {
@@ -161,9 +161,14 @@ s! {
pub struct pthread_mutex_t {
ptm_magic: ::c_uint,
- ptm_errorcheck: ::c_uchar,
+ ptm_errorcheck: __pthread_spin_t,
+ #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
+ target_arch = "x86", target_arch = "x86_64"))]
ptm_pad1: [u8; 3],
- ptm_interlock: ::c_uchar,
+ // actually a union with a non-unused, 0-initialized field
+ ptm_unused: __pthread_spin_t,
+ #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
+ target_arch = "x86", target_arch = "x86_64"))]
ptm_pad2: [u8; 3],
ptm_owner: ::pthread_t,
ptm_waiters: *mut u8,
@@ -183,7 +188,7 @@ s! {
pub struct pthread_cond_t {
ptc_magic: ::c_uint,
- ptc_lock: ::c_uchar,
+ ptc_lock: __pthread_spin_t,
ptc_waiters_first: *mut u8,
ptc_waiters_last: *mut u8,
ptc_mutex: *mut ::pthread_mutex_t,
@@ -197,7 +202,7 @@ s! {
pub struct pthread_rwlock_t {
ptr_magic: ::c_uint,
- ptr_interlock: ::c_uchar,
+ ptr_interlock: __pthread_spin_t,
ptr_rblocked_first: *mut u8,
ptr_rblocked_last: *mut u8,
ptr_wblocked_first: *mut u8,
@@ -313,6 +318,20 @@ s! {
pub sdl_slen: ::uint8_t,
pub sdl_data: [::c_char; 12],
}
+
+ pub struct in_pktinfo {
+ pub ipi_addr: ::in_addr,
+ pub ipi_ifindex: ::c_uint,
+ }
+
+ #[repr(packed)]
+ pub struct arphdr {
+ pub ar_hrd: u16,
+ pub ar_pro: u16,
+ pub ar_hln: u8,
+ pub ar_pln: u8,
+ pub ar_op: u16,
+ }
}
pub const AT_FDCWD: ::c_int = -100;
@@ -321,6 +340,9 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
pub const AT_REMOVEDIR: ::c_int = 0x800;
+pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
+pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
+
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);
@@ -371,9 +393,19 @@ pub const F_GETNOSIGPIPE: ::c_int = 13;
pub const F_SETNOSIGPIPE: ::c_int = 14;
pub const F_MAXFD: ::c_int = 11;
+pub const IP_PKTINFO: ::c_int = 25;
+pub const IP_RECVPKTINFO: ::c_int = 26;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
+pub const TCP_KEEPIDLE: ::c_int = 3;
+pub const TCP_KEEPINTVL: ::c_int = 5;
+pub const TCP_KEEPCNT: ::c_int = 6;
+pub const TCP_KEEPINIT: ::c_int = 7;
+pub const TCP_INFO: ::c_int = 9;
+pub const TCP_MD5SIG: ::c_int = 0x10;
+pub const TCP_CONGCTL: ::c_int = 0x20;
+
pub const SOCK_CONN_DGRAM: ::c_int = 6;
pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
@@ -675,14 +707,19 @@ pub const ST_NOSUID: ::c_ulong = 8;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
ptm_magic: 0x33330003,
ptm_errorcheck: 0,
- ptm_interlock: 0,
- ptm_waiters: 0 as *mut _,
- ptm_owner: 0,
+ #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
+ target_arch = "x86", target_arch = "x86_64"))]
ptm_pad1: [0; 3],
+ ptm_unused: 0,
+ #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
+ target_arch = "x86", target_arch = "x86_64"))]
ptm_pad2: [0; 3],
+ ptm_waiters: 0 as *mut _,
+ ptm_owner: 0,
ptm_recursed: 0,
ptm_spare2: 0 as *mut _,
};
+
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
ptc_magic: 0x55550005,
ptc_lock: 0,
@@ -947,6 +984,22 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
+pub const SIGSTKSZ : ::size_t = 40960;
+
+pub const PT_DUMPCORE: ::c_int = 12;
+pub const PT_LWPINFO: ::c_int = 13;
+pub const PT_SYSCALL: ::c_int = 14;
+pub const PT_SYSCALLEMU: ::c_int = 15;
+pub const PT_SET_EVENT_MASK: ::c_int = 16;
+pub const PT_GET_EVENT_MASK: ::c_int = 17;
+pub const PT_GET_PROCESS_STATE: ::c_int = 18;
+pub const PT_FIRSTMACH: ::c_int = 32;
+
+// Flags for chflags(2)
+pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
+pub const SF_LOG: ::c_ulong = 0x00400000;
+pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
+
// dirfd() is a macro on netbsd to access
// the first field of the struct where dirp points to:
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
@@ -982,6 +1035,55 @@ extern {
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+ pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
+ pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
+ pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
+
+ pub fn extattr_delete_fd(fd: ::c_int,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char) -> ::c_int;
+ pub fn extattr_delete_file(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char) -> ::c_int;
+ pub fn extattr_delete_link(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char) -> ::c_int;
+ pub fn extattr_get_fd(fd: ::c_int,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *mut ::c_void,
+ nbytes: ::size_t) -> ::ssize_t;
+ pub fn extattr_get_file(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *mut ::c_void,
+ nbytes: ::size_t) -> ::ssize_t;
+ pub fn extattr_get_link(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *mut ::c_void,
+ nbytes: ::size_t) -> ::ssize_t;
+ pub fn extattr_namespace_to_string(attrnamespace: ::c_int,
+ string: *mut *mut ::c_char) -> ::c_int;
+ pub fn extattr_set_fd(fd: ::c_int,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *const ::c_void,
+ nbytes: ::size_t) -> ::c_int;
+ pub fn extattr_set_file(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *const ::c_void,
+ nbytes: ::size_t) -> ::c_int;
+ pub fn extattr_set_link(path: *const ::c_char,
+ attrnamespace: ::c_int,
+ attrname: *const ::c_char,
+ data: *const ::c_void,
+ nbytes: ::size_t) -> ::c_int;
+ pub fn extattr_string_to_namespace(string: *const ::c_char,
+ attrnamespace: *mut ::c_int) -> ::c_int;
+
+ #[link_name = "__lutimes50"]
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -1033,11 +1135,13 @@ extern {
pub fn mq_setattr(mqd: ::mqd_t,
newattr: *const ::mq_attr,
oldattr: *mut ::mq_attr) -> ::c_int;
+ #[link_name = "__mq_timedreceive50"]
pub fn mq_timedreceive(mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
msg_len: ::size_t,
msq_prio: *mut ::c_uint,
abs_timeout: *const ::timespec) -> ::ssize_t;
+ #[link_name = "__mq_timedsend50"]
pub fn mq_timedsend(mqd: ::mqd_t,
msg_ptr: *const ::c_char,
msg_len: ::size_t,
@@ -1072,7 +1176,43 @@ extern {
base: ::locale_t) -> ::locale_t;
#[link_name = "__settimeofday50"]
pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
+
+ pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
}
-mod other;
-pub use self::other::*;
+#[link(name = "util")]
+extern {
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
+ pub fn getpwent_r(pwd: *mut ::passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::passwd) -> ::c_int;
+ pub fn getgrent_r(grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
+ } else if #[cfg(target_arch = "arm")] {
+ mod arm;
+ pub use self::arm::*;
+ } else if #[cfg(target_arch = "powerpc")] {
+ mod powerpc;
+ pub use self::powerpc::*;
+ } else if #[cfg(target_arch = "sparc64")] {
+ mod sparc64;
+ pub use self::sparc64::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "x86")] {
+ mod x86;
+ pub use self::x86::*;
+ } else {
+ // Unknown target_arch
+ }
+}