diff options
Diffstat (limited to 'vendor/libc/src/unix/bsd')
-rw-r--r-- | vendor/libc/src/unix/bsd/apple/mod.rs | 361 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 6 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 66 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/freebsdlike/mod.rs | 18 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/netbsdlike/mod.rs | 5 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs | 21 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 84 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 21 | ||||
-rw-r--r-- | vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs | 143 |
9 files changed, 699 insertions, 26 deletions
diff --git a/vendor/libc/src/unix/bsd/apple/mod.rs b/vendor/libc/src/unix/bsd/apple/mod.rs index a2fbf8767..21efb23eb 100644 --- a/vendor/libc/src/unix/bsd/apple/mod.rs +++ b/vendor/libc/src/unix/bsd/apple/mod.rs @@ -145,6 +145,16 @@ pub type CCRNGStatus = ::CCCryptorStatus; pub type copyfile_state_t = *mut ::c_void; pub type copyfile_flags_t = u32; +pub type copyfile_callback_t = ::Option< + extern "C" fn( + ::c_int, + ::c_int, + copyfile_state_t, + *const ::c_char, + *const ::c_char, + *mut ::c_void, + ) -> ::c_int, +>; pub type attrgroup_t = u32; pub type vol_capabilities_set_t = [u32; 4]; @@ -368,6 +378,25 @@ s! { pub fst_bytesalloc: ::off_t, } + pub struct fpunchhole_t { + pub fp_flags: ::c_uint, /* unused */ + pub reserved: ::c_uint, /* (to maintain 8-byte alignment) */ + pub fp_offset: ::off_t, /* IN: start of the region */ + pub fp_length: ::off_t, /* IN: size of the region */ + } + + pub struct ftrimactivefile_t { + pub fta_offset: ::off_t, + pub fta_length: ::off_t, + } + + pub struct fspecread_t { + pub fsr_flags: ::c_uint, + pub reserved: ::c_uint, + pub fsr_offset: ::off_t, + pub fsr_length: ::off_t, + } + pub struct radvisory { pub ra_offset: ::off_t, pub ra_count: ::c_int, @@ -768,7 +797,7 @@ s! { pub struct sockaddr_ndrv { pub snd_len: ::c_uchar, pub snd_family: ::c_uchar, - pub snd_name: [::c_uchar; 16] // IFNAMSIZ from if.h + pub snd_name: [::c_uchar; ::IFNAMSIZ], } // sys/socket.h @@ -1100,6 +1129,15 @@ s! { pub validattr: attribute_set_t, pub nativeattr: attribute_set_t, } + + #[cfg_attr(libc_packedN, repr(packed(4)))] + pub struct ifconf { + pub ifc_len: ::c_int, + #[cfg(libc_union)] + pub ifc_ifcu: __c_anonymous_ifc_ifcu, + #[cfg(not(libc_union))] + pub ifc_ifcu: *mut ifreq, + } } s_no_extra_traits! { @@ -1390,6 +1428,60 @@ s_no_extra_traits! { pub svm_port: ::c_uint, pub svm_cid: ::c_uint, } + + pub struct ifdevmtu { + pub ifdm_current: ::c_int, + pub ifdm_min: ::c_int, + pub ifdm_max: ::c_int, + } + + #[cfg(libc_union)] + pub union __c_anonymous_ifk_data { + pub ifk_ptr: *mut ::c_void, + pub ifk_value: ::c_int, + } + + #[cfg_attr(libc_packedN, repr(packed(4)))] + pub struct ifkpi { + pub ifk_module_id: ::c_uint, + pub ifk_type: ::c_uint, + #[cfg(libc_union)] + pub ifk_data: __c_anonymous_ifk_data, + } + + #[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_metrics: ::c_int, + pub ifru_mtu: ::c_int, + pub ifru_phys: ::c_int, + pub ifru_media: ::c_int, + pub ifru_intval: ::c_int, + pub ifru_data: *mut ::c_char, + pub ifru_devmtu: ifdevmtu, + pub ifru_kpi: ifkpi, + pub ifru_wake_flags: u32, + pub ifru_route_refcnt: u32, + pub ifru_cap: [::c_int; 2], + pub ifru_functional_type: u32, + } + + 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, + } + + #[cfg(libc_union)] + pub union __c_anonymous_ifc_ifcu { + pub ifcu_buf: *mut ::c_char, + pub ifcu_req: *mut ifreq, + } } impl siginfo_t { @@ -2738,6 +2830,222 @@ cfg_if! { svm_cid.hash(state); } } + + impl PartialEq for ifdevmtu { + fn eq(&self, other: &ifdevmtu) -> bool { + self.ifdm_current == other.ifdm_current + && self.ifdm_min == other.ifdm_min + && self.ifdm_max == other.ifdm_max + } + } + + impl Eq for ifdevmtu {} + + impl ::fmt::Debug for ifdevmtu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifdevmtu") + .field("ifdm_current", &self.ifdm_current) + .field("ifdm_min", &self.ifdm_min) + .field("ifdm_max", &self.ifdm_max) + .finish() + } + } + + impl ::hash::Hash for ifdevmtu { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + self.ifdm_current.hash(state); + self.ifdm_min.hash(state); + self.ifdm_max.hash(state); + } + } + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifk_data { + fn eq(&self, other: &__c_anonymous_ifk_data) -> bool { + unsafe { + self.ifk_ptr == other.ifk_ptr + && self.ifk_value == other.ifk_value + } + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifk_data {} + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifk_data { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("__c_anonymous_ifk_data") + .field("ifk_ptr", unsafe { &self.ifk_ptr }) + .field("ifk_value", unsafe { &self.ifk_value }) + .finish() + } + } + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifk_data { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + unsafe { + self.ifk_ptr.hash(state); + self.ifk_value.hash(state); + } + } + } + + impl PartialEq for ifkpi { + fn eq(&self, other: &ifkpi) -> bool { + self.ifk_module_id == other.ifk_module_id + && self.ifk_type == other.ifk_type + } + } + + impl Eq for ifkpi {} + + impl ::fmt::Debug for ifkpi { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifkpi") + .field("ifk_module_id", &self.ifk_module_id) + .field("ifk_type", &self.ifk_type) + .finish() + } + } + + impl ::hash::Hash for ifkpi { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + self.ifk_module_id.hash(state); + self.ifk_type.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_metrics == other.ifru_metrics + && self.ifru_mtu == other.ifru_mtu + && self.ifru_phys == other.ifru_phys + && self.ifru_media == other.ifru_media + && self.ifru_intval == other.ifru_intval + && self.ifru_data == other.ifru_data + && self.ifru_devmtu == other.ifru_devmtu + && self.ifru_kpi == other.ifru_kpi + && self.ifru_wake_flags == other.ifru_wake_flags + && self.ifru_route_refcnt == other.ifru_route_refcnt + && self.ifru_cap.iter().zip(other.ifru_cap.iter()).all(|(a,b)| a == b) + && self.ifru_functional_type == other.ifru_functional_type + } + } + } + + #[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_metrics", unsafe { &self.ifru_metrics }) + .field("ifru_mtu", unsafe { &self.ifru_mtu }) + .field("ifru_phys", unsafe { &self.ifru_phys }) + .field("ifru_media", unsafe { &self.ifru_media }) + .field("ifru_intval", unsafe { &self.ifru_intval }) + .field("ifru_data", unsafe { &self.ifru_data }) + .field("ifru_devmtu", unsafe { &self.ifru_devmtu }) + .field("ifru_kpi", unsafe { &self.ifru_kpi }) + .field("ifru_wake_flags", unsafe { &self.ifru_wake_flags }) + .field("ifru_route_refcnt", unsafe { &self.ifru_route_refcnt }) + .field("ifru_cap", unsafe { &self.ifru_cap }) + .field("ifru_functional_type", unsafe { &self.ifru_functional_type }) + .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_metrics.hash(state); + self.ifru_mtu.hash(state); + self.ifru_phys.hash(state); + self.ifru_media.hash(state); + self.ifru_intval.hash(state); + self.ifru_data.hash(state); + self.ifru_devmtu.hash(state); + self.ifru_kpi.hash(state); + self.ifru_wake_flags.hash(state); + self.ifru_route_refcnt.hash(state); + self.ifru_cap.hash(state); + self.ifru_functional_type.hash(state); + } + } + } + + impl PartialEq for ifreq { + fn eq(&self, other: &ifreq) -> bool { + self.ifr_name == other.ifr_name + && self.ifr_ifru == other.ifr_ifru + } + } + + impl Eq for ifreq {} + + impl ::fmt::Debug for ifreq { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifreq") + .field("ifr_name", &self.ifr_name) + .field("ifr_ifru", &self.ifr_ifru) + .finish() + } + } + + impl ::hash::Hash for ifreq { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + self.ifr_name.hash(state); + self.ifr_ifru.hash(state); + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifc_ifcu {} + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifc_ifcu { + fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { + unsafe { + self.ifcu_buf == other.ifcu_buf && + self.ifcu_req == other.ifcu_req + } + } + } + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifc_ifcu") + .field("ifcu_buf", unsafe { &self.ifcu_buf }) + .field("ifcu_req", unsafe { &self.ifcu_req }) + .finish() + } + } + + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifc_ifcu { + fn hash<H: ::hash::Hasher>(&self, state: &mut H) { + unsafe { self.ifcu_buf.hash(state) }; + unsafe { self.ifcu_req.hash(state) }; + } + } } } @@ -3231,6 +3539,9 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55; pub const F_NODIRECT: ::c_int = 62; pub const F_LOG2PHYS_EXT: ::c_int = 65; pub const F_BARRIERFSYNC: ::c_int = 85; +pub const F_PUNCHHOLE: ::c_int = 99; +pub const F_TRIM_ACTIVE_FILE: ::c_int = 100; +pub const F_SPECULATIVE_READ: ::c_int = 101; pub const F_GETPATH_NOFIRMLINK: ::c_int = 102; pub const F_ALLOCATECONTIG: ::c_uint = 0x02; @@ -4687,12 +4998,12 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000; pub const MNT_NOBLOCK: ::c_int = 0x00020000; // sys/spawn.h: -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; -pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40; -pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80; +pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001; +pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002; +pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004; +pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008; +pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040; +pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080; pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000; // sys/ipc.h: @@ -4911,6 +5222,19 @@ pub const COPYFILE_PROGRESS: ::c_int = 4; pub const COPYFILE_CONTINUE: ::c_int = 0; pub const COPYFILE_SKIP: ::c_int = 1; pub const COPYFILE_QUIT: ::c_int = 2; +pub const COPYFILE_STATE_SRC_FD: ::c_int = 1; +pub const COPYFILE_STATE_SRC_FILENAME: ::c_int = 2; +pub const COPYFILE_STATE_DST_FD: ::c_int = 3; +pub const COPYFILE_STATE_DST_FILENAME: ::c_int = 4; +pub const COPYFILE_STATE_QUARANTINE: ::c_int = 5; +pub const COPYFILE_STATE_STATUS_CB: ::c_int = 6; +pub const COPYFILE_STATE_STATUS_CTX: ::c_int = 7; +pub const COPYFILE_STATE_COPIED: ::c_int = 8; +pub const COPYFILE_STATE_XATTRNAME: ::c_int = 9; +pub const COPYFILE_STATE_WAS_CLONED: ::c_int = 10; +pub const COPYFILE_STATE_SRC_BSIZE: ::c_int = 11; +pub const COPYFILE_STATE_DST_BSIZE: ::c_int = 12; +pub const COPYFILE_STATE_BSIZE: ::c_int = 13; // <sys/attr.h> pub const ATTR_BIT_MAP_COUNT: ::c_ushort = 5; @@ -5734,6 +6058,18 @@ extern "C" { subpref: *mut ::cpu_subtype_t, ocount: *mut ::size_t, ) -> ::c_int; + pub fn posix_spawnattr_getbinpref_np( + attr: *const posix_spawnattr_t, + count: ::size_t, + pref: *mut ::cpu_type_t, + ocount: *mut ::size_t, + ) -> ::c_int; + pub fn posix_spawnattr_setbinpref_np( + attr: *mut posix_spawnattr_t, + count: ::size_t, + pref: *mut ::cpu_type_t, + ocount: *mut ::size_t, + ) -> ::c_int; pub fn posix_spawnattr_set_qos_class_np( attr: *mut posix_spawnattr_t, qos_class: ::qos_class_t, @@ -5819,6 +6155,10 @@ extern "C" { state: copyfile_state_t, flags: copyfile_flags_t, ) -> ::c_int; + pub fn copyfile_state_free(s: copyfile_state_t) -> ::c_int; + pub fn copyfile_state_alloc() -> copyfile_state_t; + pub fn copyfile_state_get(s: copyfile_state_t, flags: u32, dst: *mut ::c_void) -> ::c_int; + pub fn copyfile_state_set(s: copyfile_state_t, flags: u32, src: *const ::c_void) -> ::c_int; // Added in macOS 10.13 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1 @@ -6068,6 +6408,11 @@ extern "C" { dev: dev_t, ) -> ::c_int; pub fn freadlink(fd: ::c_int, buf: *mut ::c_char, size: ::size_t) -> ::c_int; + pub fn execvP( + file: *const ::c_char, + search_path: *const ::c_char, + argv: *const *mut ::c_char, + ) -> ::c_int; } pub unsafe fn mach_task_self() -> ::mach_port_t { @@ -6082,7 +6427,7 @@ cfg_if! { } } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { extern "C" { pub fn memmem( haystack: *const ::c_void, diff --git a/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs index b3a5be449..6ade7949a 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1678,6 +1678,12 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; + pub fn getmntinfo(mntbufp: *mut *mut ::statfs, flags: ::c_int) -> ::c_int; + pub fn getmntvinfo( + mntbufp: *mut *mut ::statfs, + mntvbufp: *mut *mut ::statvfs, + flags: ::c_int, + ) -> ::c_int; } #[link(name = "rt")] diff --git a/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs index 4138af576..c654ae42e 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -365,9 +365,13 @@ s! { } pub struct cpuset_t { - #[cfg(target_pointer_width = "64")] + #[cfg(all(freebsd14, target_pointer_width = "64"))] + __bits: [::c_long; 16], + #[cfg(all(freebsd14, target_pointer_width = "32"))] + __bits: [::c_long; 32], + #[cfg(all(not(freebsd14), target_pointer_width = "64"))] __bits: [::c_long; 4], - #[cfg(target_pointer_width = "32")] + #[cfg(all(not(freebsd14), target_pointer_width = "32"))] __bits: [::c_long; 8], } @@ -967,6 +971,8 @@ s! { pub ifc_len: ::c_int, #[cfg(libc_union)] pub ifc_ifcu: __c_anonymous_ifc_ifcu, + #[cfg(not(libc_union))] + pub ifc_ifcu: *mut ifreq, } pub struct au_mask_t { @@ -996,6 +1002,8 @@ s! { pub pcbcnt: u32, } + // Note: this structure will change in a backwards-incompatible way in + // FreeBSD 15. pub struct tcp_info { pub tcpi_state: u8, pub __tcpi_ca_state: u8, @@ -1053,7 +1061,21 @@ s! { #[cfg(freebsd14)] pub __tcpi_received_ce_bytes: u32, #[cfg(freebsd14)] - pub __tcpi_pad: [u32; 19], + pub tcpi_total_tlp: u32, + #[cfg(freebsd14)] + pub tcpi_total_tlp_bytes: u64, + #[cfg(freebsd14)] + pub tcpi_snd_una: u32, + #[cfg(freebsd14)] + pub tcpi_snd_max: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_numsacks: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_adv: u32, + #[cfg(freebsd14)] + pub tcpi_dupacks: u32, + #[cfg(freebsd14)] + pub __tcpi_pad: [u32; 10], #[cfg(not(freebsd14))] pub __tcpi_pad: [u32; 26], } @@ -2597,7 +2619,13 @@ pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4; pub const DEVSTAT_NAME_LEN: ::c_int = 16; // sys/cpuset.h -pub const CPU_SETSIZE: ::c_int = 256; +cfg_if! { + if #[cfg(freebsd14)] { + pub const CPU_SETSIZE: ::c_int = 1024; + } else { + pub const CPU_SETSIZE: ::c_int = 256; + } +} pub const SIGEV_THREAD_ID: ::c_int = 4; @@ -2664,7 +2692,9 @@ pub const Q_SETQUOTA: ::c_int = 0x800; pub const MAP_GUARD: ::c_int = 0x00002000; pub const MAP_EXCL: ::c_int = 0x00004000; pub const MAP_PREFAULT_READ: ::c_int = 0x00040000; -pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24; +pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24; +pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT; +pub const MAP_ALIGNED_SUPER: ::c_int = 1 << MAP_ALIGNMENT_SHIFT; pub const POSIX_FADV_NORMAL: ::c_int = 0; pub const POSIX_FADV_RANDOM: ::c_int = 1; @@ -3168,6 +3198,7 @@ pub const IFF_LOOPBACK: ::c_int = 0x8; /// (i) is a point-to-point link pub const IFF_POINTOPOINT: ::c_int = 0x10; /// (i) calls if_input in net epoch +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_KNOWSEPOCH: ::c_int = 0x20; /// (d) resources allocated pub const IFF_RUNNING: ::c_int = 0x40; @@ -3215,6 +3246,7 @@ pub const IFF_DYING: ::c_int = 0x200000; /// (n) interface is being renamed pub const IFF_RENAMING: ::c_int = 0x400000; /// interface is not part of any groups +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_NOGROUP: ::c_int = 0x800000; /// link invalid/unknown @@ -4693,6 +4725,11 @@ pub const RB_POWERCYCLE: ::c_int = 0x400000; pub const RB_PROBE: ::c_int = 0x10000000; pub const RB_MULTIPLE: ::c_int = 0x20000000; +// sys/timerfd.h + +pub const TFD_NONBLOCK: ::c_int = ::O_NONBLOCK; +pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; + cfg_if! { if #[cfg(libc_const_extern_fn)] { pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int { @@ -4820,6 +4857,14 @@ f! { }; ::mem::size_of::<sockcred2>() + ::mem::size_of::<::gid_t>() * ngrps } + + pub fn PROT_MAX(x: ::c_int) -> ::c_int { + x << 16 + } + + pub fn PROT_MAX_EXTRACT(x: ::c_int) -> ::c_int { + (x >> 16) & (::PROT_READ | ::PROT_WRITE | ::PROT_EXEC) + } } safe_f! { @@ -5406,6 +5451,17 @@ extern "C" { infotype: *mut ::c_uint, flags: *mut ::c_int, ) -> ::ssize_t; + + pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int; + pub fn timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int; + pub fn timerfd_settime( + fd: ::c_int, + flags: ::c_int, + new_value: *const itimerspec, + old_value: *mut itimerspec, + ) -> ::c_int; + pub fn closefrom(lowfd: ::c_int); + pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int; } #[link(name = "memstat")] diff --git a/vendor/libc/src/unix/bsd/freebsdlike/mod.rs b/vendor/libc/src/unix/bsd/freebsdlike/mod.rs index fe69ca420..d2cd7794b 100644 --- a/vendor/libc/src/unix/bsd/freebsdlike/mod.rs +++ b/vendor/libc/src/unix/bsd/freebsdlike/mod.rs @@ -1590,6 +1590,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, @@ -1645,6 +1646,12 @@ extern "C" { pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int; pub fn pthread_get_name_np(tid: ::pthread_t, name: *mut ::c_char, len: ::size_t); pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); + pub fn pthread_getname_np( + thread: ::pthread_t, + buffer: *mut ::c_char, + length: ::size_t, + ) -> ::c_int; + pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int; pub fn pthread_setschedparam( native: ::pthread_t, policy: ::c_int, @@ -1771,6 +1778,17 @@ extern "C" { len: ::c_int, ) -> ::c_int; pub fn reboot(howto: ::c_int) -> ::c_int; + + pub fn exect( + path: *const ::c_char, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn execvP( + file: *const ::c_char, + search_path: *const ::c_char, + argv: *const *mut ::c_char, + ) -> ::c_int; } #[link(name = "rt")] 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, |