aboutsummaryrefslogtreecommitdiff
path: root/src/unix/bsd/netbsdlike/netbsd/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/unix/bsd/netbsdlike/netbsd/mod.rs')
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs84
1 files changed, 77 insertions, 7 deletions
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 46035df3..c612689a 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_lock_nv_t;
pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
pub type lwpid_t = ::c_uint;
pub type shmatt_t = ::c_uint;
-pub type cpuid_t = u64;
+pub type cpuid_t = ::c_ulong;
pub type cpuset_t = _cpuset;
pub type pthread_spin_t = ::c_uchar;
pub type timer_t = ::c_int;
@@ -60,6 +60,39 @@ impl siginfo_t {
self.si_addr
}
+ pub unsafe fn si_code(&self) -> ::c_int {
+ self.si_code
+ }
+
+ pub unsafe fn si_errno(&self) -> ::c_int {
+ self.si_errno
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
+ _si_errno: ::c_int,
+ _si_code: ::c_int,
+ __pad1: ::c_int,
+ _pid: ::pid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
+ _si_errno: ::c_int,
+ _si_code: ::c_int,
+ __pad1: ::c_int,
+ _pid: ::pid_t,
+ _uid: ::uid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._uid
+ }
+
pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
@@ -1527,6 +1560,7 @@ pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
pub const SO_SNDTIMEO: ::c_int = 0x100b;
pub const SO_RCVTIMEO: ::c_int = 0x100c;
+pub const SO_NOSIGPIPE: ::c_int = 0x0800;
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
pub const SO_TIMESTAMP: ::c_int = 0x2000;
pub const SO_OVERFLOWED: ::c_int = 0x1009;
@@ -1852,6 +1886,9 @@ pub const MNT_NODEVMTIME: ::c_int = 0x40000000;
pub const MNT_SOFTDEP: ::c_int = 0x80000000;
pub const MNT_POSIX1EACLS: ::c_int = 0x00000800;
pub const MNT_ACLS: ::c_int = MNT_POSIX1EACLS;
+pub const MNT_WAIT: ::c_int = 1;
+pub const MNT_NOWAIT: ::c_int = 2;
+pub const MNT_LAZY: ::c_int = 3;
//<sys/timex.h>
pub const NTP_API: ::c_int = 4;
@@ -2529,12 +2566,6 @@ extern "C" {
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 execvpe(
- file: *const ::c_char,
- argv: *const *const ::c_char,
- envp: *const *const ::c_char,
- ) -> ::c_int;
-
pub fn extattr_list_fd(
fd: ::c_int,
attrnamespace: ::c_int,
@@ -2727,6 +2758,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -3153,6 +3185,38 @@ extern "C" {
pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
}
+#[link(name = "execinfo")]
+extern "C" {
+ pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
+ pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
+ pub fn backtrace_symbols_fd(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fd: ::c_int,
+ ) -> ::c_int;
+ pub fn backtrace_symbols_fmt(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fmt: *const ::c_char,
+ ) -> *mut *mut ::c_char;
+ pub fn backtrace_symbols_fd_fmt(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fd: ::c_int,
+ fmt: *const ::c_char,
+ ) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ extern {
+ // these functions use statvfs:
+ pub fn getmntinfo(mntbufp: *mut *mut ::statvfs, flags: ::c_int) -> ::c_int;
+ pub fn getvfsstat(buf: *mut statvfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int;
+ }
+ }
+}
+
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
@@ -3172,6 +3236,12 @@ cfg_if! {
} else if #[cfg(target_arch = "x86")] {
mod x86;
pub use self::x86::*;
+ } else if #[cfg(target_arch = "mips")] {
+ mod mips;
+ pub use self::mips::*;
+ } else if #[cfg(target_arch = "riscv64")] {
+ mod riscv64;
+ pub use self::riscv64::*;
} else {
// Unknown target_arch
}