Skip to main content

libc/unix/linux_like/
mod.rs

1use crate::prelude::*;
2
3pub type sa_family_t = u16;
4pub type speed_t = c_uint;
5pub type tcflag_t = c_uint;
6pub type clockid_t = c_int;
7pub type timer_t = *mut c_void;
8pub type useconds_t = u32;
9pub type key_t = c_int;
10pub type id_t = c_uint;
11
12/// This is an extern type ("opaque" or "incomplete" type in C).
///
/// <div class="warning">
/// This type's current representation allows inspecting some properties, such as via
/// <code>size_of</code>, and it is technically possible to construct the type within
/// <code>MaybeUninit</code>, However, this <strong>MUST NOT</strong> be relied upon
/// because a future version of <code>libc</code> may switch to a proper
/// <a href="https://rust-lang.github.io/rfcs/1861-extern-types.html">extern type</a>
/// representation when available.
/// </div>
#[repr(C)]
pub struct timezone {
    _data: (),
    _marker: ::core::marker::PhantomData<(*mut u8,
    ::core::marker::PhantomPinned)>,
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for timezone { }
#[automatically_derived]
impl ::core::clone::Clone for timezone {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<()>;
        let _:
                ::core::clone::AssertParamIsClone<::core::marker::PhantomData<(*mut u8,
                ::core::marker::PhantomPinned)>>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for timezone { }
#[automatically_derived]
impl ::core::fmt::Debug for timezone {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "timezone",
            "_data", &self._data, "_marker", &&self._marker)
    }
}extern_ty! {
13    pub type timezone;
14}
15
16#[repr(C)]
#[allow(deprecated)]
pub struct in_addr {
    pub s_addr: crate::in_addr_t,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for in_addr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for in_addr {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::in_addr_t>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for in_addr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for in_addr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "in_addr",
            "s_addr", &&self.s_addr)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct ip_mreq {
    pub imr_multiaddr: in_addr,
    pub imr_interface: in_addr,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for ip_mreq { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for ip_mreq {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<in_addr>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for ip_mreq { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for ip_mreq {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "ip_mreq",
            "imr_multiaddr", &self.imr_multiaddr, "imr_interface",
            &&self.imr_interface)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct ip_mreqn {
    pub imr_multiaddr: in_addr,
    pub imr_address: in_addr,
    pub imr_ifindex: c_int,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for ip_mreqn { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for ip_mreqn {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<in_addr>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for ip_mreqn { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for ip_mreqn {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "ip_mreqn",
            "imr_multiaddr", &self.imr_multiaddr, "imr_address",
            &self.imr_address, "imr_ifindex", &&self.imr_ifindex)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct ip_mreq_source {
    pub imr_multiaddr: in_addr,
    pub imr_interface: in_addr,
    pub imr_sourceaddr: in_addr,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for ip_mreq_source { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for ip_mreq_source {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<in_addr>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for ip_mreq_source { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for ip_mreq_source {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "ip_mreq_source", "imr_multiaddr", &self.imr_multiaddr,
            "imr_interface", &self.imr_interface, "imr_sourceaddr",
            &&self.imr_sourceaddr)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct group_req {
    pub gr_interface: u32,
    pub gr_group: crate::sockaddr_storage,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for group_req { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for group_req {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u32>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr_storage>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for group_req { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for group_req {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "group_req",
            "gr_interface", &self.gr_interface, "gr_group", &&self.gr_group)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct group_source_req {
    pub gsr_interface: u32,
    pub gsr_group: crate::sockaddr_storage,
    pub gsr_source: crate::sockaddr_storage,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for group_source_req { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for group_source_req {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u32>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr_storage>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr_storage>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for group_source_req { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for group_source_req {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "group_source_req", "gsr_interface", &self.gsr_interface,
            "gsr_group", &self.gsr_group, "gsr_source", &&self.gsr_source)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr {
    pub sa_family: sa_family_t,
    pub sa_data: [c_char; 14],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<sa_family_t>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 14]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "sockaddr",
            "sa_family", &self.sa_family, "sa_data", &&self.sa_data)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr_in {
    pub sin_family: sa_family_t,
    pub sin_port: crate::in_port_t,
    pub sin_addr: crate::in_addr,
    pub sin_zero: [u8; 8],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr_in { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr_in {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<sa_family_t>;
        let _: ::core::clone::AssertParamIsClone<crate::in_port_t>;
        let _: ::core::clone::AssertParamIsClone<crate::in_addr>;
        let _: ::core::clone::AssertParamIsClone<[u8; 8]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr_in { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr_in {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "sockaddr_in",
            "sin_family", &self.sin_family, "sin_port", &self.sin_port,
            "sin_addr", &self.sin_addr, "sin_zero", &&self.sin_zero)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr_in6 {
    pub sin6_family: sa_family_t,
    pub sin6_port: crate::in_port_t,
    pub sin6_flowinfo: u32,
    pub sin6_addr: crate::in6_addr,
    pub sin6_scope_id: u32,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr_in6 { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr_in6 {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<sa_family_t>;
        let _: ::core::clone::AssertParamIsClone<crate::in_port_t>;
        let _: ::core::clone::AssertParamIsClone<u32>;
        let _: ::core::clone::AssertParamIsClone<crate::in6_addr>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr_in6 { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr_in6 {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "sockaddr_in6",
            "sin6_family", &self.sin6_family, "sin6_port", &self.sin6_port,
            "sin6_flowinfo", &self.sin6_flowinfo, "sin6_addr",
            &self.sin6_addr, "sin6_scope_id", &&self.sin6_scope_id)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct addrinfo {
    pub ai_flags: c_int,
    pub ai_family: c_int,
    pub ai_socktype: c_int,
    pub ai_protocol: c_int,
    pub ai_addrlen: socklen_t,
    pub ai_addr: *mut crate::sockaddr,
    pub ai_canonname: *mut c_char,
    pub ai_next: *mut addrinfo,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for addrinfo { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for addrinfo {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<socklen_t>;
        let _: ::core::clone::AssertParamIsClone<*mut crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut addrinfo>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for addrinfo { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for addrinfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ai_flags", "ai_family", "ai_socktype", "ai_protocol",
                        "ai_addrlen", "ai_addr", "ai_canonname", "ai_next"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ai_flags, &self.ai_family, &self.ai_socktype,
                        &self.ai_protocol, &self.ai_addrlen, &self.ai_addr,
                        &self.ai_canonname, &&self.ai_next];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "addrinfo",
            names, values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr_ll {
    pub sll_family: c_ushort,
    pub sll_protocol: c_ushort,
    pub sll_ifindex: c_int,
    pub sll_hatype: c_ushort,
    pub sll_pkttype: c_uchar,
    pub sll_halen: c_uchar,
    pub sll_addr: [c_uchar; 8],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr_ll { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr_ll {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_ushort>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<c_uchar>;
        let _: ::core::clone::AssertParamIsClone<[c_uchar; 8]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr_ll { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr_ll {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["sll_family", "sll_protocol", "sll_ifindex", "sll_hatype",
                        "sll_pkttype", "sll_halen", "sll_addr"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.sll_family, &self.sll_protocol, &self.sll_ifindex,
                        &self.sll_hatype, &self.sll_pkttype, &self.sll_halen,
                        &&self.sll_addr];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "sockaddr_ll",
            names, values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct fd_set {
    fds_bits: [c_ulong; FD_SETSIZE as usize / ULONG_SIZE],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for fd_set { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for fd_set {
    #[inline]
    fn clone(&self) -> Self {
        let _:
                ::core::clone::AssertParamIsClone<[c_ulong; FD_SETSIZE as
                        usize / ULONG_SIZE]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for fd_set { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for fd_set {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "fd_set",
            "fds_bits", &&self.fds_bits)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct tm {
    pub tm_sec: c_int,
    pub tm_min: c_int,
    pub tm_hour: c_int,
    pub tm_mday: c_int,
    pub tm_mon: c_int,
    pub tm_year: c_int,
    pub tm_wday: c_int,
    pub tm_yday: c_int,
    pub tm_isdst: c_int,
    pub tm_gmtoff: c_long,
    pub tm_zone: *const c_char,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for tm { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for tm {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<c_long>;
        let _: ::core::clone::AssertParamIsClone<*const c_char>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for tm { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for tm {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["tm_sec", "tm_min", "tm_hour", "tm_mday", "tm_mon", "tm_year",
                        "tm_wday", "tm_yday", "tm_isdst", "tm_gmtoff", "tm_zone"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.tm_sec, &self.tm_min, &self.tm_hour, &self.tm_mday,
                        &self.tm_mon, &self.tm_year, &self.tm_wday, &self.tm_yday,
                        &self.tm_isdst, &self.tm_gmtoff, &&self.tm_zone];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "tm", names,
            values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sched_param {
    pub sched_priority: c_int,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sched_param { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sched_param {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sched_param { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sched_param {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field1_finish(f, "sched_param",
            "sched_priority", &&self.sched_priority)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct Dl_info {
    pub dli_fname: *const c_char,
    pub dli_fbase: *mut c_void,
    pub dli_sname: *const c_char,
    pub dli_saddr: *mut c_void,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for Dl_info { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for Dl_info {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<*const c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_void>;
        let _: ::core::clone::AssertParamIsClone<*const c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_void>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for Dl_info { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for Dl_info {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "Dl_info",
            "dli_fname", &self.dli_fname, "dli_fbase", &self.dli_fbase,
            "dli_sname", &self.dli_sname, "dli_saddr", &&self.dli_saddr)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct lconv {
    pub decimal_point: *mut c_char,
    pub thousands_sep: *mut c_char,
    pub grouping: *mut c_char,
    pub int_curr_symbol: *mut c_char,
    pub currency_symbol: *mut c_char,
    pub mon_decimal_point: *mut c_char,
    pub mon_thousands_sep: *mut c_char,
    pub mon_grouping: *mut c_char,
    pub positive_sign: *mut c_char,
    pub negative_sign: *mut c_char,
    pub int_frac_digits: c_char,
    pub frac_digits: c_char,
    pub p_cs_precedes: c_char,
    pub p_sep_by_space: c_char,
    pub n_cs_precedes: c_char,
    pub n_sep_by_space: c_char,
    pub p_sign_posn: c_char,
    pub n_sign_posn: c_char,
    pub int_p_cs_precedes: c_char,
    pub int_p_sep_by_space: c_char,
    pub int_n_cs_precedes: c_char,
    pub int_n_sep_by_space: c_char,
    pub int_p_sign_posn: c_char,
    pub int_n_sign_posn: c_char,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for lconv { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for lconv {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<c_char>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for lconv { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for lconv {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["decimal_point", "thousands_sep", "grouping", "int_curr_symbol",
                        "currency_symbol", "mon_decimal_point", "mon_thousands_sep",
                        "mon_grouping", "positive_sign", "negative_sign",
                        "int_frac_digits", "frac_digits", "p_cs_precedes",
                        "p_sep_by_space", "n_cs_precedes", "n_sep_by_space",
                        "p_sign_posn", "n_sign_posn", "int_p_cs_precedes",
                        "int_p_sep_by_space", "int_n_cs_precedes",
                        "int_n_sep_by_space", "int_p_sign_posn", "int_n_sign_posn"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.decimal_point, &self.thousands_sep, &self.grouping,
                        &self.int_curr_symbol, &self.currency_symbol,
                        &self.mon_decimal_point, &self.mon_thousands_sep,
                        &self.mon_grouping, &self.positive_sign,
                        &self.negative_sign, &self.int_frac_digits,
                        &self.frac_digits, &self.p_cs_precedes,
                        &self.p_sep_by_space, &self.n_cs_precedes,
                        &self.n_sep_by_space, &self.p_sign_posn, &self.n_sign_posn,
                        &self.int_p_cs_precedes, &self.int_p_sep_by_space,
                        &self.int_n_cs_precedes, &self.int_n_sep_by_space,
                        &self.int_p_sign_posn, &&self.int_n_sign_posn];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "lconv", names,
            values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct in_pktinfo {
    pub ipi_ifindex: c_int,
    pub ipi_spec_dst: crate::in_addr,
    pub ipi_addr: crate::in_addr,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for in_pktinfo { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for in_pktinfo {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<crate::in_addr>;
        let _: ::core::clone::AssertParamIsClone<crate::in_addr>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for in_pktinfo { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for in_pktinfo {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f, "in_pktinfo",
            "ipi_ifindex", &self.ipi_ifindex, "ipi_spec_dst",
            &self.ipi_spec_dst, "ipi_addr", &&self.ipi_addr)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct ifaddrs {
    pub ifa_next: *mut ifaddrs,
    pub ifa_name: *mut c_char,
    pub ifa_flags: c_uint,
    pub ifa_addr: *mut crate::sockaddr,
    pub ifa_netmask: *mut crate::sockaddr,
    pub ifa_ifu: *mut crate::sockaddr,
    pub ifa_data: *mut c_void,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for ifaddrs { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for ifaddrs {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<*mut ifaddrs>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        let _: ::core::clone::AssertParamIsClone<c_uint>;
        let _: ::core::clone::AssertParamIsClone<*mut crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<*mut crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<*mut crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<*mut c_void>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for ifaddrs { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for ifaddrs {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["ifa_next", "ifa_name", "ifa_flags", "ifa_addr", "ifa_netmask",
                        "ifa_ifu", "ifa_data"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.ifa_next, &self.ifa_name, &self.ifa_flags, &self.ifa_addr,
                        &self.ifa_netmask, &self.ifa_ifu, &&self.ifa_data];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "ifaddrs",
            names, values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct in6_rtmsg {
    rtmsg_dst: crate::in6_addr,
    rtmsg_src: crate::in6_addr,
    rtmsg_gateway: crate::in6_addr,
    rtmsg_type: u32,
    rtmsg_dst_len: u16,
    rtmsg_src_len: u16,
    rtmsg_metric: u32,
    rtmsg_info: c_ulong,
    rtmsg_flags: u32,
    rtmsg_ifindex: c_int,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for in6_rtmsg { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for in6_rtmsg {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::in6_addr>;
        let _: ::core::clone::AssertParamIsClone<crate::in6_addr>;
        let _: ::core::clone::AssertParamIsClone<crate::in6_addr>;
        let _: ::core::clone::AssertParamIsClone<u32>;
        let _: ::core::clone::AssertParamIsClone<u16>;
        let _: ::core::clone::AssertParamIsClone<c_ulong>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for in6_rtmsg { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for in6_rtmsg {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["rtmsg_dst", "rtmsg_src", "rtmsg_gateway", "rtmsg_type",
                        "rtmsg_dst_len", "rtmsg_src_len", "rtmsg_metric",
                        "rtmsg_info", "rtmsg_flags", "rtmsg_ifindex"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.rtmsg_dst, &self.rtmsg_src, &self.rtmsg_gateway,
                        &self.rtmsg_type, &self.rtmsg_dst_len, &self.rtmsg_src_len,
                        &self.rtmsg_metric, &self.rtmsg_info, &self.rtmsg_flags,
                        &&self.rtmsg_ifindex];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "in6_rtmsg",
            names, values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct arpreq {
    pub arp_pa: crate::sockaddr,
    pub arp_ha: crate::sockaddr,
    pub arp_flags: c_int,
    pub arp_netmask: crate::sockaddr,
    pub arp_dev: [c_char; 16],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for arpreq { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for arpreq {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 16]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for arpreq { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for arpreq {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "arpreq",
            "arp_pa", &self.arp_pa, "arp_ha", &self.arp_ha, "arp_flags",
            &self.arp_flags, "arp_netmask", &self.arp_netmask, "arp_dev",
            &&self.arp_dev)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct arpreq_old {
    pub arp_pa: crate::sockaddr,
    pub arp_ha: crate::sockaddr,
    pub arp_flags: c_int,
    pub arp_netmask: crate::sockaddr,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for arpreq_old { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for arpreq_old {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<crate::sockaddr>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for arpreq_old { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for arpreq_old {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "arpreq_old",
            "arp_pa", &self.arp_pa, "arp_ha", &self.arp_ha, "arp_flags",
            &self.arp_flags, "arp_netmask", &&self.arp_netmask)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct arphdr {
    pub ar_hrd: u16,
    pub ar_pro: u16,
    pub ar_hln: u8,
    pub ar_pln: u8,
    pub ar_op: u16,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for arphdr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for arphdr {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u16>;
        let _: ::core::clone::AssertParamIsClone<u8>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for arphdr { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for arphdr {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "arphdr",
            "ar_hrd", &self.ar_hrd, "ar_pro", &self.ar_pro, "ar_hln",
            &self.ar_hln, "ar_pln", &self.ar_pln, "ar_op", &&self.ar_op)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr_un {
    pub sun_family: sa_family_t,
    pub sun_path: [c_char; 108],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr_un { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr_un {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<sa_family_t>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 108]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr_un { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr_un {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "sockaddr_un",
            "sun_family", &self.sun_family, "sun_path", &&self.sun_path)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sockaddr_storage {
    pub ss_family: sa_family_t,
    __ss_pad2: Padding<[u8; 128 - 2 - 8]>,
    __ss_align: size_t,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sockaddr_storage { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sockaddr_storage {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<sa_family_t>;
        let _: ::core::clone::AssertParamIsClone<Padding<[u8; 128 - 2 - 8]>>;
        let _: ::core::clone::AssertParamIsClone<size_t>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sockaddr_storage { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sockaddr_storage {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "sockaddr_storage", "ss_family", &self.ss_family, "__ss_pad2",
            &self.__ss_pad2, "__ss_align", &&self.__ss_align)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct utsname {
    pub sysname: [c_char; 65],
    pub nodename: [c_char; 65],
    pub release: [c_char; 65],
    pub version: [c_char; 65],
    pub machine: [c_char; 65],
    pub domainname: [c_char; 65],
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for utsname { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for utsname {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        let _: ::core::clone::AssertParamIsClone<[c_char; 65]>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for utsname { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for utsname {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["sysname", "nodename", "release", "version", "machine",
                        "domainname"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.sysname, &self.nodename, &self.release, &self.version,
                        &self.machine, &&self.domainname];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "utsname",
            names, values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct if_nameindex {
    pub if_index: c_uint,
    pub if_name: *mut c_char,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for if_nameindex { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for if_nameindex {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_uint>;
        let _: ::core::clone::AssertParamIsClone<*mut c_char>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for if_nameindex { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for if_nameindex {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "if_nameindex",
            "if_index", &self.if_index, "if_name", &&self.if_name)
    }
}s! {
17    pub struct in_addr {
18        pub s_addr: crate::in_addr_t,
19    }
20
21    pub struct ip_mreq {
22        pub imr_multiaddr: in_addr,
23        pub imr_interface: in_addr,
24    }
25
26    pub struct ip_mreqn {
27        pub imr_multiaddr: in_addr,
28        pub imr_address: in_addr,
29        pub imr_ifindex: c_int,
30    }
31
32    // netinet/in.h: RFC 3678 multicast group membership requests
33    pub struct ip_mreq_source {
34        pub imr_multiaddr: in_addr,
35        pub imr_interface: in_addr,
36        pub imr_sourceaddr: in_addr,
37    }
38
39    pub struct group_req {
40        pub gr_interface: u32,
41        pub gr_group: crate::sockaddr_storage,
42    }
43
44    pub struct group_source_req {
45        pub gsr_interface: u32,
46        pub gsr_group: crate::sockaddr_storage,
47        pub gsr_source: crate::sockaddr_storage,
48    }
49
50    pub struct sockaddr {
51        pub sa_family: sa_family_t,
52        pub sa_data: [c_char; 14],
53    }
54
55    pub struct sockaddr_in {
56        pub sin_family: sa_family_t,
57        pub sin_port: crate::in_port_t,
58        pub sin_addr: crate::in_addr,
59        pub sin_zero: [u8; 8],
60    }
61
62    pub struct sockaddr_in6 {
63        pub sin6_family: sa_family_t,
64        pub sin6_port: crate::in_port_t,
65        pub sin6_flowinfo: u32,
66        pub sin6_addr: crate::in6_addr,
67        pub sin6_scope_id: u32,
68    }
69
70    // The order of the `ai_addr` field in this struct is crucial
71    // for converting between the Rust and C types.
72    pub struct addrinfo {
73        pub ai_flags: c_int,
74        pub ai_family: c_int,
75        pub ai_socktype: c_int,
76        pub ai_protocol: c_int,
77        pub ai_addrlen: socklen_t,
78
79        #[cfg(not(target_os = "android"))]
80        pub ai_addr: *mut crate::sockaddr,
81
82        pub ai_canonname: *mut c_char,
83
84        #[cfg(target_os = "android")]
85        pub ai_addr: *mut crate::sockaddr,
86
87        pub ai_next: *mut addrinfo,
88    }
89
90    pub struct sockaddr_ll {
91        pub sll_family: c_ushort,
92        pub sll_protocol: c_ushort,
93        pub sll_ifindex: c_int,
94        pub sll_hatype: c_ushort,
95        pub sll_pkttype: c_uchar,
96        pub sll_halen: c_uchar,
97        pub sll_addr: [c_uchar; 8],
98    }
99
100    pub struct fd_set {
101        fds_bits: [c_ulong; FD_SETSIZE as usize / ULONG_SIZE],
102    }
103
104    pub struct tm {
105        pub tm_sec: c_int,
106        pub tm_min: c_int,
107        pub tm_hour: c_int,
108        pub tm_mday: c_int,
109        pub tm_mon: c_int,
110        pub tm_year: c_int,
111        pub tm_wday: c_int,
112        pub tm_yday: c_int,
113        pub tm_isdst: c_int,
114        pub tm_gmtoff: c_long,
115        pub tm_zone: *const c_char,
116    }
117
118    #[cfg(not(any(target_env = "musl", target_os = "emscripten", target_env = "ohos")))]
119    pub struct sched_param {
120        pub sched_priority: c_int,
121    }
122
123    pub struct Dl_info {
124        pub dli_fname: *const c_char,
125        pub dli_fbase: *mut c_void,
126        pub dli_sname: *const c_char,
127        pub dli_saddr: *mut c_void,
128    }
129
130    pub struct lconv {
131        pub decimal_point: *mut c_char,
132        pub thousands_sep: *mut c_char,
133        pub grouping: *mut c_char,
134        pub int_curr_symbol: *mut c_char,
135        pub currency_symbol: *mut c_char,
136        pub mon_decimal_point: *mut c_char,
137        pub mon_thousands_sep: *mut c_char,
138        pub mon_grouping: *mut c_char,
139        pub positive_sign: *mut c_char,
140        pub negative_sign: *mut c_char,
141        pub int_frac_digits: c_char,
142        pub frac_digits: c_char,
143        pub p_cs_precedes: c_char,
144        pub p_sep_by_space: c_char,
145        pub n_cs_precedes: c_char,
146        pub n_sep_by_space: c_char,
147        pub p_sign_posn: c_char,
148        pub n_sign_posn: c_char,
149        pub int_p_cs_precedes: c_char,
150        pub int_p_sep_by_space: c_char,
151        pub int_n_cs_precedes: c_char,
152        pub int_n_sep_by_space: c_char,
153        pub int_p_sign_posn: c_char,
154        pub int_n_sign_posn: c_char,
155    }
156
157    pub struct in_pktinfo {
158        pub ipi_ifindex: c_int,
159        pub ipi_spec_dst: crate::in_addr,
160        pub ipi_addr: crate::in_addr,
161    }
162
163    pub struct ifaddrs {
164        pub ifa_next: *mut ifaddrs,
165        pub ifa_name: *mut c_char,
166        pub ifa_flags: c_uint,
167        pub ifa_addr: *mut crate::sockaddr,
168        pub ifa_netmask: *mut crate::sockaddr,
169        pub ifa_ifu: *mut crate::sockaddr, // FIXME(union) This should be a union
170        pub ifa_data: *mut c_void,
171    }
172
173    pub struct in6_rtmsg {
174        rtmsg_dst: crate::in6_addr,
175        rtmsg_src: crate::in6_addr,
176        rtmsg_gateway: crate::in6_addr,
177        rtmsg_type: u32,
178        rtmsg_dst_len: u16,
179        rtmsg_src_len: u16,
180        rtmsg_metric: u32,
181        rtmsg_info: c_ulong,
182        rtmsg_flags: u32,
183        rtmsg_ifindex: c_int,
184    }
185
186    pub struct arpreq {
187        pub arp_pa: crate::sockaddr,
188        pub arp_ha: crate::sockaddr,
189        pub arp_flags: c_int,
190        pub arp_netmask: crate::sockaddr,
191        pub arp_dev: [c_char; 16],
192    }
193
194    pub struct arpreq_old {
195        pub arp_pa: crate::sockaddr,
196        pub arp_ha: crate::sockaddr,
197        pub arp_flags: c_int,
198        pub arp_netmask: crate::sockaddr,
199    }
200
201    pub struct arphdr {
202        pub ar_hrd: u16,
203        pub ar_pro: u16,
204        pub ar_hln: u8,
205        pub ar_pln: u8,
206        pub ar_op: u16,
207    }
208
209    pub struct sockaddr_un {
210        pub sun_family: sa_family_t,
211        pub sun_path: [c_char; 108],
212    }
213
214    pub struct sockaddr_storage {
215        pub ss_family: sa_family_t,
216        #[cfg(target_pointer_width = "32")]
217        __ss_pad2: Padding<[u8; 128 - 2 - 4]>,
218        #[cfg(target_pointer_width = "64")]
219        __ss_pad2: Padding<[u8; 128 - 2 - 8]>,
220        __ss_align: size_t,
221    }
222
223    pub struct utsname {
224        pub sysname: [c_char; 65],
225        pub nodename: [c_char; 65],
226        pub release: [c_char; 65],
227        pub version: [c_char; 65],
228        pub machine: [c_char; 65],
229        pub domainname: [c_char; 65],
230    }
231
232    pub struct if_nameindex {
233        pub if_index: c_uint,
234        pub if_name: *mut c_char,
235    }
236}
237
238cfg_if! {
239    if #[cfg(not(any(target_os = "emscripten", target_os = "l4re")))] {
240        #[repr(C)]
#[allow(deprecated)]
pub struct file_clone_range {
    pub src_fd: crate::__s64,
    pub src_offset: crate::__u64,
    pub src_length: crate::__u64,
    pub dest_offset: crate::__u64,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for file_clone_range { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for file_clone_range {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::__s64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for file_clone_range { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for file_clone_range {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f,
            "file_clone_range", "src_fd", &self.src_fd, "src_offset",
            &self.src_offset, "src_length", &self.src_length, "dest_offset",
            &&self.dest_offset)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sock_filter {
    pub code: crate::__u16,
    pub jt: crate::__u8,
    pub jf: crate::__u8,
    pub k: crate::__u32,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sock_filter { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sock_filter {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::__u16>;
        let _: ::core::clone::AssertParamIsClone<crate::__u8>;
        let _: ::core::clone::AssertParamIsClone<crate::__u8>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sock_filter { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sock_filter {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field4_finish(f, "sock_filter",
            "code", &self.code, "jt", &self.jt, "jf", &self.jf, "k", &&self.k)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct sock_fprog {
    pub len: c_ushort,
    pub filter: *mut sock_filter,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for sock_fprog { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for sock_fprog {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<c_ushort>;
        let _: ::core::clone::AssertParamIsClone<*mut sock_filter>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for sock_fprog { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for sock_fprog {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "sock_fprog",
            "len", &self.len, "filter", &&self.filter)
    }
}s! {
241            pub struct file_clone_range {
242                pub src_fd: crate::__s64,
243                pub src_offset: crate::__u64,
244                pub src_length: crate::__u64,
245                pub dest_offset: crate::__u64,
246            }
247
248            // linux/filter.h
249            pub struct sock_filter {
250                pub code: crate::__u16,
251                pub jt: crate::__u8,
252                pub jf: crate::__u8,
253                pub k: crate::__u32,
254            }
255
256            pub struct sock_fprog {
257                pub len: c_ushort,
258                pub filter: *mut sock_filter,
259            }
260        }
261    }
262}
263
264cfg_if! {
265    if #[cfg(any(target_env = "gnu", target_os = "android"))] {
266        #[repr(C)]
#[allow(deprecated)]
pub struct statx {
    pub stx_mask: crate::__u32,
    pub stx_blksize: crate::__u32,
    pub stx_attributes: crate::__u64,
    pub stx_nlink: crate::__u32,
    pub stx_uid: crate::__u32,
    pub stx_gid: crate::__u32,
    pub stx_mode: crate::__u16,
    __statx_pad1: Padding<[crate::__u16; 1]>,
    pub stx_ino: crate::__u64,
    pub stx_size: crate::__u64,
    pub stx_blocks: crate::__u64,
    pub stx_attributes_mask: crate::__u64,
    pub stx_atime: statx_timestamp,
    pub stx_btime: statx_timestamp,
    pub stx_ctime: statx_timestamp,
    pub stx_mtime: statx_timestamp,
    pub stx_rdev_major: crate::__u32,
    pub stx_rdev_minor: crate::__u32,
    pub stx_dev_major: crate::__u32,
    pub stx_dev_minor: crate::__u32,
    pub stx_mnt_id: crate::__u64,
    pub stx_dio_mem_align: crate::__u32,
    pub stx_dio_offset_align: crate::__u32,
    pub stx_subvol: crate::__u64,
    pub stx_atomic_write_unit_min: crate::__u32,
    pub stx_atomic_write_unit_max: crate::__u32,
    pub stx_atomic_write_segments_max: crate::__u32,
    pub stx_dio_read_offset_align: crate::__u32,
    pub stx_atomic_write_unit_max_opt: crate::__u32,
    __statx_pad2: Padding<[crate::__u32; 1]>,
    __statx_pad3: Padding<[crate::__u64; 8]>,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for statx { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for statx {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u16>;
        let _: ::core::clone::AssertParamIsClone<Padding<[crate::__u16; 1]>>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<statx_timestamp>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<Padding<[crate::__u32; 1]>>;
        let _: ::core::clone::AssertParamIsClone<Padding<[crate::__u64; 8]>>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for statx { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for statx {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["stx_mask", "stx_blksize", "stx_attributes", "stx_nlink",
                        "stx_uid", "stx_gid", "stx_mode", "__statx_pad1", "stx_ino",
                        "stx_size", "stx_blocks", "stx_attributes_mask",
                        "stx_atime", "stx_btime", "stx_ctime", "stx_mtime",
                        "stx_rdev_major", "stx_rdev_minor", "stx_dev_major",
                        "stx_dev_minor", "stx_mnt_id", "stx_dio_mem_align",
                        "stx_dio_offset_align", "stx_subvol",
                        "stx_atomic_write_unit_min", "stx_atomic_write_unit_max",
                        "stx_atomic_write_segments_max",
                        "stx_dio_read_offset_align",
                        "stx_atomic_write_unit_max_opt", "__statx_pad2",
                        "__statx_pad3"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.stx_mask, &self.stx_blksize, &self.stx_attributes,
                        &self.stx_nlink, &self.stx_uid, &self.stx_gid,
                        &self.stx_mode, &self.__statx_pad1, &self.stx_ino,
                        &self.stx_size, &self.stx_blocks, &self.stx_attributes_mask,
                        &self.stx_atime, &self.stx_btime, &self.stx_ctime,
                        &self.stx_mtime, &self.stx_rdev_major, &self.stx_rdev_minor,
                        &self.stx_dev_major, &self.stx_dev_minor, &self.stx_mnt_id,
                        &self.stx_dio_mem_align, &self.stx_dio_offset_align,
                        &self.stx_subvol, &self.stx_atomic_write_unit_min,
                        &self.stx_atomic_write_unit_max,
                        &self.stx_atomic_write_segments_max,
                        &self.stx_dio_read_offset_align,
                        &self.stx_atomic_write_unit_max_opt, &self.__statx_pad2,
                        &&self.__statx_pad3];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "statx", names,
            values)
    }
}
#[repr(C)]
#[allow(deprecated)]
pub struct statx_timestamp {
    pub tv_sec: crate::__s64,
    pub tv_nsec: crate::__u32,
    __statx_timestamp_pad1: Padding<[crate::__s32; 1]>,
}
#[automatically_derived]
#[doc(hidden)]
#[allow(deprecated)]
unsafe impl ::core::clone::TrivialClone for statx_timestamp { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::clone::Clone for statx_timestamp {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::__s64>;
        let _: ::core::clone::AssertParamIsClone<crate::__u32>;
        let _: ::core::clone::AssertParamIsClone<Padding<[crate::__s32; 1]>>;
        *self
    }
}
#[automatically_derived]
#[allow(deprecated)]
impl ::core::marker::Copy for statx_timestamp { }
#[automatically_derived]
#[allow(deprecated)]
impl ::core::fmt::Debug for statx_timestamp {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field3_finish(f,
            "statx_timestamp", "tv_sec", &self.tv_sec, "tv_nsec",
            &self.tv_nsec, "__statx_timestamp_pad1",
            &&self.__statx_timestamp_pad1)
    }
}s! {
267            pub struct statx {
268                pub stx_mask: crate::__u32,
269                pub stx_blksize: crate::__u32,
270                pub stx_attributes: crate::__u64,
271                pub stx_nlink: crate::__u32,
272                pub stx_uid: crate::__u32,
273                pub stx_gid: crate::__u32,
274                pub stx_mode: crate::__u16,
275                __statx_pad1: Padding<[crate::__u16; 1]>,
276                pub stx_ino: crate::__u64,
277                pub stx_size: crate::__u64,
278                pub stx_blocks: crate::__u64,
279                pub stx_attributes_mask: crate::__u64,
280                pub stx_atime: statx_timestamp,
281                pub stx_btime: statx_timestamp,
282                pub stx_ctime: statx_timestamp,
283                pub stx_mtime: statx_timestamp,
284                pub stx_rdev_major: crate::__u32,
285                pub stx_rdev_minor: crate::__u32,
286                pub stx_dev_major: crate::__u32,
287                pub stx_dev_minor: crate::__u32,
288                pub stx_mnt_id: crate::__u64,
289                pub stx_dio_mem_align: crate::__u32,
290                pub stx_dio_offset_align: crate::__u32,
291                // The following fields are not available on Android as of
292                // 2026-06.
293                #[cfg(target_os = "linux")]
294                pub stx_subvol: crate::__u64,
295                #[cfg(target_os = "linux")]
296                pub stx_atomic_write_unit_min: crate::__u32,
297                #[cfg(target_os = "linux")]
298                pub stx_atomic_write_unit_max: crate::__u32,
299                #[cfg(target_os = "linux")]
300                pub stx_atomic_write_segments_max: crate::__u32,
301                #[cfg(target_os = "linux")]
302                pub stx_dio_read_offset_align: crate::__u32,
303                #[cfg(target_os = "linux")]
304                pub stx_atomic_write_unit_max_opt: crate::__u32,
305                #[cfg(target_os = "linux")]
306                __statx_pad2: Padding<[crate::__u32; 1]>,
307                #[cfg(target_os = "linux")]
308                __statx_pad3: Padding<[crate::__u64; 8]>,
309                #[cfg(not(target_os = "linux"))]
310                __statx_pad3: Padding<[crate::__u64; 12]>,
311            }
312
313            pub struct statx_timestamp {
314                pub tv_sec: crate::__s64,
315                pub tv_nsec: crate::__u32,
316                __statx_timestamp_pad1: Padding<[crate::__s32; 1]>,
317            }
318        }
319    }
320}
321
322#[repr(C)]
#[repr(packed)]
pub struct epoll_event {
    pub events: u32,
    pub u64: u64,
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for epoll_event { }
#[automatically_derived]
impl ::core::clone::Clone for epoll_event {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<u32>;
        let _: ::core::clone::AssertParamIsClone<u64>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for epoll_event { }
#[automatically_derived]
impl ::core::fmt::Debug for epoll_event {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field2_finish(f, "epoll_event",
            "events", &{ self.events }, "u64", &&{ self.u64 })
    }
}
#[repr(C)]
pub struct sigevent {
    pub sigev_value: crate::sigval,
    pub sigev_signo: c_int,
    pub sigev_notify: c_int,
    pub sigev_notify_thread_id: c_int,
    __unused1: Padding<[c_int; 11]>,
}
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for sigevent { }
#[automatically_derived]
impl ::core::clone::Clone for sigevent {
    #[inline]
    fn clone(&self) -> Self {
        let _: ::core::clone::AssertParamIsClone<crate::sigval>;
        let _: ::core::clone::AssertParamIsClone<c_int>;
        let _: ::core::clone::AssertParamIsClone<Padding<[c_int; 11]>>;
        *self
    }
}
#[automatically_derived]
impl ::core::marker::Copy for sigevent { }
#[automatically_derived]
impl ::core::fmt::Debug for sigevent {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "sigevent",
            "sigev_value", &self.sigev_value, "sigev_signo",
            &self.sigev_signo, "sigev_notify", &self.sigev_notify,
            "sigev_notify_thread_id", &self.sigev_notify_thread_id,
            "__unused1", &&self.__unused1)
    }
}s_no_extra_traits! {
323    #[cfg_attr(
324        any(target_arch = "x86_64", all(target_arch = "x86", target_env = "gnu")),
325        repr(packed)
326    )]
327    pub struct epoll_event {
328        pub events: u32,
329        pub u64: u64,
330    }
331
332    pub struct sigevent {
333        pub sigev_value: crate::sigval,
334        pub sigev_signo: c_int,
335        pub sigev_notify: c_int,
336        // Actually a union.  We only expose sigev_notify_thread_id because it's
337        // the most useful member
338        pub sigev_notify_thread_id: c_int,
339        #[cfg(target_pointer_width = "64")]
340        __unused1: Padding<[c_int; 11]>,
341        #[cfg(target_pointer_width = "32")]
342        __unused1: Padding<[c_int; 12]>,
343    }
344}
345
346cfg_if! {
347    if #[cfg(all(feature = "extra_traits", not(target_os = "l4re")))] {
348        impl PartialEq for epoll_event {
349            fn eq(&self, other: &epoll_event) -> bool {
350                self.events == other.events && self.u64 == other.u64
351            }
352        }
353        impl Eq for epoll_event {}
354        impl hash::Hash for epoll_event {
355            fn hash<H: hash::Hasher>(&self, state: &mut H) {
356                let events = self.events;
357                let u64 = self.u64;
358                events.hash(state);
359                u64.hash(state);
360            }
361        }
362
363        impl PartialEq for sigevent {
364            fn eq(&self, other: &sigevent) -> bool {
365                self.sigev_value == other.sigev_value
366                    && self.sigev_signo == other.sigev_signo
367                    && self.sigev_notify == other.sigev_notify
368                    && self.sigev_notify_thread_id == other.sigev_notify_thread_id
369            }
370        }
371        impl Eq for sigevent {}
372        impl hash::Hash for sigevent {
373            fn hash<H: hash::Hasher>(&self, state: &mut H) {
374                self.sigev_value.hash(state);
375                self.sigev_signo.hash(state);
376                self.sigev_notify.hash(state);
377                self.sigev_notify_thread_id.hash(state);
378            }
379        }
380    }
381}
382
383// intentionally not public, only used for fd_set
384cfg_if! {
385    if #[cfg(target_pointer_width = "32")] {
386        const ULONG_SIZE: usize = 32;
387    } else if #[cfg(target_pointer_width = "64")] {
388        const ULONG_SIZE: usize = 64;
389    } else {
390        // Unknown target_pointer_width
391    }
392}
393
394pub const EXIT_FAILURE: c_int = 1;
395pub const EXIT_SUCCESS: c_int = 0;
396pub const RAND_MAX: c_int = 2147483647;
397pub const EOF: c_int = -1;
398pub const SEEK_SET: c_int = 0;
399pub const SEEK_CUR: c_int = 1;
400pub const SEEK_END: c_int = 2;
401pub const _IOFBF: c_int = 0;
402pub const _IONBF: c_int = 2;
403pub const _IOLBF: c_int = 1;
404
405pub const F_DUPFD: c_int = 0;
406pub const F_GETFD: c_int = 1;
407pub const F_SETFD: c_int = 2;
408pub const F_GETFL: c_int = 3;
409pub const F_SETFL: c_int = 4;
410
411// Linux-specific fcntls
412pub const F_SETLEASE: c_int = 1024;
413pub const F_GETLEASE: c_int = 1025;
414pub const F_NOTIFY: c_int = 1026;
415pub const F_CANCELLK: c_int = 1029;
416pub const F_DUPFD_CLOEXEC: c_int = 1030;
417pub const F_SETPIPE_SZ: c_int = 1031;
418pub const F_GETPIPE_SZ: c_int = 1032;
419pub const F_ADD_SEALS: c_int = 1033;
420pub const F_GET_SEALS: c_int = 1034;
421
422pub const F_SEAL_SEAL: c_int = 0x0001;
423pub const F_SEAL_SHRINK: c_int = 0x0002;
424pub const F_SEAL_GROW: c_int = 0x0004;
425pub const F_SEAL_WRITE: c_int = 0x0008;
426
427// FIXME(#235): Include file sealing fcntls once we have a way to verify them.
428
429pub const PTHREAD_CREATE_JOINABLE: c_int = 0;
430pub const PTHREAD_CREATE_DETACHED: c_int = 1;
431
432pub const CLOCK_REALTIME: crate::clockid_t = 0;
433pub const CLOCK_MONOTONIC: crate::clockid_t = 1;
434pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2;
435pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 3;
436pub const CLOCK_MONOTONIC_RAW: crate::clockid_t = 4;
437pub const CLOCK_REALTIME_COARSE: crate::clockid_t = 5;
438pub const CLOCK_MONOTONIC_COARSE: crate::clockid_t = 6;
439pub const CLOCK_BOOTTIME: crate::clockid_t = 7;
440pub const CLOCK_REALTIME_ALARM: crate::clockid_t = 8;
441pub const CLOCK_BOOTTIME_ALARM: crate::clockid_t = 9;
442pub const CLOCK_TAI: crate::clockid_t = 11;
443pub const TIMER_ABSTIME: c_int = 1;
444
445pub const RUSAGE_SELF: c_int = 0;
446
447pub const O_RDONLY: c_int = 0;
448pub const O_WRONLY: c_int = 1;
449pub const O_RDWR: c_int = 2;
450
451pub const S_IFIFO: mode_t = 0o1_0000;
452pub const S_IFCHR: mode_t = 0o2_0000;
453pub const S_IFBLK: mode_t = 0o6_0000;
454pub const S_IFDIR: mode_t = 0o4_0000;
455pub const S_IFREG: mode_t = 0o10_0000;
456pub const S_IFLNK: mode_t = 0o12_0000;
457pub const S_IFSOCK: mode_t = 0o14_0000;
458pub const S_IFMT: mode_t = 0o17_0000;
459pub const S_IRWXU: mode_t = 0o0700;
460pub const S_IXUSR: mode_t = 0o0100;
461pub const S_IWUSR: mode_t = 0o0200;
462pub const S_IRUSR: mode_t = 0o0400;
463pub const S_IRWXG: mode_t = 0o0070;
464pub const S_IXGRP: mode_t = 0o0010;
465pub const S_IWGRP: mode_t = 0o0020;
466pub const S_IRGRP: mode_t = 0o0040;
467pub const S_IRWXO: mode_t = 0o0007;
468pub const S_IXOTH: mode_t = 0o0001;
469pub const S_IWOTH: mode_t = 0o0002;
470pub const S_IROTH: mode_t = 0o0004;
471pub const F_OK: c_int = 0;
472pub const R_OK: c_int = 4;
473pub const W_OK: c_int = 2;
474pub const X_OK: c_int = 1;
475
476cfg_if! {
477    // defined in src/new/glibc
478    if #[cfg(not(all(target_os = "linux", target_env = "gnu")))] {
479        pub const SIGHUP: c_int = 1;
480        pub const SIGINT: c_int = 2;
481        pub const SIGQUIT: c_int = 3;
482        pub const SIGILL: c_int = 4;
483        pub const SIGTRAP: c_int = 5;
484        pub const SIGABRT: c_int = 6;
485        pub const SIGFPE: c_int = 8;
486        pub const SIGKILL: c_int = 9;
487        pub const SIGSEGV: c_int = 11;
488        pub const SIGPIPE: c_int = 13;
489        pub const SIGALRM: c_int = 14;
490        pub const SIGTERM: c_int = 15;
491    }
492}
493
494pub const PROT_NONE: c_int = 0;
495pub const PROT_READ: c_int = 1;
496pub const PROT_WRITE: c_int = 2;
497pub const PROT_EXEC: c_int = 4;
498
499#[cfg(not(target_os = "l4re"))]
500pub const XATTR_CREATE: c_int = 0x1;
501#[cfg(not(target_os = "l4re"))]
502pub const XATTR_REPLACE: c_int = 0x2;
503
504cfg_if! {
505    if #[cfg(target_os = "android")] {
506        pub const RLIM64_INFINITY: c_ulonglong = !0;
507    } else if #[cfg(all(target_os = "l4re", target_pointer_width = "64"))] {
508        pub const RLIM64_INFINITY: crate::rlim_t = !0;
509    } else {
510        pub const RLIM64_INFINITY: crate::rlim64_t = !0;
511    }
512}
513
514cfg_if! {
515    if #[cfg(target_env = "ohos")] {
516        pub const LC_CTYPE: c_int = 0;
517        pub const LC_NUMERIC: c_int = 1;
518        pub const LC_TIME: c_int = 2;
519        pub const LC_COLLATE: c_int = 3;
520        pub const LC_MONETARY: c_int = 4;
521        pub const LC_MESSAGES: c_int = 5;
522        pub const LC_PAPER: c_int = 6;
523        pub const LC_NAME: c_int = 7;
524        pub const LC_ADDRESS: c_int = 8;
525        pub const LC_TELEPHONE: c_int = 9;
526        pub const LC_MEASUREMENT: c_int = 10;
527        pub const LC_IDENTIFICATION: c_int = 11;
528        pub const LC_ALL: c_int = 12;
529    } else if #[cfg(not(target_env = "uclibc"))] {
530        pub const LC_CTYPE: c_int = 0;
531        pub const LC_NUMERIC: c_int = 1;
532        pub const LC_TIME: c_int = 2;
533        pub const LC_COLLATE: c_int = 3;
534        pub const LC_MONETARY: c_int = 4;
535        pub const LC_MESSAGES: c_int = 5;
536        pub const LC_ALL: c_int = 6;
537    }
538}
539
540pub const LC_CTYPE_MASK: c_int = 1 << LC_CTYPE;
541pub const LC_NUMERIC_MASK: c_int = 1 << LC_NUMERIC;
542pub const LC_TIME_MASK: c_int = 1 << LC_TIME;
543pub const LC_COLLATE_MASK: c_int = 1 << LC_COLLATE;
544pub const LC_MONETARY_MASK: c_int = 1 << LC_MONETARY;
545pub const LC_MESSAGES_MASK: c_int = 1 << LC_MESSAGES;
546// LC_ALL_MASK defined per platform
547
548pub const MAP_FILE: c_int = 0x0000;
549pub const MAP_SHARED: c_int = 0x0001;
550pub const MAP_PRIVATE: c_int = 0x0002;
551pub const MAP_FIXED: c_int = 0x0010;
552
553pub const MAP_FAILED: *mut c_void = !0 as *mut c_void;
554
555// MS_ flags for msync(2)
556pub const MS_ASYNC: c_int = 0x0001;
557pub const MS_INVALIDATE: c_int = 0x0002;
558pub const MS_SYNC: c_int = 0x0004;
559
560// MS_ flags for mount(2)
561pub const MS_RDONLY: c_ulong = 0x01;
562pub const MS_NOSUID: c_ulong = 0x02;
563pub const MS_NODEV: c_ulong = 0x04;
564pub const MS_NOEXEC: c_ulong = 0x08;
565pub const MS_SYNCHRONOUS: c_ulong = 0x10;
566pub const MS_REMOUNT: c_ulong = 0x20;
567pub const MS_MANDLOCK: c_ulong = 0x40;
568pub const MS_DIRSYNC: c_ulong = 0x80;
569pub const MS_NOSYMFOLLOW: c_ulong = 0x100;
570pub const MS_NOATIME: c_ulong = 0x0400;
571pub const MS_NODIRATIME: c_ulong = 0x0800;
572pub const MS_BIND: c_ulong = 0x1000;
573pub const MS_MOVE: c_ulong = 0x2000;
574pub const MS_REC: c_ulong = 0x4000;
575// MS_VERBOSE is deprecated
576pub const MS_SILENT: c_ulong = 0x8000;
577pub const MS_POSIXACL: c_ulong = 0x010000;
578pub const MS_UNBINDABLE: c_ulong = 0x020000;
579pub const MS_PRIVATE: c_ulong = 0x040000;
580pub const MS_SLAVE: c_ulong = 0x080000;
581pub const MS_SHARED: c_ulong = 0x100000;
582pub const MS_RELATIME: c_ulong = 0x200000;
583pub const MS_KERNMOUNT: c_ulong = 0x400000;
584pub const MS_I_VERSION: c_ulong = 0x800000;
585pub const MS_STRICTATIME: c_ulong = 0x1000000;
586pub const MS_LAZYTIME: c_ulong = 0x2000000;
587pub const MS_ACTIVE: c_ulong = 0x40000000;
588pub const MS_MGC_VAL: c_ulong = 0xc0ed0000;
589pub const MS_MGC_MSK: c_ulong = 0xffff0000;
590
591pub const SCM_RIGHTS: c_int = 0x01;
592pub const SCM_CREDENTIALS: c_int = 0x02;
593
594pub const PROT_GROWSDOWN: c_int = 0x1000000;
595pub const PROT_GROWSUP: c_int = 0x2000000;
596
597pub const MAP_TYPE: c_int = 0x000f;
598
599pub const MADV_NORMAL: c_int = 0;
600pub const MADV_RANDOM: c_int = 1;
601pub const MADV_SEQUENTIAL: c_int = 2;
602pub const MADV_WILLNEED: c_int = 3;
603pub const MADV_DONTNEED: c_int = 4;
604pub const MADV_FREE: c_int = 8;
605pub const MADV_REMOVE: c_int = 9;
606pub const MADV_DONTFORK: c_int = 10;
607pub const MADV_DOFORK: c_int = 11;
608pub const MADV_MERGEABLE: c_int = 12;
609pub const MADV_UNMERGEABLE: c_int = 13;
610pub const MADV_HUGEPAGE: c_int = 14;
611pub const MADV_NOHUGEPAGE: c_int = 15;
612pub const MADV_DONTDUMP: c_int = 16;
613pub const MADV_DODUMP: c_int = 17;
614pub const MADV_WIPEONFORK: c_int = 18;
615pub const MADV_KEEPONFORK: c_int = 19;
616#[cfg(not(target_os = "l4re"))]
617pub const MADV_COLD: c_int = 20;
618#[cfg(not(target_os = "l4re"))]
619pub const MADV_PAGEOUT: c_int = 21;
620pub const MADV_HWPOISON: c_int = 100;
621cfg_if! {
622    if #[cfg(not(any(target_os = "emscripten", target_os = "l4re")))] {
623        pub const MADV_POPULATE_READ: c_int = 22;
624        pub const MADV_POPULATE_WRITE: c_int = 23;
625        pub const MADV_DONTNEED_LOCKED: c_int = 24;
626    }
627}
628
629pub const IFF_UP: c_int = 0x1;
630pub const IFF_BROADCAST: c_int = 0x2;
631pub const IFF_DEBUG: c_int = 0x4;
632pub const IFF_LOOPBACK: c_int = 0x8;
633pub const IFF_POINTOPOINT: c_int = 0x10;
634pub const IFF_NOTRAILERS: c_int = 0x20;
635pub const IFF_RUNNING: c_int = 0x40;
636pub const IFF_NOARP: c_int = 0x80;
637pub const IFF_PROMISC: c_int = 0x100;
638pub const IFF_ALLMULTI: c_int = 0x200;
639pub const IFF_MASTER: c_int = 0x400;
640pub const IFF_SLAVE: c_int = 0x800;
641pub const IFF_MULTICAST: c_int = 0x1000;
642pub const IFF_PORTSEL: c_int = 0x2000;
643pub const IFF_AUTOMEDIA: c_int = 0x4000;
644pub const IFF_DYNAMIC: c_int = 0x8000;
645
646pub const SOL_IP: c_int = 0;
647pub const SOL_TCP: c_int = 6;
648pub const SOL_UDP: c_int = 17;
649pub const SOL_IPV6: c_int = 41;
650pub const SOL_ICMPV6: c_int = 58;
651pub const SOL_RAW: c_int = 255;
652pub const SOL_DECNET: c_int = 261;
653pub const SOL_X25: c_int = 262;
654pub const SOL_PACKET: c_int = 263;
655pub const SOL_ATM: c_int = 264;
656pub const SOL_AAL: c_int = 265;
657pub const SOL_IRDA: c_int = 266;
658pub const SOL_NETBEUI: c_int = 267;
659pub const SOL_LLC: c_int = 268;
660pub const SOL_DCCP: c_int = 269;
661pub const SOL_NETLINK: c_int = 270;
662pub const SOL_TIPC: c_int = 271;
663pub const SOL_BLUETOOTH: c_int = 274;
664pub const SOL_ALG: c_int = 279;
665
666pub const AF_UNSPEC: c_int = 0;
667pub const AF_UNIX: c_int = 1;
668pub const AF_LOCAL: c_int = 1;
669pub const AF_INET: c_int = 2;
670pub const AF_AX25: c_int = 3;
671pub const AF_IPX: c_int = 4;
672pub const AF_APPLETALK: c_int = 5;
673pub const AF_NETROM: c_int = 6;
674pub const AF_BRIDGE: c_int = 7;
675pub const AF_ATMPVC: c_int = 8;
676pub const AF_X25: c_int = 9;
677pub const AF_INET6: c_int = 10;
678pub const AF_ROSE: c_int = 11;
679pub const AF_DECnet: c_int = 12;
680pub const AF_NETBEUI: c_int = 13;
681pub const AF_SECURITY: c_int = 14;
682pub const AF_KEY: c_int = 15;
683pub const AF_NETLINK: c_int = 16;
684pub const AF_ROUTE: c_int = AF_NETLINK;
685pub const AF_PACKET: c_int = 17;
686pub const AF_ASH: c_int = 18;
687pub const AF_ECONET: c_int = 19;
688pub const AF_ATMSVC: c_int = 20;
689pub const AF_RDS: c_int = 21;
690pub const AF_SNA: c_int = 22;
691pub const AF_IRDA: c_int = 23;
692pub const AF_PPPOX: c_int = 24;
693pub const AF_WANPIPE: c_int = 25;
694pub const AF_LLC: c_int = 26;
695pub const AF_CAN: c_int = 29;
696pub const AF_TIPC: c_int = 30;
697pub const AF_BLUETOOTH: c_int = 31;
698pub const AF_IUCV: c_int = 32;
699pub const AF_RXRPC: c_int = 33;
700pub const AF_ISDN: c_int = 34;
701pub const AF_PHONET: c_int = 35;
702pub const AF_IEEE802154: c_int = 36;
703pub const AF_CAIF: c_int = 37;
704pub const AF_ALG: c_int = 38;
705
706pub const PF_UNSPEC: c_int = AF_UNSPEC;
707pub const PF_UNIX: c_int = AF_UNIX;
708pub const PF_LOCAL: c_int = AF_LOCAL;
709pub const PF_INET: c_int = AF_INET;
710pub const PF_AX25: c_int = AF_AX25;
711pub const PF_IPX: c_int = AF_IPX;
712pub const PF_APPLETALK: c_int = AF_APPLETALK;
713pub const PF_NETROM: c_int = AF_NETROM;
714pub const PF_BRIDGE: c_int = AF_BRIDGE;
715pub const PF_ATMPVC: c_int = AF_ATMPVC;
716pub const PF_X25: c_int = AF_X25;
717pub const PF_INET6: c_int = AF_INET6;
718pub const PF_ROSE: c_int = AF_ROSE;
719pub const PF_DECnet: c_int = AF_DECnet;
720pub const PF_NETBEUI: c_int = AF_NETBEUI;
721pub const PF_SECURITY: c_int = AF_SECURITY;
722pub const PF_KEY: c_int = AF_KEY;
723pub const PF_NETLINK: c_int = AF_NETLINK;
724pub const PF_ROUTE: c_int = AF_ROUTE;
725pub const PF_PACKET: c_int = AF_PACKET;
726pub const PF_ASH: c_int = AF_ASH;
727pub const PF_ECONET: c_int = AF_ECONET;
728pub const PF_ATMSVC: c_int = AF_ATMSVC;
729pub const PF_RDS: c_int = AF_RDS;
730pub const PF_SNA: c_int = AF_SNA;
731pub const PF_IRDA: c_int = AF_IRDA;
732pub const PF_PPPOX: c_int = AF_PPPOX;
733pub const PF_WANPIPE: c_int = AF_WANPIPE;
734pub const PF_LLC: c_int = AF_LLC;
735pub const PF_CAN: c_int = AF_CAN;
736pub const PF_TIPC: c_int = AF_TIPC;
737pub const PF_BLUETOOTH: c_int = AF_BLUETOOTH;
738pub const PF_IUCV: c_int = AF_IUCV;
739pub const PF_RXRPC: c_int = AF_RXRPC;
740pub const PF_ISDN: c_int = AF_ISDN;
741pub const PF_PHONET: c_int = AF_PHONET;
742pub const PF_IEEE802154: c_int = AF_IEEE802154;
743pub const PF_CAIF: c_int = AF_CAIF;
744pub const PF_ALG: c_int = AF_ALG;
745
746pub const MSG_OOB: c_int = 1;
747pub const MSG_PEEK: c_int = 2;
748pub const MSG_DONTROUTE: c_int = 4;
749pub const MSG_CTRUNC: c_int = 8;
750pub const MSG_TRUNC: c_int = 0x20;
751pub const MSG_DONTWAIT: c_int = 0x40;
752pub const MSG_EOR: c_int = 0x80;
753pub const MSG_WAITALL: c_int = 0x100;
754pub const MSG_FIN: c_int = 0x200;
755pub const MSG_SYN: c_int = 0x400;
756pub const MSG_CONFIRM: c_int = 0x800;
757pub const MSG_RST: c_int = 0x1000;
758pub const MSG_ERRQUEUE: c_int = 0x2000;
759pub const MSG_NOSIGNAL: c_int = 0x4000;
760pub const MSG_MORE: c_int = 0x8000;
761pub const MSG_WAITFORONE: c_int = 0x10000;
762pub const MSG_FASTOPEN: c_int = 0x20000000;
763pub const MSG_CMSG_CLOEXEC: c_int = 0x40000000;
764
765pub const IP_TOS: c_int = 1;
766pub const IP_TTL: c_int = 2;
767pub const IP_HDRINCL: c_int = 3;
768pub const IP_OPTIONS: c_int = 4;
769pub const IP_ROUTER_ALERT: c_int = 5;
770pub const IP_RECVOPTS: c_int = 6;
771pub const IP_RETOPTS: c_int = 7;
772pub const IP_PKTINFO: c_int = 8;
773pub const IP_PKTOPTIONS: c_int = 9;
774pub const IP_MTU_DISCOVER: c_int = 10;
775pub const IP_RECVERR: c_int = 11;
776pub const IP_RECVTTL: c_int = 12;
777pub const IP_RECVTOS: c_int = 13;
778pub const IP_MTU: c_int = 14;
779pub const IP_FREEBIND: c_int = 15;
780pub const IP_IPSEC_POLICY: c_int = 16;
781pub const IP_XFRM_POLICY: c_int = 17;
782pub const IP_PASSSEC: c_int = 18;
783pub const IP_TRANSPARENT: c_int = 19;
784pub const IP_ORIGDSTADDR: c_int = 20;
785pub const IP_RECVORIGDSTADDR: c_int = IP_ORIGDSTADDR;
786pub const IP_MINTTL: c_int = 21;
787#[cfg(not(target_os = "l4re"))]
788pub const IP_NODEFRAG: c_int = 22;
789#[cfg(not(target_os = "l4re"))]
790pub const IP_CHECKSUM: c_int = 23;
791#[cfg(not(target_os = "l4re"))]
792pub const IP_BIND_ADDRESS_NO_PORT: c_int = 24;
793pub const IP_MULTICAST_IF: c_int = 32;
794pub const IP_MULTICAST_TTL: c_int = 33;
795pub const IP_MULTICAST_LOOP: c_int = 34;
796pub const IP_ADD_MEMBERSHIP: c_int = 35;
797pub const IP_DROP_MEMBERSHIP: c_int = 36;
798pub const IP_UNBLOCK_SOURCE: c_int = 37;
799pub const IP_BLOCK_SOURCE: c_int = 38;
800pub const IP_ADD_SOURCE_MEMBERSHIP: c_int = 39;
801pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 40;
802pub const IP_MSFILTER: c_int = 41;
803pub const IP_MULTICAST_ALL: c_int = 49;
804pub const IP_UNICAST_IF: c_int = 50;
805
806pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1;
807pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1;
808
809pub const IP_PMTUDISC_DONT: c_int = 0;
810pub const IP_PMTUDISC_WANT: c_int = 1;
811pub const IP_PMTUDISC_DO: c_int = 2;
812pub const IP_PMTUDISC_PROBE: c_int = 3;
813#[cfg(not(target_os = "l4re"))]
814pub const IP_PMTUDISC_INTERFACE: c_int = 4;
815#[cfg(not(target_os = "l4re"))]
816pub const IP_PMTUDISC_OMIT: c_int = 5;
817
818// IPPROTO_IP defined in src/unix/mod.rs
819/// Hop-by-hop option header
820pub const IPPROTO_HOPOPTS: c_int = 0;
821// IPPROTO_ICMP defined in src/unix/mod.rs
822/// group mgmt protocol
823pub const IPPROTO_IGMP: c_int = 2;
824/// for compatibility
825pub const IPPROTO_IPIP: c_int = 4;
826// IPPROTO_TCP defined in src/unix/mod.rs
827/// exterior gateway protocol
828pub const IPPROTO_EGP: c_int = 8;
829/// pup
830pub const IPPROTO_PUP: c_int = 12;
831// IPPROTO_UDP defined in src/unix/mod.rs
832/// xns idp
833pub const IPPROTO_IDP: c_int = 22;
834/// tp-4 w/ class negotiation
835pub const IPPROTO_TP: c_int = 29;
836/// DCCP
837pub const IPPROTO_DCCP: c_int = 33;
838// IPPROTO_IPV6 defined in src/unix/mod.rs
839/// IP6 routing header
840pub const IPPROTO_ROUTING: c_int = 43;
841/// IP6 fragmentation header
842pub const IPPROTO_FRAGMENT: c_int = 44;
843/// resource reservation
844pub const IPPROTO_RSVP: c_int = 46;
845/// General Routing Encap.
846pub const IPPROTO_GRE: c_int = 47;
847/// IP6 Encap Sec. Payload
848pub const IPPROTO_ESP: c_int = 50;
849/// IP6 Auth Header
850pub const IPPROTO_AH: c_int = 51;
851// IPPROTO_ICMPV6 defined in src/unix/mod.rs
852/// IP6 no next header
853pub const IPPROTO_NONE: c_int = 59;
854/// IP6 destination option
855pub const IPPROTO_DSTOPTS: c_int = 60;
856pub const IPPROTO_MTP: c_int = 92;
857/// encapsulation header
858pub const IPPROTO_ENCAP: c_int = 98;
859/// Protocol indep. multicast
860pub const IPPROTO_PIM: c_int = 103;
861/// IP Payload Comp. Protocol
862pub const IPPROTO_COMP: c_int = 108;
863/// SCTP
864pub const IPPROTO_SCTP: c_int = 132;
865pub const IPPROTO_MH: c_int = 135;
866pub const IPPROTO_UDPLITE: c_int = 136;
867/// raw IP packet
868pub const IPPROTO_RAW: c_int = 255;
869pub const IPPROTO_BEETPH: c_int = 94;
870pub const IPPROTO_MPLS: c_int = 137;
871/// Multipath TCP
872#[cfg(not(target_os = "l4re"))]
873pub const IPPROTO_MPTCP: c_int = 262;
874/// Ethernet-within-IPv6 encapsulation.
875#[cfg(not(target_os = "l4re"))]
876pub const IPPROTO_ETHERNET: c_int = 143;
877
878pub const MCAST_EXCLUDE: c_int = 0;
879pub const MCAST_INCLUDE: c_int = 1;
880pub const MCAST_JOIN_GROUP: c_int = 42;
881pub const MCAST_BLOCK_SOURCE: c_int = 43;
882pub const MCAST_UNBLOCK_SOURCE: c_int = 44;
883pub const MCAST_LEAVE_GROUP: c_int = 45;
884pub const MCAST_JOIN_SOURCE_GROUP: c_int = 46;
885pub const MCAST_LEAVE_SOURCE_GROUP: c_int = 47;
886pub const MCAST_MSFILTER: c_int = 48;
887
888pub const IPV6_ADDRFORM: c_int = 1;
889pub const IPV6_2292PKTINFO: c_int = 2;
890pub const IPV6_2292HOPOPTS: c_int = 3;
891pub const IPV6_2292DSTOPTS: c_int = 4;
892pub const IPV6_2292RTHDR: c_int = 5;
893pub const IPV6_2292PKTOPTIONS: c_int = 6;
894pub const IPV6_CHECKSUM: c_int = 7;
895pub const IPV6_2292HOPLIMIT: c_int = 8;
896pub const IPV6_NEXTHOP: c_int = 9;
897pub const IPV6_AUTHHDR: c_int = 10;
898pub const IPV6_UNICAST_HOPS: c_int = 16;
899pub const IPV6_MULTICAST_IF: c_int = 17;
900pub const IPV6_MULTICAST_HOPS: c_int = 18;
901pub const IPV6_MULTICAST_LOOP: c_int = 19;
902pub const IPV6_ADD_MEMBERSHIP: c_int = 20;
903pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
904pub const IPV6_ROUTER_ALERT: c_int = 22;
905pub const IPV6_MTU_DISCOVER: c_int = 23;
906pub const IPV6_MTU: c_int = 24;
907pub const IPV6_RECVERR: c_int = 25;
908pub const IPV6_V6ONLY: c_int = 26;
909pub const IPV6_JOIN_ANYCAST: c_int = 27;
910pub const IPV6_LEAVE_ANYCAST: c_int = 28;
911pub const IPV6_IPSEC_POLICY: c_int = 34;
912pub const IPV6_XFRM_POLICY: c_int = 35;
913pub const IPV6_HDRINCL: c_int = 36;
914pub const IPV6_RECVPKTINFO: c_int = 49;
915pub const IPV6_PKTINFO: c_int = 50;
916pub const IPV6_RECVHOPLIMIT: c_int = 51;
917pub const IPV6_HOPLIMIT: c_int = 52;
918pub const IPV6_RECVHOPOPTS: c_int = 53;
919pub const IPV6_HOPOPTS: c_int = 54;
920pub const IPV6_RTHDRDSTOPTS: c_int = 55;
921pub const IPV6_RECVRTHDR: c_int = 56;
922pub const IPV6_RTHDR: c_int = 57;
923pub const IPV6_RECVDSTOPTS: c_int = 58;
924pub const IPV6_DSTOPTS: c_int = 59;
925#[cfg(not(target_os = "l4re"))]
926pub const IPV6_RECVPATHMTU: c_int = 60;
927#[cfg(not(target_os = "l4re"))]
928pub const IPV6_PATHMTU: c_int = 61;
929#[cfg(not(target_os = "l4re"))]
930pub const IPV6_DONTFRAG: c_int = 62;
931pub const IPV6_RECVTCLASS: c_int = 66;
932pub const IPV6_TCLASS: c_int = 67;
933cfg_if! {
934    if #[cfg(not(target_os = "l4re"))] {
935        pub const IPV6_AUTOFLOWLABEL: c_int = 70;
936        pub const IPV6_ADDR_PREFERENCES: c_int = 72;
937        pub const IPV6_MINHOPCOUNT: c_int = 73;
938        pub const IPV6_ORIGDSTADDR: c_int = 74;
939        pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR;
940        pub const IPV6_TRANSPARENT: c_int = 75;
941        pub const IPV6_UNICAST_IF: c_int = 76;
942        pub const IPV6_PREFER_SRC_TMP: c_int = 0x0001;
943        pub const IPV6_PREFER_SRC_PUBLIC: c_int = 0x0002;
944        pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: c_int = 0x0100;
945        pub const IPV6_PREFER_SRC_COA: c_int = 0x0004;
946        pub const IPV6_PREFER_SRC_HOME: c_int = 0x0400;
947        pub const IPV6_PREFER_SRC_CGA: c_int = 0x0008;
948        pub const IPV6_PREFER_SRC_NONCGA: c_int = 0x0800;
949    }
950}
951
952pub const IPV6_PMTUDISC_DONT: c_int = 0;
953pub const IPV6_PMTUDISC_WANT: c_int = 1;
954pub const IPV6_PMTUDISC_DO: c_int = 2;
955pub const IPV6_PMTUDISC_PROBE: c_int = 3;
956pub const IPV6_PMTUDISC_INTERFACE: c_int = 4;
957pub const IPV6_PMTUDISC_OMIT: c_int = 5;
958
959pub const TCP_NODELAY: c_int = 1;
960pub const TCP_MAXSEG: c_int = 2;
961pub const TCP_CORK: c_int = 3;
962pub const TCP_KEEPIDLE: c_int = 4;
963pub const TCP_KEEPINTVL: c_int = 5;
964pub const TCP_KEEPCNT: c_int = 6;
965pub const TCP_SYNCNT: c_int = 7;
966pub const TCP_LINGER2: c_int = 8;
967pub const TCP_DEFER_ACCEPT: c_int = 9;
968pub const TCP_WINDOW_CLAMP: c_int = 10;
969pub const TCP_INFO: c_int = 11;
970pub const TCP_QUICKACK: c_int = 12;
971pub const TCP_CONGESTION: c_int = 13;
972pub const TCP_MD5SIG: c_int = 14;
973cfg_if! {
974    if #[cfg(all(
975        target_os = "linux",
976        any(target_env = "gnu", target_env = "musl", target_env = "ohos")
977    ))] {
978        // WARN: deprecated
979        pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
980    }
981}
982pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
983pub const TCP_THIN_DUPACK: c_int = 17;
984pub const TCP_USER_TIMEOUT: c_int = 18;
985pub const TCP_REPAIR: c_int = 19;
986pub const TCP_REPAIR_QUEUE: c_int = 20;
987pub const TCP_QUEUE_SEQ: c_int = 21;
988pub const TCP_REPAIR_OPTIONS: c_int = 22;
989pub const TCP_FASTOPEN: c_int = 23;
990pub const TCP_TIMESTAMP: c_int = 24;
991pub const TCP_NOTSENT_LOWAT: c_int = 25;
992pub const TCP_CC_INFO: c_int = 26;
993pub const TCP_SAVE_SYN: c_int = 27;
994pub const TCP_SAVED_SYN: c_int = 28;
995cfg_if! {
996    if #[cfg(not(target_os = "emscripten"))] {
997        // NOTE: emscripten doesn't support these options yet.
998
999        pub const TCP_REPAIR_WINDOW: c_int = 29;
1000        pub const TCP_FASTOPEN_CONNECT: c_int = 30;
1001        pub const TCP_ULP: c_int = 31;
1002        pub const TCP_MD5SIG_EXT: c_int = 32;
1003        pub const TCP_FASTOPEN_KEY: c_int = 33;
1004        pub const TCP_FASTOPEN_NO_COOKIE: c_int = 34;
1005        pub const TCP_ZEROCOPY_RECEIVE: c_int = 35;
1006        pub const TCP_INQ: c_int = 36;
1007        pub const TCP_CM_INQ: c_int = TCP_INQ;
1008        // NOTE: Some CI images doesn't have this option yet.
1009        // pub const TCP_TX_DELAY: c_int = 37;
1010        pub const TCP_MD5SIG_MAXKEYLEN: usize = 80;
1011    }
1012}
1013
1014pub const LOCK_SH: c_int = 1;
1015pub const LOCK_EX: c_int = 2;
1016pub const LOCK_NB: c_int = 4;
1017pub const LOCK_UN: c_int = 8;
1018
1019pub const SS_ONSTACK: c_int = 1;
1020pub const SS_DISABLE: c_int = 2;
1021
1022/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1023/// for details.
1024pub const NAME_MAX: c_int = 255;
1025
1026/// Constants may change across releases. See the [usage guidelines](crate#usage-guidelines)
1027/// for details.
1028pub const PATH_MAX: c_int = 4096;
1029
1030pub const UIO_MAXIOV: c_int = 1024;
1031
1032pub const FD_SETSIZE: usize = 1024;
1033
1034pub const EPOLLIN: c_int = 0x1;
1035pub const EPOLLPRI: c_int = 0x2;
1036pub const EPOLLOUT: c_int = 0x4;
1037pub const EPOLLERR: c_int = 0x8;
1038pub const EPOLLHUP: c_int = 0x10;
1039pub const EPOLLRDNORM: c_int = 0x40;
1040pub const EPOLLRDBAND: c_int = 0x80;
1041pub const EPOLLWRNORM: c_int = 0x100;
1042pub const EPOLLWRBAND: c_int = 0x200;
1043pub const EPOLLMSG: c_int = 0x400;
1044pub const EPOLLRDHUP: c_int = 0x2000;
1045pub const EPOLLEXCLUSIVE: c_int = 0x10000000;
1046pub const EPOLLWAKEUP: c_int = 0x20000000;
1047pub const EPOLLONESHOT: c_int = 0x40000000;
1048pub const EPOLLET: c_int = u32_cast_int(0x80000000);
1049
1050pub const EPOLL_CTL_ADD: c_int = 1;
1051pub const EPOLL_CTL_MOD: c_int = 3;
1052pub const EPOLL_CTL_DEL: c_int = 2;
1053
1054pub const MNT_FORCE: c_int = 0x1;
1055pub const MNT_DETACH: c_int = 0x2;
1056pub const MNT_EXPIRE: c_int = 0x4;
1057pub const UMOUNT_NOFOLLOW: c_int = 0x8;
1058
1059cfg_if! {
1060    if #[cfg(not(target_os = "l4re"))] {
1061        pub const Q_GETFMT: c_int = 0x800004;
1062        pub const Q_GETINFO: c_int = 0x800005;
1063        pub const Q_SETINFO: c_int = 0x800006;
1064        pub const QIF_BLIMITS: u32 = 1;
1065        pub const QIF_SPACE: u32 = 2;
1066        pub const QIF_ILIMITS: u32 = 4;
1067        pub const QIF_INODES: u32 = 8;
1068        pub const QIF_BTIME: u32 = 16;
1069        pub const QIF_ITIME: u32 = 32;
1070        pub const QIF_LIMITS: u32 = 5;
1071        pub const QIF_USAGE: u32 = 10;
1072        pub const QIF_TIMES: u32 = 48;
1073        pub const QIF_ALL: u32 = 63;
1074
1075        pub const Q_SYNC: c_int = 0x800001;
1076        pub const Q_QUOTAON: c_int = 0x800002;
1077        pub const Q_QUOTAOFF: c_int = 0x800003;
1078        pub const Q_GETQUOTA: c_int = 0x800007;
1079        pub const Q_SETQUOTA: c_int = 0x800008;
1080    }
1081}
1082
1083pub const TCIOFF: c_int = 2;
1084pub const TCION: c_int = 3;
1085pub const TCOOFF: c_int = 0;
1086pub const TCOON: c_int = 1;
1087pub const TCIFLUSH: c_int = 0;
1088pub const TCOFLUSH: c_int = 1;
1089pub const TCIOFLUSH: c_int = 2;
1090pub const NL0: crate::tcflag_t = 0x00000000;
1091pub const NL1: crate::tcflag_t = 0x00000100;
1092pub const TAB0: crate::tcflag_t = 0x00000000;
1093pub const CR0: crate::tcflag_t = 0x00000000;
1094pub const FF0: crate::tcflag_t = 0x00000000;
1095pub const BS0: crate::tcflag_t = 0x00000000;
1096pub const VT0: crate::tcflag_t = 0x00000000;
1097pub const VERASE: usize = 2;
1098pub const VKILL: usize = 3;
1099pub const VINTR: usize = 0;
1100pub const VQUIT: usize = 1;
1101pub const VLNEXT: usize = 15;
1102pub const IGNBRK: crate::tcflag_t = 0x00000001;
1103pub const BRKINT: crate::tcflag_t = 0x00000002;
1104pub const IGNPAR: crate::tcflag_t = 0x00000004;
1105pub const PARMRK: crate::tcflag_t = 0x00000008;
1106pub const INPCK: crate::tcflag_t = 0x00000010;
1107pub const ISTRIP: crate::tcflag_t = 0x00000020;
1108pub const INLCR: crate::tcflag_t = 0x00000040;
1109pub const IGNCR: crate::tcflag_t = 0x00000080;
1110pub const ICRNL: crate::tcflag_t = 0x00000100;
1111pub const IXANY: crate::tcflag_t = 0x00000800;
1112pub const IMAXBEL: crate::tcflag_t = 0x00002000;
1113pub const OPOST: crate::tcflag_t = 0x1;
1114pub const CS5: crate::tcflag_t = 0x00000000;
1115pub const CRTSCTS: crate::tcflag_t = 0x80000000;
1116pub const ECHO: crate::tcflag_t = 0x00000008;
1117pub const OCRNL: crate::tcflag_t = 0o000010;
1118pub const ONOCR: crate::tcflag_t = 0o000020;
1119pub const ONLRET: crate::tcflag_t = 0o000040;
1120pub const OFILL: crate::tcflag_t = 0o000100;
1121pub const OFDEL: crate::tcflag_t = 0o000200;
1122
1123pub const CLONE_VM: c_int = 0x100;
1124pub const CLONE_FS: c_int = 0x200;
1125pub const CLONE_FILES: c_int = 0x400;
1126pub const CLONE_SIGHAND: c_int = 0x800;
1127pub const CLONE_PTRACE: c_int = 0x2000;
1128pub const CLONE_VFORK: c_int = 0x4000;
1129pub const CLONE_PARENT: c_int = 0x8000;
1130pub const CLONE_THREAD: c_int = 0x10000;
1131pub const CLONE_NEWNS: c_int = 0x20000;
1132pub const CLONE_SYSVSEM: c_int = 0x40000;
1133pub const CLONE_SETTLS: c_int = 0x80000;
1134pub const CLONE_PARENT_SETTID: c_int = 0x100000;
1135pub const CLONE_CHILD_CLEARTID: c_int = 0x200000;
1136pub const CLONE_DETACHED: c_int = 0x400000;
1137pub const CLONE_UNTRACED: c_int = 0x800000;
1138pub const CLONE_CHILD_SETTID: c_int = 0x01000000;
1139#[cfg(not(target_os = "l4re"))]
1140pub const CLONE_NEWCGROUP: c_int = 0x02000000;
1141pub const CLONE_NEWUTS: c_int = 0x04000000;
1142pub const CLONE_NEWIPC: c_int = 0x08000000;
1143pub const CLONE_NEWUSER: c_int = 0x10000000;
1144pub const CLONE_NEWPID: c_int = 0x20000000;
1145pub const CLONE_NEWNET: c_int = 0x40000000;
1146pub const CLONE_IO: c_int = u32_cast_int(0x80000000);
1147
1148pub const WNOHANG: c_int = 0x00000001;
1149pub const WUNTRACED: c_int = 0x00000002;
1150pub const WSTOPPED: c_int = WUNTRACED;
1151pub const WEXITED: c_int = 0x00000004;
1152pub const WCONTINUED: c_int = 0x00000008;
1153pub const WNOWAIT: c_int = 0x01000000;
1154
1155cfg_if! {
1156    if #[cfg(not(target_os = "l4re"))] {
1157        // Options for personality(2).
1158        pub const ADDR_NO_RANDOMIZE: c_int = 0x0040000;
1159        pub const MMAP_PAGE_ZERO: c_int = 0x0100000;
1160        pub const ADDR_COMPAT_LAYOUT: c_int = 0x0200000;
1161        pub const READ_IMPLIES_EXEC: c_int = 0x0400000;
1162        pub const ADDR_LIMIT_32BIT: c_int = 0x0800000;
1163        pub const SHORT_INODE: c_int = 0x1000000;
1164        pub const WHOLE_SECONDS: c_int = 0x2000000;
1165        pub const STICKY_TIMEOUTS: c_int = 0x4000000;
1166        pub const ADDR_LIMIT_3GB: c_int = 0x8000000;
1167
1168        // Options set using PTRACE_SETOPTIONS.
1169        pub const PTRACE_O_TRACESYSGOOD: c_int = 0x00000001;
1170        pub const PTRACE_O_TRACEFORK: c_int = 0x00000002;
1171        pub const PTRACE_O_TRACEVFORK: c_int = 0x00000004;
1172        pub const PTRACE_O_TRACECLONE: c_int = 0x00000008;
1173        pub const PTRACE_O_TRACEEXEC: c_int = 0x00000010;
1174        pub const PTRACE_O_TRACEVFORKDONE: c_int = 0x00000020;
1175        pub const PTRACE_O_TRACEEXIT: c_int = 0x00000040;
1176        pub const PTRACE_O_TRACESECCOMP: c_int = 0x00000080;
1177        pub const PTRACE_O_SUSPEND_SECCOMP: c_int = 0x00200000;
1178        pub const PTRACE_O_EXITKILL: c_int = 0x00100000;
1179        pub const PTRACE_O_MASK: c_int = 0x003000ff;
1180
1181        // Wait extended result codes for the above trace options.
1182        pub const PTRACE_EVENT_FORK: c_int = 1;
1183        pub const PTRACE_EVENT_VFORK: c_int = 2;
1184        pub const PTRACE_EVENT_CLONE: c_int = 3;
1185        pub const PTRACE_EVENT_EXEC: c_int = 4;
1186        pub const PTRACE_EVENT_VFORK_DONE: c_int = 5;
1187        pub const PTRACE_EVENT_EXIT: c_int = 6;
1188        pub const PTRACE_EVENT_SECCOMP: c_int = 7;
1189    }
1190}
1191
1192pub const __WNOTHREAD: c_int = 0x20000000;
1193pub const __WALL: c_int = 0x40000000;
1194pub const __WCLONE: c_int = u32_cast_int(0x80000000);
1195
1196cfg_if! {
1197    if #[cfg(not(target_os = "l4re"))] {
1198        pub const SPLICE_F_MOVE: c_uint = 0x01;
1199        pub const SPLICE_F_NONBLOCK: c_uint = 0x02;
1200        pub const SPLICE_F_MORE: c_uint = 0x04;
1201        pub const SPLICE_F_GIFT: c_uint = 0x08;
1202    }
1203}
1204
1205pub const RTLD_LOCAL: c_int = 0;
1206pub const RTLD_LAZY: c_int = 1;
1207
1208pub const POSIX_FADV_NORMAL: c_int = 0;
1209pub const POSIX_FADV_RANDOM: c_int = 1;
1210pub const POSIX_FADV_SEQUENTIAL: c_int = 2;
1211pub const POSIX_FADV_WILLNEED: c_int = 3;
1212
1213pub const AT_FDCWD: c_int = -100;
1214pub const AT_SYMLINK_NOFOLLOW: c_int = 0x100;
1215pub const AT_REMOVEDIR: c_int = 0x200;
1216pub const AT_SYMLINK_FOLLOW: c_int = 0x400;
1217pub const AT_NO_AUTOMOUNT: c_int = 0x800;
1218pub const AT_EMPTY_PATH: c_int = 0x1000;
1219pub const AT_RECURSIVE: c_int = 0x8000;
1220
1221pub const LOG_CRON: c_int = 9 << 3;
1222pub const LOG_AUTHPRIV: c_int = 10 << 3;
1223pub const LOG_FTP: c_int = 11 << 3;
1224pub const LOG_PERROR: c_int = 0x20;
1225
1226#[cfg(not(target_os = "l4re"))]
1227pub const PIPE_BUF: usize = 4096;
1228
1229pub const SI_LOAD_SHIFT: c_uint = 16;
1230
1231// si_code values
1232pub const SI_USER: c_int = 0;
1233pub const SI_KERNEL: c_int = 0x80;
1234pub const SI_QUEUE: c_int = -1;
1235cfg_if! {
1236    if #[cfg(not(any(
1237        target_arch = "mips",
1238        target_arch = "mips32r6",
1239        target_arch = "mips64"
1240    )))] {
1241        pub const SI_TIMER: c_int = -2;
1242        pub const SI_MESGQ: c_int = -3;
1243        pub const SI_ASYNCIO: c_int = -4;
1244    } else {
1245        pub const SI_TIMER: c_int = -3;
1246        pub const SI_MESGQ: c_int = -4;
1247        pub const SI_ASYNCIO: c_int = -2;
1248    }
1249}
1250pub const SI_SIGIO: c_int = -5;
1251pub const SI_TKILL: c_int = -6;
1252pub const SI_ASYNCNL: c_int = -60;
1253
1254// si_code values for SIGBUS signal
1255pub const BUS_ADRALN: c_int = 1;
1256pub const BUS_ADRERR: c_int = 2;
1257pub const BUS_OBJERR: c_int = 3;
1258// Linux-specific si_code values for SIGBUS signal
1259#[cfg(not(target_os = "l4re"))]
1260pub const BUS_MCEERR_AR: c_int = 4;
1261#[cfg(not(target_os = "l4re"))]
1262pub const BUS_MCEERR_AO: c_int = 5;
1263
1264// si_code values for SIGTRAP
1265pub const TRAP_BRKPT: c_int = 1;
1266pub const TRAP_TRACE: c_int = 2;
1267#[cfg(not(target_os = "l4re"))]
1268pub const TRAP_BRANCH: c_int = 3;
1269#[cfg(not(target_os = "l4re"))]
1270pub const TRAP_HWBKPT: c_int = 4;
1271#[cfg(not(target_os = "l4re"))]
1272pub const TRAP_UNK: c_int = 5;
1273
1274// si_code values for SIGCHLD signal
1275pub const CLD_EXITED: c_int = 1;
1276pub const CLD_KILLED: c_int = 2;
1277pub const CLD_DUMPED: c_int = 3;
1278pub const CLD_TRAPPED: c_int = 4;
1279pub const CLD_STOPPED: c_int = 5;
1280pub const CLD_CONTINUED: c_int = 6;
1281
1282pub const SIGEV_SIGNAL: c_int = 0;
1283pub const SIGEV_NONE: c_int = 1;
1284pub const SIGEV_THREAD: c_int = 2;
1285pub const SIGEV_THREAD_ID: c_int = 4;
1286
1287pub const P_ALL: idtype_t = 0;
1288pub const P_PID: idtype_t = 1;
1289pub const P_PGID: idtype_t = 2;
1290cfg_if! {
1291    if #[cfg(not(target_os = "emscripten"))] {
1292        pub const P_PIDFD: idtype_t = 3;
1293    }
1294}
1295
1296pub const UTIME_OMIT: c_long = 1073741822;
1297pub const UTIME_NOW: c_long = 1073741823;
1298
1299pub const POLLIN: c_short = 0x1;
1300pub const POLLPRI: c_short = 0x2;
1301pub const POLLOUT: c_short = 0x4;
1302pub const POLLERR: c_short = 0x8;
1303pub const POLLHUP: c_short = 0x10;
1304pub const POLLNVAL: c_short = 0x20;
1305pub const POLLRDNORM: c_short = 0x040;
1306pub const POLLRDBAND: c_short = 0x080;
1307#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
1308pub const POLLRDHUP: c_short = 0x2000;
1309#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
1310pub const POLLRDHUP: c_short = 0x800;
1311
1312pub const IPTOS_LOWDELAY: u8 = 0x10;
1313pub const IPTOS_THROUGHPUT: u8 = 0x08;
1314pub const IPTOS_RELIABILITY: u8 = 0x04;
1315pub const IPTOS_MINCOST: u8 = 0x02;
1316
1317pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
1318pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
1319pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
1320pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
1321pub const IPTOS_PREC_FLASH: u8 = 0x60;
1322pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
1323pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
1324pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
1325
1326pub const IPTOS_ECN_MASK: u8 = 0x03;
1327pub const IPTOS_ECN_ECT1: u8 = 0x01;
1328pub const IPTOS_ECN_ECT0: u8 = 0x02;
1329pub const IPTOS_ECN_CE: u8 = 0x03;
1330
1331pub const IPOPT_COPY: u8 = 0x80;
1332pub const IPOPT_CLASS_MASK: u8 = 0x60;
1333pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
1334
1335pub const IPOPT_CONTROL: u8 = 0x00;
1336pub const IPOPT_RESERVED1: u8 = 0x20;
1337pub const IPOPT_MEASUREMENT: u8 = 0x40;
1338pub const IPOPT_RESERVED2: u8 = 0x60;
1339pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL;
1340pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL;
1341pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY;
1342pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY;
1343pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT;
1344pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL;
1345pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY;
1346pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY;
1347pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY;
1348pub const IPVERSION: u8 = 4;
1349pub const MAXTTL: u8 = 255;
1350pub const IPDEFTTL: u8 = 64;
1351pub const IPOPT_OPTVAL: u8 = 0;
1352pub const IPOPT_OLEN: u8 = 1;
1353pub const IPOPT_OFFSET: u8 = 2;
1354pub const IPOPT_MINOFF: u8 = 4;
1355pub const MAX_IPOPTLEN: u8 = 40;
1356pub const IPOPT_NOP: u8 = IPOPT_NOOP;
1357pub const IPOPT_EOL: u8 = IPOPT_END;
1358pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP;
1359pub const IPOPT_TS_TSONLY: u8 = 0;
1360pub const IPOPT_TS_TSANDADDR: u8 = 1;
1361pub const IPOPT_TS_PRESPEC: u8 = 3;
1362
1363pub const ARPOP_RREQUEST: u16 = 3;
1364pub const ARPOP_RREPLY: u16 = 4;
1365pub const ARPOP_InREQUEST: u16 = 8;
1366pub const ARPOP_InREPLY: u16 = 9;
1367pub const ARPOP_NAK: u16 = 10;
1368
1369pub const ATF_NETMASK: c_int = 0x20;
1370pub const ATF_DONTPUB: c_int = 0x40;
1371
1372pub const ARPHRD_NETROM: u16 = 0;
1373pub const ARPHRD_ETHER: u16 = 1;
1374pub const ARPHRD_EETHER: u16 = 2;
1375pub const ARPHRD_AX25: u16 = 3;
1376pub const ARPHRD_PRONET: u16 = 4;
1377pub const ARPHRD_CHAOS: u16 = 5;
1378pub const ARPHRD_IEEE802: u16 = 6;
1379pub const ARPHRD_ARCNET: u16 = 7;
1380pub const ARPHRD_APPLETLK: u16 = 8;
1381pub const ARPHRD_DLCI: u16 = 15;
1382pub const ARPHRD_ATM: u16 = 19;
1383pub const ARPHRD_METRICOM: u16 = 23;
1384pub const ARPHRD_IEEE1394: u16 = 24;
1385pub const ARPHRD_EUI64: u16 = 27;
1386pub const ARPHRD_INFINIBAND: u16 = 32;
1387
1388pub const ARPHRD_SLIP: u16 = 256;
1389pub const ARPHRD_CSLIP: u16 = 257;
1390pub const ARPHRD_SLIP6: u16 = 258;
1391pub const ARPHRD_CSLIP6: u16 = 259;
1392pub const ARPHRD_RSRVD: u16 = 260;
1393pub const ARPHRD_ADAPT: u16 = 264;
1394pub const ARPHRD_ROSE: u16 = 270;
1395pub const ARPHRD_X25: u16 = 271;
1396pub const ARPHRD_HWX25: u16 = 272;
1397pub const ARPHRD_CAN: u16 = 280;
1398pub const ARPHRD_PPP: u16 = 512;
1399pub const ARPHRD_CISCO: u16 = 513;
1400pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO;
1401pub const ARPHRD_LAPB: u16 = 516;
1402pub const ARPHRD_DDCMP: u16 = 517;
1403pub const ARPHRD_RAWHDLC: u16 = 518;
1404
1405pub const ARPHRD_TUNNEL: u16 = 768;
1406pub const ARPHRD_TUNNEL6: u16 = 769;
1407pub const ARPHRD_FRAD: u16 = 770;
1408pub const ARPHRD_SKIP: u16 = 771;
1409pub const ARPHRD_LOOPBACK: u16 = 772;
1410pub const ARPHRD_LOCALTLK: u16 = 773;
1411pub const ARPHRD_FDDI: u16 = 774;
1412pub const ARPHRD_BIF: u16 = 775;
1413pub const ARPHRD_SIT: u16 = 776;
1414pub const ARPHRD_IPDDP: u16 = 777;
1415pub const ARPHRD_IPGRE: u16 = 778;
1416pub const ARPHRD_PIMREG: u16 = 779;
1417pub const ARPHRD_HIPPI: u16 = 780;
1418pub const ARPHRD_ASH: u16 = 781;
1419pub const ARPHRD_ECONET: u16 = 782;
1420pub const ARPHRD_IRDA: u16 = 783;
1421pub const ARPHRD_FCPP: u16 = 784;
1422pub const ARPHRD_FCAL: u16 = 785;
1423pub const ARPHRD_FCPL: u16 = 786;
1424pub const ARPHRD_FCFABRIC: u16 = 787;
1425pub const ARPHRD_IEEE802_TR: u16 = 800;
1426pub const ARPHRD_IEEE80211: u16 = 801;
1427pub const ARPHRD_IEEE80211_PRISM: u16 = 802;
1428pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803;
1429pub const ARPHRD_IEEE802154: u16 = 804;
1430
1431pub const ARPHRD_VOID: u16 = 0xFFFF;
1432pub const ARPHRD_NONE: u16 = 0xFFFE;
1433
1434cfg_if! {
1435    if #[cfg(not(any(target_os = "emscripten", target_os = "l4re")))] {
1436        // linux/if_tun.h
1437        /* TUNSETIFF ifr flags */
1438        pub const IFF_TUN: c_int = 0x0001;
1439        pub const IFF_TAP: c_int = 0x0002;
1440        pub const IFF_NAPI: c_int = 0x0010;
1441        pub const IFF_NAPI_FRAGS: c_int = 0x0020;
1442        // Used in TUNSETIFF to bring up tun/tap without carrier
1443        pub const IFF_NO_CARRIER: c_int = 0x0040;
1444        pub const IFF_NO_PI: c_int = 0x1000;
1445        // Read queue size
1446        pub const TUN_READQ_SIZE: c_short = 500;
1447        // TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead.
1448        pub const TUN_TUN_DEV: c_short = crate::IFF_TUN as c_short;
1449        pub const TUN_TAP_DEV: c_short = crate::IFF_TAP as c_short;
1450        pub const TUN_TYPE_MASK: c_short = 0x000f;
1451        // This flag has no real effect
1452        pub const IFF_ONE_QUEUE: c_int = 0x2000;
1453        pub const IFF_VNET_HDR: c_int = 0x4000;
1454        pub const IFF_TUN_EXCL: c_int = 0x8000;
1455        pub const IFF_MULTI_QUEUE: c_int = 0x0100;
1456        pub const IFF_ATTACH_QUEUE: c_int = 0x0200;
1457        pub const IFF_DETACH_QUEUE: c_int = 0x0400;
1458        // read-only flag
1459        pub const IFF_PERSIST: c_int = 0x0800;
1460        pub const IFF_NOFILTER: c_int = 0x1000;
1461        // Socket options
1462        pub const TUN_TX_TIMESTAMP: c_int = 1;
1463        // Features for GSO (TUNSETOFFLOAD)
1464        pub const TUN_F_CSUM: c_uint = 0x01;
1465        pub const TUN_F_TSO4: c_uint = 0x02;
1466        pub const TUN_F_TSO6: c_uint = 0x04;
1467        pub const TUN_F_TSO_ECN: c_uint = 0x08;
1468        pub const TUN_F_UFO: c_uint = 0x10;
1469        pub const TUN_F_USO4: c_uint = 0x20;
1470        pub const TUN_F_USO6: c_uint = 0x40;
1471        // Protocol info prepended to the packets (when IFF_NO_PI is not set)
1472        pub const TUN_PKT_STRIP: c_int = 0x0001;
1473        // Accept all multicast packets
1474        pub const TUN_FLT_ALLMULTI: c_int = 0x0001;
1475        // Ioctl operation codes
1476        const T_TYPE: u32 = b'T' as u32;
1477        pub const TUNSETNOCSUM: Ioctl = _IOW::<c_int>(T_TYPE, 200);
1478        pub const TUNSETDEBUG: Ioctl = _IOW::<c_int>(T_TYPE, 201);
1479        pub const TUNSETIFF: Ioctl = _IOW::<c_int>(T_TYPE, 202);
1480        pub const TUNSETPERSIST: Ioctl = _IOW::<c_int>(T_TYPE, 203);
1481        pub const TUNSETOWNER: Ioctl = _IOW::<c_int>(T_TYPE, 204);
1482        pub const TUNSETLINK: Ioctl = _IOW::<c_int>(T_TYPE, 205);
1483        pub const TUNSETGROUP: Ioctl = _IOW::<c_int>(T_TYPE, 206);
1484        pub const TUNGETFEATURES: Ioctl = _IOR::<c_int>(T_TYPE, 207);
1485        pub const TUNSETOFFLOAD: Ioctl = _IOW::<c_int>(T_TYPE, 208);
1486        pub const TUNSETTXFILTER: Ioctl = _IOW::<c_int>(T_TYPE, 209);
1487        pub const TUNGETIFF: Ioctl = _IOR::<c_int>(T_TYPE, 210);
1488        pub const TUNGETSNDBUF: Ioctl = _IOR::<c_int>(T_TYPE, 211);
1489        pub const TUNSETSNDBUF: Ioctl = _IOW::<c_int>(T_TYPE, 212);
1490        pub const TUNATTACHFILTER: Ioctl = _IOW::<sock_fprog>(T_TYPE, 213);
1491        pub const TUNDETACHFILTER: Ioctl = _IOW::<sock_fprog>(T_TYPE, 214);
1492        pub const TUNGETVNETHDRSZ: Ioctl = _IOR::<c_int>(T_TYPE, 215);
1493        pub const TUNSETVNETHDRSZ: Ioctl = _IOW::<c_int>(T_TYPE, 216);
1494        pub const TUNSETQUEUE: Ioctl = _IOW::<c_int>(T_TYPE, 217);
1495        pub const TUNSETIFINDEX: Ioctl = _IOW::<c_int>(T_TYPE, 218);
1496        pub const TUNGETFILTER: Ioctl = _IOR::<sock_fprog>(T_TYPE, 219);
1497        pub const TUNSETVNETLE: Ioctl = _IOW::<c_int>(T_TYPE, 220);
1498        pub const TUNGETVNETLE: Ioctl = _IOR::<c_int>(T_TYPE, 221);
1499        pub const TUNSETVNETBE: Ioctl = _IOW::<c_int>(T_TYPE, 222);
1500        pub const TUNGETVNETBE: Ioctl = _IOR::<c_int>(T_TYPE, 223);
1501        pub const TUNSETSTEERINGEBPF: Ioctl = _IOR::<c_int>(T_TYPE, 224);
1502        pub const TUNSETFILTEREBPF: Ioctl = _IOR::<c_int>(T_TYPE, 225);
1503        pub const TUNSETCARRIER: Ioctl = _IOW::<c_int>(T_TYPE, 226);
1504        pub const TUNGETDEVNETNS: Ioctl = _IO(T_TYPE, 227);
1505
1506        // linux/fs.h
1507        pub const FS_IOC_GETFLAGS: Ioctl = _IOR::<c_long>('f' as u32, 1);
1508        pub const FS_IOC_SETFLAGS: Ioctl = _IOW::<c_long>('f' as u32, 2);
1509        pub const FS_IOC_GETVERSION: Ioctl = _IOR::<c_long>('v' as u32, 1);
1510        pub const FS_IOC_SETVERSION: Ioctl = _IOW::<c_long>('v' as u32, 2);
1511        pub const FS_IOC32_GETFLAGS: Ioctl = _IOR::<c_int>('f' as u32, 1);
1512        pub const FS_IOC32_SETFLAGS: Ioctl = _IOW::<c_int>('f' as u32, 2);
1513        pub const FS_IOC32_GETVERSION: Ioctl = _IOR::<c_int>('v' as u32, 1);
1514        pub const FS_IOC32_SETVERSION: Ioctl = _IOW::<c_int>('v' as u32, 2);
1515
1516        pub const FICLONE: Ioctl = _IOW::<c_int>(0x94, 9);
1517        pub const FICLONERANGE: Ioctl = _IOW::<crate::file_clone_range>(0x94, 13);
1518    }
1519}
1520
1521cfg_if! {
1522    if #[cfg(any(target_os = "emscripten", target_os = "l4re"))] {
1523        // Emscripten does not define any `*_SUPER_MAGIC` constants.
1524    } else if #[cfg(not(target_arch = "s390x"))] {
1525        pub const ADFS_SUPER_MAGIC: c_long = 0x0000adf5;
1526        pub const AFFS_SUPER_MAGIC: c_long = 0x0000adff;
1527        pub const AFS_SUPER_MAGIC: c_long = 0x5346414f;
1528        pub const AUTOFS_SUPER_MAGIC: c_long = 0x0187;
1529        pub const BCACHEFS_SUPER_MAGIC: c_long = u32_cast_long(0xca451a4e);
1530        pub const BPF_FS_MAGIC: c_long = u32_cast_long(0xcafe4a11);
1531        pub const BTRFS_SUPER_MAGIC: c_long = u32_cast_long(0x9123683e);
1532        pub const CGROUP2_SUPER_MAGIC: c_long = 0x63677270;
1533        pub const CGROUP_SUPER_MAGIC: c_long = 0x27e0eb;
1534        pub const CODA_SUPER_MAGIC: c_long = 0x73757245;
1535        pub const CRAMFS_MAGIC: c_long = 0x28cd3d45;
1536        pub const DEBUGFS_MAGIC: c_long = 0x64626720;
1537        pub const DEVPTS_SUPER_MAGIC: c_long = 0x1cd1;
1538        pub const ECRYPTFS_SUPER_MAGIC: c_long = 0xf15f;
1539        pub const EFS_SUPER_MAGIC: c_long = 0x00414a53;
1540        pub const EXT2_SUPER_MAGIC: c_long = 0x0000ef53;
1541        pub const EXT3_SUPER_MAGIC: c_long = 0x0000ef53;
1542        pub const EXT4_SUPER_MAGIC: c_long = 0x0000ef53;
1543        pub const F2FS_SUPER_MAGIC: c_long = u32_cast_long(0xf2f52010);
1544        pub const FUSE_SUPER_MAGIC: c_long = 0x65735546;
1545        pub const FUTEXFS_SUPER_MAGIC: c_long = 0xbad1dea;
1546        pub const HOSTFS_SUPER_MAGIC: c_long = 0x00c0ffee;
1547        pub const HPFS_SUPER_MAGIC: c_long = u32_cast_long(0xf995e849);
1548        pub const HUGETLBFS_MAGIC: c_long = u32_cast_long(0x958458f6);
1549        pub const ISOFS_SUPER_MAGIC: c_long = 0x00009660;
1550        pub const JFFS2_SUPER_MAGIC: c_long = 0x000072b6;
1551        pub const MINIX2_SUPER_MAGIC2: c_long = 0x00002478;
1552        pub const MINIX2_SUPER_MAGIC: c_long = 0x00002468;
1553        pub const MINIX3_SUPER_MAGIC: c_long = 0x4d5a;
1554        pub const MINIX_SUPER_MAGIC2: c_long = 0x0000138f;
1555        pub const MINIX_SUPER_MAGIC: c_long = 0x0000137f;
1556        pub const MSDOS_SUPER_MAGIC: c_long = 0x00004d44;
1557        pub const NCP_SUPER_MAGIC: c_long = 0x0000564c;
1558        pub const NFS_SUPER_MAGIC: c_long = 0x00006969;
1559        pub const NILFS_SUPER_MAGIC: c_long = 0x3434;
1560        pub const OCFS2_SUPER_MAGIC: c_long = 0x7461636f;
1561        pub const OPENPROM_SUPER_MAGIC: c_long = 0x00009fa1;
1562        pub const OVERLAYFS_SUPER_MAGIC: c_long = 0x794c7630;
1563        pub const PROC_SUPER_MAGIC: c_long = 0x00009fa0;
1564        pub const QNX4_SUPER_MAGIC: c_long = 0x0000002f;
1565        pub const QNX6_SUPER_MAGIC: c_long = 0x68191122;
1566        pub const RDTGROUP_SUPER_MAGIC: c_long = 0x7655821;
1567        pub const REISERFS_SUPER_MAGIC: c_long = 0x52654973;
1568        pub const SECURITYFS_MAGIC: c_long = 0x73636673;
1569        pub const SELINUX_MAGIC: c_long = u32_cast_long(0xf97cff8c);
1570        pub const SMACK_MAGIC: c_long = 0x43415d53;
1571        pub const SMB_SUPER_MAGIC: c_long = 0x0000517b;
1572        pub const SYSFS_MAGIC: c_long = 0x62656572;
1573        pub const TMPFS_MAGIC: c_long = 0x01021994;
1574        pub const TRACEFS_MAGIC: c_long = 0x74726163;
1575        pub const UDF_SUPER_MAGIC: c_long = 0x15013346;
1576        pub const USBDEVICE_SUPER_MAGIC: c_long = 0x00009fa2;
1577        pub const XENFS_SUPER_MAGIC: c_long = u32_cast_long(0xabba1974);
1578        pub const NSFS_MAGIC: c_long = 0x6e736673;
1579    } else if #[cfg(target_arch = "s390x")] {
1580        pub const ADFS_SUPER_MAGIC: c_uint = 0x0000adf5;
1581        pub const AFFS_SUPER_MAGIC: c_uint = 0x0000adff;
1582        pub const AFS_SUPER_MAGIC: c_uint = 0x5346414f;
1583        pub const AUTOFS_SUPER_MAGIC: c_uint = 0x0187;
1584        pub const BCACHEFS_SUPER_MAGIC: c_long = 0xca451a4e;
1585        pub const BPF_FS_MAGIC: c_uint = 0xcafe4a11;
1586        pub const BTRFS_SUPER_MAGIC: c_uint = 0x9123683e;
1587        pub const CGROUP2_SUPER_MAGIC: c_uint = 0x63677270;
1588        pub const CGROUP_SUPER_MAGIC: c_uint = 0x27e0eb;
1589        pub const CODA_SUPER_MAGIC: c_uint = 0x73757245;
1590        pub const CRAMFS_MAGIC: c_uint = 0x28cd3d45;
1591        pub const DEBUGFS_MAGIC: c_uint = 0x64626720;
1592        pub const DEVPTS_SUPER_MAGIC: c_uint = 0x1cd1;
1593        pub const ECRYPTFS_SUPER_MAGIC: c_uint = 0xf15f;
1594        pub const EFS_SUPER_MAGIC: c_uint = 0x00414a53;
1595        pub const EXT2_SUPER_MAGIC: c_uint = 0x0000ef53;
1596        pub const EXT3_SUPER_MAGIC: c_uint = 0x0000ef53;
1597        pub const EXT4_SUPER_MAGIC: c_uint = 0x0000ef53;
1598        pub const F2FS_SUPER_MAGIC: c_uint = 0xf2f52010;
1599        pub const FUSE_SUPER_MAGIC: c_uint = 0x65735546;
1600        pub const FUTEXFS_SUPER_MAGIC: c_uint = 0xbad1dea;
1601        pub const HOSTFS_SUPER_MAGIC: c_uint = 0x00c0ffee;
1602        pub const HPFS_SUPER_MAGIC: c_uint = 0xf995e849;
1603        pub const HUGETLBFS_MAGIC: c_uint = 0x958458f6;
1604        pub const ISOFS_SUPER_MAGIC: c_uint = 0x00009660;
1605        pub const JFFS2_SUPER_MAGIC: c_uint = 0x000072b6;
1606        pub const MINIX2_SUPER_MAGIC2: c_uint = 0x00002478;
1607        pub const MINIX2_SUPER_MAGIC: c_uint = 0x00002468;
1608        pub const MINIX3_SUPER_MAGIC: c_uint = 0x4d5a;
1609        pub const MINIX_SUPER_MAGIC2: c_uint = 0x0000138f;
1610        pub const MINIX_SUPER_MAGIC: c_uint = 0x0000137f;
1611        pub const MSDOS_SUPER_MAGIC: c_uint = 0x00004d44;
1612        pub const NCP_SUPER_MAGIC: c_uint = 0x0000564c;
1613        pub const NFS_SUPER_MAGIC: c_uint = 0x00006969;
1614        pub const NILFS_SUPER_MAGIC: c_uint = 0x3434;
1615        pub const OCFS2_SUPER_MAGIC: c_uint = 0x7461636f;
1616        pub const OPENPROM_SUPER_MAGIC: c_uint = 0x00009fa1;
1617        pub const OVERLAYFS_SUPER_MAGIC: c_uint = 0x794c7630;
1618        pub const PROC_SUPER_MAGIC: c_uint = 0x00009fa0;
1619        pub const QNX4_SUPER_MAGIC: c_uint = 0x0000002f;
1620        pub const QNX6_SUPER_MAGIC: c_uint = 0x68191122;
1621        pub const RDTGROUP_SUPER_MAGIC: c_uint = 0x7655821;
1622        pub const REISERFS_SUPER_MAGIC: c_uint = 0x52654973;
1623        pub const SECURITYFS_MAGIC: c_uint = 0x73636673;
1624        pub const SELINUX_MAGIC: c_uint = 0xf97cff8c;
1625        pub const SMACK_MAGIC: c_uint = 0x43415d53;
1626        pub const SMB_SUPER_MAGIC: c_uint = 0x0000517b;
1627        pub const SYSFS_MAGIC: c_uint = 0x62656572;
1628        pub const TMPFS_MAGIC: c_uint = 0x01021994;
1629        pub const TRACEFS_MAGIC: c_uint = 0x74726163;
1630        pub const UDF_SUPER_MAGIC: c_uint = 0x15013346;
1631        pub const USBDEVICE_SUPER_MAGIC: c_uint = 0x00009fa2;
1632        pub const XENFS_SUPER_MAGIC: c_uint = 0xabba1974;
1633        pub const NSFS_MAGIC: c_uint = 0x6e736673;
1634    }
1635}
1636
1637cfg_if! {
1638    if #[cfg(any(
1639        target_env = "gnu",
1640        target_env = "musl",
1641        target_os = "android",
1642        target_os = "l4re"
1643    ))] {
1644        pub const AT_STATX_SYNC_TYPE: c_int = 0x6000;
1645        pub const AT_STATX_SYNC_AS_STAT: c_int = 0x0000;
1646        pub const AT_STATX_FORCE_SYNC: c_int = 0x2000;
1647        pub const AT_STATX_DONT_SYNC: c_int = 0x4000;
1648        pub const STATX_TYPE: c_uint = 0x0001;
1649        pub const STATX_MODE: c_uint = 0x0002;
1650        pub const STATX_NLINK: c_uint = 0x0004;
1651        pub const STATX_UID: c_uint = 0x0008;
1652        pub const STATX_GID: c_uint = 0x0010;
1653        pub const STATX_ATIME: c_uint = 0x0020;
1654        pub const STATX_MTIME: c_uint = 0x0040;
1655        pub const STATX_CTIME: c_uint = 0x0080;
1656        pub const STATX_INO: c_uint = 0x0100;
1657        pub const STATX_SIZE: c_uint = 0x0200;
1658        pub const STATX_BLOCKS: c_uint = 0x0400;
1659        pub const STATX_BASIC_STATS: c_uint = 0x07ff;
1660        pub const STATX_BTIME: c_uint = 0x0800;
1661        pub const STATX_ALL: c_uint = 0x0fff;
1662        pub const STATX_MNT_ID: c_uint = 0x1000;
1663        pub const STATX_DIOALIGN: c_uint = 0x2000;
1664        pub const STATX_MNT_ID_UNIQUE: c_uint = 0x00004000;
1665        pub const STATX_SUBVOL: c_uint = 0x00008000;
1666        pub const STATX_WRITE_ATOMIC: c_uint = 0x00010000;
1667        // Not in the Android NDK as of r29.
1668        #[cfg(not(target_os = "android"))]
1669        pub const STATX_DIO_READ_ALIGN: c_uint = 0x00020000;
1670        pub const STATX__RESERVED: c_int = u32_cast_int(0x80000000);
1671        pub const STATX_ATTR_COMPRESSED: c_int = 0x0004;
1672        pub const STATX_ATTR_IMMUTABLE: c_int = 0x0010;
1673        pub const STATX_ATTR_APPEND: c_int = 0x0020;
1674        pub const STATX_ATTR_NODUMP: c_int = 0x0040;
1675        pub const STATX_ATTR_ENCRYPTED: c_int = 0x0800;
1676        pub const STATX_ATTR_AUTOMOUNT: c_int = 0x1000;
1677        pub const STATX_ATTR_MOUNT_ROOT: c_int = 0x2000;
1678        pub const STATX_ATTR_VERITY: c_int = 0x100000;
1679        pub const STATX_ATTR_DAX: c_int = 0x200000;
1680        pub const STATX_ATTR_WRITE_ATOMIC: c_int = 0x00400000;
1681    }
1682}
1683
1684// https://github.com/search?q=repo%3Atorvalds%2Flinux+%22%23define+_IOC_NONE%22&type=code
1685cfg_if! {
1686    if #[cfg(not(target_os = "emscripten"))] {
1687        const _IOC_NRBITS: u32 = 8;
1688        const _IOC_TYPEBITS: u32 = 8;
1689
1690        cfg_if! {
1691            if #[cfg(any(
1692                any(target_arch = "powerpc", target_arch = "powerpc64"),
1693                any(target_arch = "sparc", target_arch = "sparc64"),
1694                any(target_arch = "mips", target_arch = "mips64"),
1695            ))] {
1696                // https://github.com/torvalds/linux/blob/b311c1b497e51a628aa89e7cb954481e5f9dced2/arch/powerpc/include/uapi/asm/ioctl.h
1697                // https://github.com/torvalds/linux/blob/b311c1b497e51a628aa89e7cb954481e5f9dced2/arch/sparc/include/uapi/asm/ioctl.h
1698                // https://github.com/torvalds/linux/blob/b311c1b497e51a628aa89e7cb954481e5f9dced2/arch/mips/include/uapi/asm/ioctl.h
1699
1700                const _IOC_SIZEBITS: u32 = 13;
1701                const _IOC_DIRBITS: u32 = 3;
1702
1703                const _IOC_NONE: u32 = 1;
1704                const _IOC_READ: u32 = 2;
1705                const _IOC_WRITE: u32 = 4;
1706            } else {
1707                // https://github.com/torvalds/linux/blob/b311c1b497e51a628aa89e7cb954481e5f9dced2/include/uapi/asm-generic/ioctl.h
1708
1709                const _IOC_SIZEBITS: u32 = 14;
1710                const _IOC_DIRBITS: u32 = 2;
1711
1712                const _IOC_NONE: u32 = 0;
1713                const _IOC_WRITE: u32 = 1;
1714                const _IOC_READ: u32 = 2;
1715            }
1716        }
1717        const _IOC_NRMASK: u32 = (1 << _IOC_NRBITS) - 1;
1718        const _IOC_TYPEMASK: u32 = (1 << _IOC_TYPEBITS) - 1;
1719        const _IOC_SIZEMASK: u32 = (1 << _IOC_SIZEBITS) - 1;
1720        const _IOC_DIRMASK: u32 = (1 << _IOC_DIRBITS) - 1;
1721
1722        const _IOC_NRSHIFT: u32 = 0;
1723        const _IOC_TYPESHIFT: u32 = _IOC_NRSHIFT + _IOC_NRBITS;
1724        const _IOC_SIZESHIFT: u32 = _IOC_TYPESHIFT + _IOC_TYPEBITS;
1725        const _IOC_DIRSHIFT: u32 = _IOC_SIZESHIFT + _IOC_SIZEBITS;
1726
1727        // adapted from https://github.com/torvalds/linux/blob/8a696a29c6905594e4abf78eaafcb62165ac61f1/rust/kernel/ioctl.rs
1728
1729        /// Build an ioctl number, analogous to the C macro of the same name.
1730        const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> Ioctl {
1731            if true {
    if !(dir <= _IOC_DIRMASK) {
        ::core::panicking::panic("assertion failed: dir <= _IOC_DIRMASK")
    };
};core::debug_assert!(dir <= _IOC_DIRMASK);
1732            if true {
    if !(ty <= _IOC_TYPEMASK) {
        ::core::panicking::panic("assertion failed: ty <= _IOC_TYPEMASK")
    };
};core::debug_assert!(ty <= _IOC_TYPEMASK);
1733            if true {
    if !(nr <= _IOC_NRMASK) {
        ::core::panicking::panic("assertion failed: nr <= _IOC_NRMASK")
    };
};core::debug_assert!(nr <= _IOC_NRMASK);
1734            if true {
    if !(size <= (_IOC_SIZEMASK as usize)) {
        ::core::panicking::panic("assertion failed: size <= (_IOC_SIZEMASK as usize)")
    };
};core::debug_assert!(size <= (_IOC_SIZEMASK as usize));
1735
1736            ((dir << _IOC_DIRSHIFT)
1737                | (ty << _IOC_TYPESHIFT)
1738                | (nr << _IOC_NRSHIFT)
1739                | ((size as u32) << _IOC_SIZESHIFT)) as Ioctl
1740        }
1741
1742        /// Build an ioctl number for an argumentless ioctl.
1743        pub const fn _IO(ty: u32, nr: u32) -> Ioctl {
1744            _IOC(_IOC_NONE, ty, nr, 0)
1745        }
1746
1747        /// Build an ioctl number for an read-only ioctl.
1748        pub const fn _IOR<T>(ty: u32, nr: u32) -> Ioctl {
1749            _IOC(_IOC_READ, ty, nr, size_of::<T>())
1750        }
1751
1752        /// Build an ioctl number for an write-only ioctl.
1753        pub const fn _IOW<T>(ty: u32, nr: u32) -> Ioctl {
1754            _IOC(_IOC_WRITE, ty, nr, size_of::<T>())
1755        }
1756
1757        /// Build an ioctl number for a read-write ioctl.
1758        pub const fn _IOWR<T>(ty: u32, nr: u32) -> Ioctl {
1759            _IOC(_IOC_READ | _IOC_WRITE, ty, nr, size_of::<T>())
1760        }
1761
1762        extern "C" {
1763            #[cfg_attr(gnu_time_bits64, link_name = "__ioctl_time64")]
1764            pub fn ioctl(fd: c_int, request: Ioctl, ...) -> c_int;
1765        }
1766    }
1767}
1768
1769const fn CMSG_ALIGN(len: usize) -> usize {
1770    (len + size_of::<usize>() - 1) & !(size_of::<usize>() - 1)
1771}
1772
1773#[inline]
pub unsafe extern "C" fn FD_ZERO(set: *mut fd_set) -> () {
    (*set).fds_bits.fill(0);
}
#[inline]
pub extern "C" fn SIGRTMAX() -> c_int { unsafe { __libc_current_sigrtmax() } }
#[inline]
pub extern "C" fn SIGRTMIN() -> c_int { unsafe { __libc_current_sigrtmin() } }
#[inline]
pub const extern "C" fn WIFSTOPPED(status: c_int) -> bool {
    (status & 0xff) == 0x7f
}
#[inline]
pub const extern "C" fn WSTOPSIG(status: c_int) -> c_int {
    (status >> 8) & 0xff
}
#[inline]
pub const extern "C" fn WIFCONTINUED(status: c_int) -> bool {
    status == 0xffff
}
#[inline]
pub const extern "C" fn WIFSIGNALED(status: c_int) -> bool {
    ((status & 0x7f) + 1) as i8 >= 2
}
#[inline]
pub const extern "C" fn WTERMSIG(status: c_int) -> c_int { status & 0x7f }
#[inline]
pub const extern "C" fn WIFEXITED(status: c_int) -> bool {
    (status & 0x7f) == 0
}
#[inline]
pub const extern "C" fn WEXITSTATUS(status: c_int) -> c_int {
    (status >> 8) & 0xff
}
#[inline]
pub const extern "C" fn WCOREDUMP(status: c_int) -> bool {
    (status & 0x80) != 0
}
#[inline]
pub const extern "C" fn W_EXITCODE(ret: c_int, sig: c_int) -> c_int {
    (ret << 8) | sig
}
#[inline]
pub const extern "C" fn W_STOPCODE(sig: c_int) -> c_int { (sig << 8) | 0x7f }
#[inline]
pub const extern "C" fn QCMD(cmd: c_int, type_: c_int) -> c_int {
    (cmd << 8) | (type_ & 0x00ff)
}
#[inline]
pub const extern "C" fn IPOPT_COPIED(o: u8) -> u8 { o & IPOPT_COPY }
#[inline]
pub const extern "C" fn IPOPT_CLASS(o: u8) -> u8 { o & IPOPT_CLASS_MASK }
#[inline]
pub const extern "C" fn IPOPT_NUMBER(o: u8) -> u8 { o & IPOPT_NUMBER_MASK }
#[inline]
pub const extern "C" fn IPTOS_ECN(x: u8) -> u8 { x & crate::IPTOS_ECN_MASK }
#[inline]
#[allow(ellipsis_inclusive_range_patterns)]
pub const extern "C" fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
    ((a << 16) + (b << 8)) + if c > 255 { 255 } else { c }
}f! {
1774    pub unsafe fn CMSG_FIRSTHDR(mhdr: *const crate::msghdr) -> *mut crate::cmsghdr {
1775        if (*mhdr).msg_controllen as usize >= size_of::<crate::cmsghdr>() {
1776            (*mhdr).msg_control.cast()
1777        } else {
1778            ptr::null_mut()
1779        }
1780    }
1781
1782    pub unsafe fn CMSG_DATA(cmsg: *const crate::cmsghdr) -> *mut c_uchar {
1783        cmsg.offset(1) as *mut c_uchar
1784    }
1785
1786    pub const unsafe fn CMSG_SPACE(length: c_uint) -> c_uint {
1787        (CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::<crate::cmsghdr>())) as c_uint
1788    }
1789
1790    pub const unsafe fn CMSG_LEN(length: c_uint) -> c_uint {
1791        CMSG_ALIGN(size_of::<crate::cmsghdr>()) as c_uint + length
1792    }
1793
1794    pub unsafe fn FD_CLR(fd: c_int, set: *mut fd_set) -> () {
1795        let fd = fd as usize;
1796        let size = size_of_val(&(*set).fds_bits[0]) * 8;
1797        let Some(slot) = (*set).fds_bits.get_mut(fd / size) else {
1798            panic!("fd {fd} out of range: valid fds are 0..FD_SETSIZE (0..{FD_SETSIZE})");
1799        };
1800        *slot &= !(1 << (fd % size));
1801    }
1802
1803    pub unsafe fn FD_ISSET(fd: c_int, set: *const fd_set) -> bool {
1804        let fd = fd as usize;
1805        let size = size_of_val(&(*set).fds_bits[0]) * 8;
1806        let Some(slot) = (*set).fds_bits.get(fd / size) else {
1807            panic!("fd {fd} out of range: valid fds are 0..FD_SETSIZE (0..{FD_SETSIZE})");
1808        };
1809        (*slot & (1 << (fd % size))) != 0
1810    }
1811
1812    pub unsafe fn FD_SET(fd: c_int, set: *mut fd_set) -> () {
1813        let fd = fd as usize;
1814        let size = size_of_val(&(*set).fds_bits[0]) * 8;
1815        let Some(slot) = (*set).fds_bits.get_mut(fd / size) else {
1816            panic!("fd {fd} out of range: valid fds are 0..FD_SETSIZE (0..{FD_SETSIZE})");
1817        };
1818        *slot |= 1 << (fd % size);
1819    }
1820
1821    pub unsafe fn FD_ZERO(set: *mut fd_set) -> () {
1822        (*set).fds_bits.fill(0);
1823    }
1824
1825    pub safe fn SIGRTMAX() -> c_int {
1826        unsafe { __libc_current_sigrtmax() }
1827    }
1828
1829    pub safe fn SIGRTMIN() -> c_int {
1830        unsafe { __libc_current_sigrtmin() }
1831    }
1832
1833    pub const safe fn WIFSTOPPED(status: c_int) -> bool {
1834        (status & 0xff) == 0x7f
1835    }
1836
1837    pub const safe fn WSTOPSIG(status: c_int) -> c_int {
1838        (status >> 8) & 0xff
1839    }
1840
1841    pub const safe fn WIFCONTINUED(status: c_int) -> bool {
1842        status == 0xffff
1843    }
1844
1845    pub const safe fn WIFSIGNALED(status: c_int) -> bool {
1846        ((status & 0x7f) + 1) as i8 >= 2
1847    }
1848
1849    pub const safe fn WTERMSIG(status: c_int) -> c_int {
1850        status & 0x7f
1851    }
1852
1853    pub const safe fn WIFEXITED(status: c_int) -> bool {
1854        (status & 0x7f) == 0
1855    }
1856
1857    pub const safe fn WEXITSTATUS(status: c_int) -> c_int {
1858        (status >> 8) & 0xff
1859    }
1860
1861    pub const safe fn WCOREDUMP(status: c_int) -> bool {
1862        (status & 0x80) != 0
1863    }
1864
1865    pub const safe fn W_EXITCODE(ret: c_int, sig: c_int) -> c_int {
1866        (ret << 8) | sig
1867    }
1868
1869    pub const safe fn W_STOPCODE(sig: c_int) -> c_int {
1870        (sig << 8) | 0x7f
1871    }
1872
1873    pub const safe fn QCMD(cmd: c_int, type_: c_int) -> c_int {
1874        (cmd << 8) | (type_ & 0x00ff)
1875    }
1876
1877    pub const safe fn IPOPT_COPIED(o: u8) -> u8 {
1878        o & IPOPT_COPY
1879    }
1880
1881    pub const safe fn IPOPT_CLASS(o: u8) -> u8 {
1882        o & IPOPT_CLASS_MASK
1883    }
1884
1885    pub const safe fn IPOPT_NUMBER(o: u8) -> u8 {
1886        o & IPOPT_NUMBER_MASK
1887    }
1888
1889    pub const safe fn IPTOS_ECN(x: u8) -> u8 {
1890        x & crate::IPTOS_ECN_MASK
1891    }
1892
1893    #[allow(ellipsis_inclusive_range_patterns)]
1894    pub const safe fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
1895        ((a << 16) + (b << 8)) + if c > 255 { 255 } else { c }
1896    }
1897}
1898
1899extern "C" {
1900    #[doc(hidden)]
1901    pub fn __libc_current_sigrtmax() -> c_int;
1902    #[doc(hidden)]
1903    pub fn __libc_current_sigrtmin() -> c_int;
1904
1905    pub fn sem_destroy(sem: *mut sem_t) -> c_int;
1906    pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
1907    pub fn fdatasync(fd: c_int) -> c_int;
1908    #[cfg(not(target_os = "l4re"))]
1909    pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar) -> c_int;
1910
1911    #[cfg_attr(gnu_time_bits64, link_name = "__clock_getres64")]
1912    #[cfg_attr(musl_redir_time64, link_name = "__clock_getres_time64")]
1913    pub fn clock_getres(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1914    #[cfg_attr(
1915        any(gnu_time_bits64, musl_redir_time64),
1916        link_name = "__clock_gettime64"
1917    )]
1918    pub fn clock_gettime(clk_id: crate::clockid_t, tp: *mut crate::timespec) -> c_int;
1919    #[cfg_attr(
1920        any(gnu_time_bits64, musl_redir_time64),
1921        link_name = "__clock_settime64"
1922    )]
1923    pub fn clock_settime(clk_id: crate::clockid_t, tp: *const crate::timespec) -> c_int;
1924    #[cfg(not(target_os = "l4re"))]
1925    pub fn clock_getcpuclockid(pid: crate::pid_t, clk_id: *mut crate::clockid_t) -> c_int;
1926
1927    #[cfg_attr(gnu_time_bits64, link_name = "__getitimer64")]
1928    #[cfg_attr(musl_redir_time64, link_name = "__getitimer_time64")]
1929    pub fn getitimer(which: c_int, curr_value: *mut crate::itimerval) -> c_int;
1930    #[cfg_attr(gnu_time_bits64, link_name = "__setitimer64")]
1931    #[cfg_attr(musl_redir_time64, link_name = "__setitimer_time64")]
1932    pub fn setitimer(
1933        which: c_int,
1934        new_value: *const crate::itimerval,
1935        old_value: *mut crate::itimerval,
1936    ) -> c_int;
1937
1938    pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
1939
1940    pub fn memalign(align: size_t, size: size_t) -> *mut c_void;
1941    pub fn setgroups(ngroups: size_t, ptr: *const crate::gid_t) -> c_int;
1942    #[cfg(not(target_os = "l4re"))]
1943    pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int;
1944    #[cfg_attr(gnu_file_offset_bits64, link_name = "statfs64")]
1945    pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
1946    #[cfg_attr(gnu_file_offset_bits64, link_name = "fstatfs64")]
1947    pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
1948    pub fn memrchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
1949    #[cfg_attr(gnu_file_offset_bits64, link_name = "posix_fadvise64")]
1950    pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int;
1951    #[cfg_attr(gnu_time_bits64, link_name = "__futimens64")]
1952    #[cfg_attr(musl_redir_time64, link_name = "__futimens_time64")]
1953    #[cfg(not(target_os = "l4re"))]
1954    pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int;
1955    #[cfg_attr(gnu_time_bits64, link_name = "__utimensat64")]
1956    #[cfg_attr(musl_redir_time64, link_name = "__utimensat_time64")]
1957    pub fn utimensat(
1958        dirfd: c_int,
1959        path: *const c_char,
1960        times: *const crate::timespec,
1961        flag: c_int,
1962    ) -> c_int;
1963    #[cfg(not(target_os = "l4re"))]
1964    pub fn duplocale(base: crate::locale_t) -> crate::locale_t;
1965    pub fn freelocale(loc: crate::locale_t);
1966    pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t;
1967    pub fn uselocale(loc: crate::locale_t) -> crate::locale_t;
1968    #[cfg(not(target_os = "l4re"))]
1969    pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
1970
1971    #[cfg(not(target_os = "l4re"))]
1972    pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int;
1973    pub fn clearenv() -> c_int;
1974    #[cfg(not(target_os = "l4re"))]
1975    pub fn waitid(
1976        idtype: idtype_t,
1977        id: id_t,
1978        infop: *mut crate::siginfo_t,
1979        options: c_int,
1980    ) -> c_int;
1981    #[cfg(not(target_os = "l4re"))]
1982    pub fn getresuid(
1983        ruid: *mut crate::uid_t,
1984        euid: *mut crate::uid_t,
1985        suid: *mut crate::uid_t,
1986    ) -> c_int;
1987    #[cfg(not(target_os = "l4re"))]
1988    pub fn getresgid(
1989        rgid: *mut crate::gid_t,
1990        egid: *mut crate::gid_t,
1991        sgid: *mut crate::gid_t,
1992    ) -> c_int;
1993    #[cfg(not(target_os = "l4re"))]
1994    pub fn acct(filename: *const c_char) -> c_int;
1995    #[cfg(not(target_os = "l4re"))]
1996    pub fn brk(addr: *mut c_void) -> c_int;
1997    #[cfg(not(target_os = "l4re"))]
1998    pub fn sbrk(increment: intptr_t) -> *mut c_void;
1999    #[deprecated(
2000        since = "0.2.66",
2001        note = "causes memory corruption, see rust-lang/libc#1596"
2002    )]
2003    pub fn vfork() -> crate::pid_t;
2004    #[cfg(not(target_os = "l4re"))]
2005    pub fn setresgid(rgid: crate::gid_t, egid: crate::gid_t, sgid: crate::gid_t) -> c_int;
2006    #[cfg(not(target_os = "l4re"))]
2007    pub fn setresuid(ruid: crate::uid_t, euid: crate::uid_t, suid: crate::uid_t) -> c_int;
2008    #[cfg_attr(any(gnu_time_bits64, musl_redir_time64), link_name = "__wait4_time64")]
2009    #[cfg(not(target_os = "l4re"))]
2010    pub fn wait4(
2011        pid: crate::pid_t,
2012        status: *mut c_int,
2013        options: c_int,
2014        rusage: *mut crate::rusage,
2015    ) -> crate::pid_t;
2016    #[cfg(not(target_os = "l4re"))]
2017    pub fn login_tty(fd: c_int) -> c_int;
2018
2019    // DIFF(main): changed to `*const *mut` in e77f551de9
2020    #[cfg(not(target_os = "l4re"))]
2021    pub fn execvpe(
2022        file: *const c_char,
2023        argv: *const *const c_char,
2024        envp: *const *const c_char,
2025    ) -> c_int;
2026    #[cfg(not(target_os = "l4re"))]
2027    pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int;
2028    #[cfg(not(target_os = "l4re"))]
2029    pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int;
2030    #[cfg(not(target_os = "l4re"))]
2031    pub fn freeifaddrs(ifa: *mut crate::ifaddrs);
2032    pub fn bind(
2033        socket: c_int,
2034        address: *const crate::sockaddr,
2035        address_len: crate::socklen_t,
2036    ) -> c_int;
2037
2038    pub fn writev(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
2039    pub fn readv(fd: c_int, iov: *const crate::iovec, iovcnt: c_int) -> ssize_t;
2040
2041    #[cfg_attr(gnu_time_bits64, link_name = "__sendmsg64")]
2042    pub fn sendmsg(fd: c_int, msg: *const crate::msghdr, flags: c_int) -> ssize_t;
2043    #[cfg_attr(gnu_time_bits64, link_name = "__recvmsg64")]
2044    pub fn recvmsg(fd: c_int, msg: *mut crate::msghdr, flags: c_int) -> ssize_t;
2045    pub fn uname(buf: *mut crate::utsname) -> c_int;
2046
2047    pub fn strchrnul(s: *const c_char, c: c_int) -> *mut c_char;
2048
2049    pub fn strftime(
2050        s: *mut c_char,
2051        max: size_t,
2052        format: *const c_char,
2053        tm: *const crate::tm,
2054    ) -> size_t;
2055    pub fn strftime_l(
2056        s: *mut c_char,
2057        max: size_t,
2058        format: *const c_char,
2059        tm: *const crate::tm,
2060        locale: crate::locale_t,
2061    ) -> size_t;
2062    pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char;
2063
2064    #[cfg_attr(gnu_file_offset_bits64, link_name = "mkostemp64")]
2065    pub fn mkostemp(template: *mut c_char, flags: c_int) -> c_int;
2066    #[cfg_attr(gnu_file_offset_bits64, link_name = "mkostemps64")]
2067    #[cfg(not(target_os = "l4re"))]
2068    pub fn mkostemps(template: *mut c_char, suffixlen: c_int, flags: c_int) -> c_int;
2069
2070    #[cfg(not(target_os = "l4re"))]
2071    pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int;
2072    #[cfg(not(target_os = "l4re"))]
2073    pub fn setdomainname(name: *const c_char, len: size_t) -> c_int;
2074
2075    pub fn if_nameindex() -> *mut if_nameindex;
2076    pub fn if_freenameindex(ptr: *mut if_nameindex);
2077
2078    pub fn getpwnam_r(
2079        name: *const c_char,
2080        pwd: *mut passwd,
2081        buf: *mut c_char,
2082        buflen: size_t,
2083        result: *mut *mut passwd,
2084    ) -> c_int;
2085    pub fn getpwuid_r(
2086        uid: crate::uid_t,
2087        pwd: *mut passwd,
2088        buf: *mut c_char,
2089        buflen: size_t,
2090        result: *mut *mut passwd,
2091    ) -> c_int;
2092}
2093
2094// LFS64 extensions
2095//
2096// * musl and Emscripten has 64-bit versions only so aliases the LFS64 symbols to the standard ones
2097// * ulibc doesn't have preadv64/pwritev64
2098cfg_if! {
2099    if #[cfg(not(any(
2100        target_env = "musl",
2101        target_env = "ohos",
2102        target_os = "emscripten",
2103    )))] {
2104        extern "C" {
2105            // FIXME(1.0,deprecate): lfs binding to be removed
2106            pub fn fstatfs64(fd: c_int, buf: *mut statfs64) -> c_int;
2107            // FIXME(1.0,deprecate): lfs binding to be removed
2108            #[cfg(not(all(target_os = "linux", target_env = "gnu")))] // defined in new/glibc
2109            pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int;
2110            // FIXME(1.0,deprecate): lfs binding to be removed
2111            #[cfg(not(all(target_os = "linux", target_env = "gnu")))] // defined in new/glibc
2112            pub fn fstatvfs64(fd: c_int, buf: *mut statvfs64) -> c_int;
2113            // FIXME(1.0,deprecate): lfs binding to be removed
2114            pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int;
2115            // FIXME(1.0,deprecate): lfs binding to be removed
2116            pub fn creat64(path: *const c_char, mode: mode_t) -> c_int;
2117            #[cfg_attr(gnu_time_bits64, link_name = "__fstat64_time64")]
2118            // FIXME(1.0,deprecate): lfs binding to be removed
2119            pub fn fstat64(fildes: c_int, buf: *mut stat64) -> c_int;
2120            #[cfg_attr(gnu_time_bits64, link_name = "__fstatat64_time64")]
2121            #[cfg(not(target_os = "l4re"))]
2122            // FIXME(1.0,deprecate): lfs binding to be removed
2123            pub fn fstatat64(
2124                dirfd: c_int,
2125                pathname: *const c_char,
2126                buf: *mut stat64,
2127                flags: c_int,
2128            ) -> c_int;
2129            // FIXME(1.0,deprecate): lfs binding to be removed
2130            #[cfg_attr(
2131                all(target_os = "l4re", target_pointer_width = "64"),
2132                allow(deprecated)
2133            )]
2134            pub fn ftruncate64(fd: c_int, length: off64_t) -> c_int;
2135            // FIXME(1.0,deprecate): lfs binding to be removed
2136            #[cfg_attr(
2137                all(target_os = "l4re", target_pointer_width = "64"),
2138                allow(deprecated)
2139            )]
2140            pub fn lseek64(fd: c_int, offset: off64_t, whence: c_int) -> off64_t;
2141            #[cfg_attr(gnu_time_bits64, link_name = "__lstat64_time64")]
2142            #[cfg(not(target_os = "l4re"))]
2143            // FIXME(1.0,deprecate): lfs binding to be removed
2144            pub fn lstat64(path: *const c_char, buf: *mut stat64) -> c_int;
2145            // FIXME(1.0,deprecate): lfs binding to be removed
2146            #[cfg_attr(
2147                all(target_os = "l4re", target_pointer_width = "64"),
2148                allow(deprecated)
2149            )]
2150            pub fn mmap64(
2151                addr: *mut c_void,
2152                len: size_t,
2153                prot: c_int,
2154                flags: c_int,
2155                fd: c_int,
2156                offset: off64_t,
2157            ) -> *mut c_void;
2158            // FIXME(1.0,deprecate): lfs binding to be removed
2159            pub fn open64(path: *const c_char, oflag: c_int, ...) -> c_int;
2160            // FIXME(1.0,deprecate): lfs binding to be removed
2161            pub fn openat64(fd: c_int, path: *const c_char, oflag: c_int, ...) -> c_int;
2162            // FIXME(1.0,deprecate): lfs binding to be removed
2163            #[cfg_attr(
2164                all(target_os = "l4re", target_pointer_width = "64"),
2165                allow(deprecated)
2166            )]
2167            pub fn posix_fadvise64(
2168                fd: c_int,
2169                offset: off64_t,
2170                len: off64_t,
2171                advise: c_int,
2172            ) -> c_int;
2173            // FIXME(1.0,deprecate): lfs binding to be removed
2174            #[cfg_attr(
2175                all(target_os = "l4re", target_pointer_width = "64"),
2176                allow(deprecated)
2177            )]
2178            pub fn pread64(fd: c_int, buf: *mut c_void, count: size_t, offset: off64_t) -> ssize_t;
2179            // FIXME(1.0,deprecate): lfs binding to be removed
2180            #[cfg_attr(
2181                all(target_os = "l4re", target_pointer_width = "64"),
2182                allow(deprecated)
2183            )]
2184            pub fn pwrite64(
2185                fd: c_int,
2186                buf: *const c_void,
2187                count: size_t,
2188                offset: off64_t,
2189            ) -> ssize_t;
2190            // FIXME(1.0,deprecate): lfs binding to be removed
2191            pub fn readdir64(dirp: *mut crate::DIR) -> *mut crate::dirent64;
2192            // FIXME(1.0,deprecate): lfs binding to be removed
2193            pub fn readdir64_r(
2194                dirp: *mut crate::DIR,
2195                entry: *mut crate::dirent64,
2196                result: *mut *mut crate::dirent64,
2197            ) -> c_int;
2198            #[cfg_attr(gnu_time_bits64, link_name = "__stat64_time64")]
2199            #[cfg(not(target_os = "l4re"))]
2200            // FIXME(1.0,deprecate): lfs binding to be removed
2201            pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int;
2202            // FIXME(1.0,deprecate): lfs binding to be removed
2203            #[cfg_attr(
2204                all(target_os = "l4re", target_pointer_width = "64"),
2205                allow(deprecated)
2206            )]
2207            pub fn truncate64(path: *const c_char, length: off64_t) -> c_int;
2208        }
2209    }
2210}
2211
2212cfg_if! {
2213    if #[cfg(not(any(
2214        target_env = "uclibc",
2215        target_env = "musl",
2216        target_env = "ohos",
2217        target_os = "emscripten",
2218    )))] {
2219        extern "C" {
2220            // FIXME(1.0,deprecate): lfs binding to be removed
2221            pub fn preadv64(
2222                fd: c_int,
2223                iov: *const crate::iovec,
2224                iovcnt: c_int,
2225                offset: off64_t,
2226            ) -> ssize_t;
2227            // FIXME(1.0,deprecate): lfs binding to be removed
2228            pub fn pwritev64(
2229                fd: c_int,
2230                iov: *const crate::iovec,
2231                iovcnt: c_int,
2232                offset: off64_t,
2233            ) -> ssize_t;
2234        }
2235    }
2236}
2237
2238cfg_if! {
2239    if #[cfg(not(target_env = "uclibc"))] {
2240        extern "C" {
2241            // uclibc has separate non-const version of this function
2242            pub fn forkpty(
2243                amaster: *mut c_int,
2244                name: *mut c_char,
2245                termp: *const termios,
2246                winp: *const crate::winsize,
2247            ) -> crate::pid_t;
2248            // uclibc has separate non-const version of this function
2249            pub fn openpty(
2250                amaster: *mut c_int,
2251                aslave: *mut c_int,
2252                name: *mut c_char,
2253                termp: *const termios,
2254                winp: *const crate::winsize,
2255            ) -> c_int;
2256        }
2257    }
2258}
2259
2260// The statx syscall, available on some libcs.
2261cfg_if! {
2262    if #[cfg(any(
2263        target_env = "gnu",
2264        target_env = "musl",
2265        target_os = "android",
2266    ))] {
2267        extern "C" {
2268            pub fn statx(
2269                dirfd: c_int,
2270                pathname: *const c_char,
2271                flags: c_int,
2272                mask: c_uint,
2273                statxbuf: *mut statx,
2274            ) -> c_int;
2275        }
2276    }
2277}
2278
2279cfg_if! {
2280    if #[cfg(target_os = "emscripten")] {
2281        mod emscripten;
2282        pub use self::emscripten::*;
2283    } else if #[cfg(target_os = "linux")] {
2284        mod linux;
2285        pub use self::linux::*;
2286        mod linux_l4re_shared;
2287        pub use self::linux_l4re_shared::*;
2288    } else if #[cfg(target_os = "l4re")] {
2289        mod l4re;
2290        pub use self::l4re::*;
2291        mod linux_l4re_shared;
2292        pub use self::linux_l4re_shared::*;
2293    } else if #[cfg(target_os = "android")] {
2294        mod android;
2295        pub use self::android::*;
2296    } else {
2297        // Unknown target_os
2298    }
2299}