summaryrefslogtreecommitdiffstats
path: root/vendor/libc/src/unix/bsd/netbsdlike
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/libc/src/unix/bsd/netbsdlike')
-rw-r--r--vendor/libc/src/unix/bsd/netbsdlike/mod.rs5
-rw-r--r--vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs21
-rw-r--r--vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs84
-rw-r--r--vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs21
-rw-r--r--vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs143
5 files changed, 261 insertions, 13 deletions
diff --git a/vendor/libc/src/unix/bsd/netbsdlike/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/mod.rs
index c43a4b9e8..a787ac6db 100644
--- a/vendor/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/vendor/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -736,6 +736,11 @@ extern "C" {
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn execvpe(
+ file: *const ::c_char,
+ argv: *const *const ::c_char,
+ envp: *const *const ::c_char,
+ ) -> ::c_int;
}
extern "C" {
diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs
new file mode 100644
index 000000000..a536254ce
--- /dev/null
+++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs
@@ -0,0 +1,21 @@
+use PT_FIRSTMACH;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type c_char = i8;
+pub type __cpu_simple_lock_nv_t = ::c_int;
+
+cfg_if! {
+ if #[cfg(libc_const_size_of)] {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
+ } else {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = 8 - 1;
+ }
+}
+
+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 46035df31..c612689a5 100644
--- a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/vendor/libc/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
}
diff --git a/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
new file mode 100644
index 000000000..bc09149ef
--- /dev/null
+++ b/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
@@ -0,0 +1,21 @@
+use PT_FIRSTMACH;
+
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type c_char = u8;
+pub type __cpu_simple_lock_nv_t = ::c_int;
+
+cfg_if! {
+ if #[cfg(libc_const_size_of)] {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
+ } else {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = 8 - 1;
+ }
+}
+
+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs b/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 5455bd344..ea90ba780 100644
--- a/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -533,6 +533,14 @@ s! {
pub key: *mut ::c_char,
pub data: *mut ::c_void,
}
+
+ pub struct ifreq {
+ pub ifr_name: [::c_char; ::IFNAMSIZ],
+ #[cfg(libc_union)]
+ pub ifr_ifru: __c_anonymous_ifr_ifru,
+ #[cfg(not(libc_union))]
+ pub ifr_ifru: ::sockaddr,
+ }
}
impl siginfo_t {
@@ -540,12 +548,46 @@ impl siginfo_t {
self.si_addr
}
- pub unsafe fn si_value(&self) -> ::sigval {
+ 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_code: ::c_int,
+ _si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
+ _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_code: ::c_int,
_si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
+ _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 {
+ _si_signo: ::c_int,
_si_code: ::c_int,
+ _si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
_pid: ::pid_t,
_uid: ::uid_t,
value: ::sigval,
@@ -608,6 +650,18 @@ s_no_extra_traits! {
align: [::c_char; 160],
}
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifr_ifru {
+ pub ifru_addr: ::sockaddr,
+ pub ifru_dstaddr: ::sockaddr,
+ pub ifru_broadaddr: ::sockaddr,
+ pub ifru_flags: ::c_short,
+ pub ifru_metric: ::c_int,
+ pub ifru_vnetid: i64,
+ pub ifru_media: u64,
+ pub ifru_data: *mut ::c_char,
+ pub ifru_index: ::c_uint,
+ }
}
cfg_if! {
@@ -814,6 +868,60 @@ cfg_if! {
unsafe { self.align.hash(state) };
}
}
+
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_ifr_ifru {
+ fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
+ unsafe {
+ self.ifru_addr == other.ifru_addr
+ && self.ifru_dstaddr == other.ifru_dstaddr
+ && self.ifru_broadaddr == other.ifru_broadaddr
+ && self.ifru_flags == other.ifru_flags
+ && self.ifru_metric == other.ifru_metric
+ && self.ifru_vnetid == other.ifru_vnetid
+ && self.ifru_media == other.ifru_media
+ && self.ifru_data == other.ifru_data
+ && self.ifru_index == other.ifru_index
+ }
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_ifr_ifru {}
+
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifr_ifru {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("__c_anonymous_ifr_ifru")
+ .field("ifru_addr", unsafe { &self.ifru_addr })
+ .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr })
+ .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr })
+ .field("ifru_flags", unsafe { &self.ifru_flags })
+ .field("ifru_metric", unsafe { &self.ifru_metric })
+ .field("ifru_vnetid", unsafe { &self.ifru_vnetid })
+ .field("ifru_media", unsafe { &self.ifru_media })
+ .field("ifru_data", unsafe { &self.ifru_data })
+ .field("ifru_index", unsafe { &self.ifru_index })
+ .finish()
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_ifr_ifru {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe {
+ self.ifru_addr.hash(state);
+ self.ifru_dstaddr.hash(state);
+ self.ifru_broadaddr.hash(state);
+ self.ifru_flags.hash(state);
+ self.ifru_metric.hash(state);
+ self.ifru_vnetid.hash(state);
+ self.ifru_media.hash(state);
+ self.ifru_data.hash(state);
+ self.ifru_index.hash(state);
+ }
+ }
+ }
}
}
@@ -1578,6 +1686,9 @@ pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
pub const TMPFS_ARGS_VERSION: ::c_int = 1;
+const SI_MAXSZ: ::size_t = 128;
+const SI_PAD: ::size_t = (SI_MAXSZ / ::mem::size_of::<::c_int>()) - 3;
+
pub const MAP_STACK: ::c_int = 0x4000;
pub const MAP_CONCEAL: ::c_int = 0x8000;
@@ -1657,6 +1768,30 @@ pub const SF_ARCHIVED: ::c_uint = 0x00010000;
pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
pub const SF_APPEND: ::c_uint = 0x00040000;
+// sys/exec_elf.h - Legal values for p_type (segment type).
+pub const PT_NULL: u32 = 0;
+pub const PT_LOAD: u32 = 1;
+pub const PT_DYNAMIC: u32 = 2;
+pub const PT_INTERP: u32 = 3;
+pub const PT_NOTE: u32 = 4;
+pub const PT_SHLIB: u32 = 5;
+pub const PT_PHDR: u32 = 6;
+pub const PT_TLS: u32 = 7;
+pub const PT_LOOS: u32 = 0x60000000;
+pub const PT_HIOS: u32 = 0x6fffffff;
+pub const PT_LOPROC: u32 = 0x70000000;
+pub const PT_HIPROC: u32 = 0x7fffffff;
+
+pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
+pub const PT_GNU_RELRO: u32 = 0x6474e552;
+
+// sys/exec_elf.h - Legal values for p_flags (segment flags).
+pub const PF_X: u32 = 0x1;
+pub const PF_W: u32 = 0x2;
+pub const PF_R: u32 = 0x4;
+pub const PF_MASKOS: u32 = 0x0ff00000;
+pub const PF_MASKPROC: u32 = 0xf0000000;
+
// sys/mount.h
pub const MNT_NOPERM: ::c_int = 0x00000020;
pub const MNT_WXALLOWED: ::c_int = 0x00000800;
@@ -1779,11 +1914,6 @@ safe_f! {
extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
pub fn settimeofday(tp: *const ::timeval, tz: *const ::timezone) -> ::c_int;
- pub fn execvpe(
- file: *const ::c_char,
- argv: *const *const ::c_char,
- envp: *const *const ::c_char,
- ) -> ::c_int;
pub fn pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int;
pub fn unveil(path: *const ::c_char, permissions: *const ::c_char) -> ::c_int;
pub fn strtonum(
@@ -1827,6 +1957,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,