diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 703b9d7868a3..ee606ff19cfa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -44,8 +44,20 @@ jobs: - uses: actions/checkout@v4 - name: Setup Rust toolchain run: ./ci/install-rust.sh + + # FIXME(ci): These `du` statements are temporary for debugging cache + - name: Target size before restoring cache + run: du -sh target | sort -k 2 || true + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }}-${{ matrix.toolchain }} + - name: Target size after restoring cache + run: du -sh target | sort -k 2 || true + - name: Execute build.sh run: ./ci/verify-build.sh + - name: Target size after job completion + run: du -sh target | sort -k 2 test_tier1: name: Test tier1 @@ -82,6 +94,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Rust toolchain run: ./ci/install-rust.sh + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} - name: Run natively if: "!matrix.docker" run: ./ci/run.sh ${{ matrix.target }} @@ -133,6 +148,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Rust toolchain run: ./ci/install-rust.sh + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.target }} - name: Execute run-docker.sh run: ./ci/run-docker.sh ${{ matrix.target }} diff --git a/ci/verify-build.sh b/ci/verify-build.sh index 97d6bba4f822..e61fc69188c5 100755 --- a/ci/verify-build.sh +++ b/ci/verify-build.sh @@ -28,10 +28,16 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then rustup component add rust-src fi +# Print GHA workflow commands +echo_if_ci() { + # Discard stderr so the "set -x" trace doesn't show up + { [ -n "${CI:-}" ] && echo "$1"; } 2> /dev/null +} + # Run the tests for a specific target test_target() { - target="${1}" - no_dist="${2:-0}" + target="$1" + no_dist="$2" RUSTFLAGS="${RUSTFLAGS:-}" @@ -269,7 +275,13 @@ case "$rust" in *) supports_wasi_pn=0 ;; esac -for target in $targets; do +some_tests_run=0 + +# Apply the `FILTER` variable, do OS-specific tasks, and run a target +filter_and_run() { + target="$1" + no_dist="${2:-0}" + if echo "$target" | grep -q "$filter"; then if [ "$os" = "windows" ]; then TARGET="$target" ./ci/install-rust.sh @@ -282,27 +294,28 @@ for target in $targets; do # `wasm32-wasip2` only exists in recent versions of Rust if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then - continue + return fi - test_target "$target" - test_run=1 + test_target "$target" "$no_dist" + some_tests_run=1 fi +} + +for target in $targets; do + echo_if_ci "::group::Target: $target" + filter_and_run "$target" + echo_if_ci "::endgroup::" done for target in ${no_dist_targets:-}; do - if echo "$target" | grep -q "$filter"; then - if [ "$os" = "windows" ]; then - TARGET="$target" ./ci/install-rust.sh - fi - - test_target "$target" 1 - test_run=1 - fi + echo_if_ci "::group::Target: $target" + filter_and_run "$target" 1 + echo_if_ci "::endgroup::" done # Make sure we didn't accidentally filter everything -if [ "${test_run:-}" != 1 ]; then +if [ "$some_tests_run" != 1 ]; then echo "No tests were run" exit 1 fi diff --git a/libc-test/build.rs b/libc-test/build.rs index 66548cea19b0..1af2c40afdf1 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -42,6 +42,8 @@ fn do_cc() { || target.contains("l4re") || target.contains("android") || target.contains("emscripten") + || target.contains("solaris") + || target.contains("illumos") { cc::Build::new().file("src/sigrt.c").compile("sigrt"); } @@ -2060,9 +2062,9 @@ fn test_android(target: &str) { | "PF_IO_WORKER" | "PF_WQ_WORKER" | "PF_FORKNOEXEC" + | "PF_MCE_PROCESS" | "PF_SUPERPRIV" | "PF_DUMPCORE" - | "PF_MCE_PROCESS" | "PF_SIGNALED" | "PF_MEMALLOC" | "PF_NPROC_EXCEEDED" @@ -2078,6 +2080,7 @@ fn test_android(target: &str) { | "PF_NO_SETAFFINITY" | "PF_MCE_EARLY" | "PF_MEMALLOC_PIN" + | "PF_BLOCK_TS" | "PF_SUSPEND_TASK" => true, _ => false, @@ -2649,6 +2652,11 @@ fn test_freebsd(target: &str) { // Added in FreeBSD 14.0 "TCP_FUNCTION_ALIAS" if Some(14) > freebsd_ver => true, + // These constants may change or disappear in future OS releases, and they probably + // have no legitimate use in applications anyway. + "CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57" | + "CAP_ALL0" | "CAP_ALL1" => true, + _ => false, } }); @@ -4308,12 +4316,17 @@ fn test_linux(target: &str) { | "PF_RANDOMIZE" | "PF_NO_SETAFFINITY" | "PF_MCE_EARLY" - | "PF_MEMALLOC_PIN" => true, + | "PF_MEMALLOC_PIN" + | "PF_BLOCK_TS" + | "PF_SUSPEND_TASK" => true, // FIXME: Requires >= 6.9 kernel headers. "EPIOCSPARAMS" | "EPIOCGPARAMS" => true, + // FIXME: Requires >= 6.11 kernel headers. + "MAP_DROPPABLE" => true, + _ => false, } }); diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 83dd825584cd..2aed5d7628ea 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -78,12 +78,6 @@ HUGETLB_FLAG_ENCODE_64KB HUGETLB_FLAG_ENCODE_8MB HUGETLB_FLAG_ENCODE_MASK HUGETLB_FLAG_ENCODE_SHIFT -IFA_FLAGS -IFA_F_MANAGETEMPADDR -IFA_F_MCAUTOJOIN -IFA_F_NODAD -IFA_F_NOPREFIXROUTE -IFA_F_STABLE_PRIVACY INIT_PROCESS ISOFS_SUPER_MAGIC JFFS2_SUPER_MAGIC @@ -656,6 +650,7 @@ malloc_stats malloc_trim malloc_usable_size mallopt +mempcpy mq_notify nl_mmap_hdr nl_mmap_req diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index af9e03cfdf91..175e2811e964 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -923,12 +923,18 @@ IFA_ADDRESS IFA_ANYCAST IFA_BROADCAST IFA_CACHEINFO +IFA_FLAGS IFA_F_DADFAILED IFA_F_DEPRECATED IFA_F_HOMEADDRESS +IFA_F_MANAGETEMPADDR +IFA_F_MCAUTOJOIN +IFA_F_NODAD +IFA_F_NOPREFIXROUTE IFA_F_OPTIMISTIC IFA_F_PERMANENT IFA_F_SECONDARY +IFA_F_STABLE_PRIVACY IFA_F_TEMPORARY IFA_F_TENTATIVE IFA_LABEL @@ -1586,6 +1592,7 @@ MADV_UNMERGEABLE MADV_WILLNEED MADV_WIPEONFORK MAP_DENYWRITE +MAP_DROPPABLE MAP_EXECUTABLE MAP_FILE MAP_FIXED_NOREPLACE @@ -2084,40 +2091,67 @@ PF_ASH PF_ATMPVC PF_ATMSVC PF_AX25 +PF_BLOCK_TS PF_BLUETOOTH PF_BRIDGE PF_CAIF PF_CAN PF_DECnet +PF_DUMPCORE PF_ECONET +PF_EXITING +PF_FORKNOEXEC +PF_IDLE PF_IEEE802154 +PF_IO_WORKER PF_IPX PF_IRDA PF_ISDN PF_IUCV PF_KEY +PF_KSWAPD +PF_KTHREAD PF_LLC PF_LOCAL +PF_LOCAL_THROTTLE PF_MASKOS PF_MASKPROC +PF_MCE_EARLY +PF_MCE_PROCESS +PF_MEMALLOC +PF_MEMALLOC_NOFS +PF_MEMALLOC_NOIO +PF_MEMALLOC_PIN PF_NETBEUI PF_NETLINK PF_NETROM PF_NFC +PF_NOFREEZE +PF_NO_SETAFFINITY +PF_NPROC_EXCEEDED PF_PACKET PF_PHONET +PF_POSTCOREDUMP PF_PPPOX PF_R +PF_RANDOMIZE PF_RDS PF_ROSE PF_ROUTE PF_RXRPC PF_SECURITY +PF_SIGNALED PF_SNA +PF_SUPERPRIV +PF_SUSPEND_TASK PF_TIPC +PF_USED_MATH +PF_USER_WORKER +PF_VCPU PF_VSOCK PF_W PF_WANPIPE +PF_WQ_WORKER PF_X PF_X25 PIPE_BUF diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index 9d0ae3ac18b5..f6bb5be4e5ac 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -16,6 +16,8 @@ LIO_WAIT LIO_WRITE PIPE_BUF SIGEV_PORT +SIGRTMAX +SIGRTMIN _POSIX_VDISABLE _ST_FSTYPSZ aio_cancel diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 093dde173137..052c24178dfc 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -638,6 +638,7 @@ localtime_r lseek lstat malloc +memccpy memchr memcmp memcpy diff --git a/libc-test/test/sigrt.rs b/libc-test/test/sigrt.rs index 25e6ca4457b1..1f89ce042186 100644 --- a/libc-test/test/sigrt.rs +++ b/libc-test/test/sigrt.rs @@ -4,7 +4,9 @@ target_os = "linux", target_os = "l4re", target_os = "android", - target_os = "emscripten" + target_os = "emscripten", + target_os = "solaris", + target_os = "illumos", ))] mod t { use libc; diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 82a0676bfbea..71b88f579a39 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -1340,6 +1340,8 @@ cfg_if! { } } + // FIXME(msrv): suggested method was added in 1.85 + #[allow(unpredictable_function_pointer_comparisons)] impl PartialEq for sigevent { fn eq(&self, other: &sigevent) -> bool { self.sigev_value == other.sigev_value diff --git a/src/macros.rs b/src/macros.rs index 3bfac90518ad..b4db0fd469da 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -159,6 +159,13 @@ macro_rules! s_no_extra_traits { $(#[$attr])* pub union $i { $($field)* } } + + #[cfg(feature = "extra_traits")] + impl ::core::fmt::Debug for $i { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct(::core::stringify!($i)).finish_non_exhaustive() + } + } ); (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index bd087ea334dd..6e98709dc546 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -575,14 +575,6 @@ cfg_if! { } } impl Eq for __sigaction_sa_union {} - impl fmt::Debug for __sigaction_sa_union { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("__sigaction_sa_union") - .field("__su_handler", unsafe { &self.__su_handler }) - .field("__su_sigaction", unsafe { &self.__su_sigaction }) - .finish() - } - } impl hash::Hash for __sigaction_sa_union { fn hash(&self, state: &mut H) { unsafe { @@ -627,15 +619,6 @@ cfg_if! { } } impl Eq for __poll_ctl_ext_u {} - impl fmt::Debug for __poll_ctl_ext_u { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("__poll_ctl_ext_u") - .field("addr", unsafe { &self.addr }) - .field("data32", unsafe { &self.data32 }) - .field("data", unsafe { &self.data }) - .finish() - } - } impl hash::Hash for __poll_ctl_ext_u { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index e9f5b1e1cf3a..921774611e29 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -356,14 +356,6 @@ cfg_if! { } } impl Eq for _kernel_simple_lock {} - impl fmt::Debug for _kernel_simple_lock { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("_kernel_simple_lock") - .field("_slock", unsafe { &self._slock }) - .field("_slockp", unsafe { &self._slockp }) - .finish() - } - } impl hash::Hash for _kernel_simple_lock { fn hash(&self, state: &mut H) { unsafe { @@ -475,15 +467,6 @@ cfg_if! { } } impl Eq for __ld_info_file {} - impl fmt::Debug for __ld_info_file { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("__ld_info_file") - .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) - .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) - .field("_core_offset", unsafe { &self._core_offset }) - .finish() - } - } impl hash::Hash for __ld_info_file { fn hash(&self, state: &mut H) { unsafe { @@ -544,15 +527,6 @@ cfg_if! { } } impl Eq for __pollfd_ext_u {} - impl fmt::Debug for __pollfd_ext_u { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("__pollfd_ext_u") - .field("addr", unsafe { &self.addr }) - .field("data32", unsafe { &self.data32 }) - .field("data", unsafe { &self.data }) - .finish() - } - } impl hash::Hash for __pollfd_ext_u { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 89c0e3197a9d..943d9e400ecc 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1718,13 +1718,6 @@ cfg_if! { } } impl Eq for semun {} - impl fmt::Debug for semun { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("semun") - .field("val", unsafe { &self.val }) - .finish() - } - } impl hash::Hash for semun { fn hash(&self, state: &mut H) { unsafe { self.val.hash(state) }; @@ -3073,15 +3066,6 @@ cfg_if! { } impl Eq for __c_anonymous_ifk_data {} - - impl fmt::Debug for __c_anonymous_ifk_data { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifk_data") - .field("ifk_ptr", unsafe { &self.ifk_ptr }) - .field("ifk_value", unsafe { &self.ifk_value }) - .finish() - } - } impl hash::Hash for __c_anonymous_ifk_data { fn hash(&self, state: &mut H) { unsafe { @@ -3144,31 +3128,6 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru {} - impl fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_metrics", unsafe { &self.ifru_metrics }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_phys", unsafe { &self.ifru_phys }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_intval", unsafe { &self.ifru_intval }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_devmtu", unsafe { &self.ifru_devmtu }) - .field("ifru_kpi", unsafe { &self.ifru_kpi }) - .field("ifru_wake_flags", unsafe { &self.ifru_wake_flags }) - .field("ifru_route_refcnt", unsafe { &self.ifru_route_refcnt }) - .field("ifru_cap", unsafe { &self.ifru_cap }) - .field("ifru_functional_type", unsafe { - &self.ifru_functional_type - }) - .finish() - } - } - impl hash::Hash for __c_anonymous_ifr_ifru { fn hash(&self, state: &mut H) { unsafe { @@ -3224,15 +3183,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifc_ifcu") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - impl hash::Hash for __c_anonymous_ifc_ifcu { fn hash(&self, state: &mut H) { unsafe { self.ifcu_buf.hash(state) }; @@ -3261,21 +3211,6 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru6 {} - impl fmt::Debug for __c_anonymous_ifr_ifru6 { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifr_ifru6") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_flags6", unsafe { &self.ifru_flags6 }) - .field("ifru_metrics", unsafe { &self.ifru_metrics }) - .field("ifru_intval", unsafe { &self.ifru_intval }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_scope_id", unsafe { &self.ifru_scope_id }) - .finish() - } - } - impl hash::Hash for __c_anonymous_ifr_ifru6 { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index fdaf2d46d35c..72e5e7fdae55 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1698,13 +1698,6 @@ cfg_if! { } } impl Eq for __c_anonymous_cr_pid {} - impl fmt::Debug for __c_anonymous_cr_pid { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("cr_pid") - .field("cr_pid", unsafe { &self.cr_pid }) - .finish() - } - } impl hash::Hash for __c_anonymous_cr_pid { fn hash(&self, state: &mut H) { unsafe { self.cr_pid.hash(state) }; @@ -1876,13 +1869,6 @@ cfg_if! { } } impl Eq for __c_anonymous_elf32_auxv_union {} - impl fmt::Debug for __c_anonymous_elf32_auxv_union { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("a_val") - .field("a_val", unsafe { &self.a_val }) - .finish() - } - } impl PartialEq for Elf32_Auxinfo { fn eq(&self, other: &Elf32_Auxinfo) -> bool { self.a_type == other.a_type && self.a_un == other.a_un @@ -1920,27 +1906,6 @@ cfg_if! { } } impl Eq for __c_anonymous_ifr_ifru {} - impl fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_buffer", unsafe { &self.ifru_buffer }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_index", unsafe { &self.ifru_index }) - .field("ifru_jid", unsafe { &self.ifru_jid }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_phys", unsafe { &self.ifru_phys }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_cap", unsafe { &self.ifru_cap }) - .field("ifru_fib", unsafe { &self.ifru_fib }) - .field("ifru_vlan_pcp", unsafe { &self.ifru_vlan_pcp }) - .finish() - } - } impl hash::Hash for __c_anonymous_ifr_ifru { fn hash(&self, state: &mut H) { unsafe { self.ifru_addr.hash(state) }; @@ -1990,15 +1955,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifc_ifcu") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } - impl hash::Hash for __c_anonymous_ifc_ifcu { fn hash(&self, state: &mut H) { unsafe { self.ifcu_buf.hash(state) }; @@ -2107,14 +2063,6 @@ cfg_if! { } } impl Eq for __c_anonymous_ifi_epoch {} - impl fmt::Debug for __c_anonymous_ifi_epoch { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifi_epoch") - .field("tt", unsafe { &self.tt }) - .field("ph", unsafe { &self.ph }) - .finish() - } - } impl hash::Hash for __c_anonymous_ifi_epoch { fn hash(&self, state: &mut H) { unsafe { @@ -2130,14 +2078,6 @@ cfg_if! { } } impl Eq for __c_anonymous_ifi_lastchange {} - impl fmt::Debug for __c_anonymous_ifi_lastchange { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifi_lastchange") - .field("tv", unsafe { &self.tv }) - .field("ph", unsafe { &self.ph }) - .finish() - } - } impl hash::Hash for __c_anonymous_ifi_lastchange { fn hash(&self, state: &mut H) { unsafe { @@ -2711,8 +2651,11 @@ pub const CAP_SOCK_SERVER: u64 = CAP_ACCEPT | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN; +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_ALL0: u64 = cap_right!(0, 0x000007FFFFFFFFFFu64); +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_UNUSED0_44: u64 = cap_right!(0, 0x0000080000000000u64); +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_UNUSED0_57: u64 = cap_right!(0, 0x0100000000000000u64); pub const CAP_MAC_GET: u64 = cap_right!(1, 0x0000000000000001u64); pub const CAP_MAC_SET: u64 = cap_right!(1, 0x0000000000000002u64); @@ -2736,8 +2679,11 @@ pub const CAP_ACL_GET: u64 = cap_right!(1, 0x0000000000040000u64); pub const CAP_ACL_SET: u64 = cap_right!(1, 0x0000000000080000u64); pub const CAP_KQUEUE_CHANGE: u64 = cap_right!(1, 0x0000000000100000u64); pub const CAP_KQUEUE: u64 = CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE; +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_ALL1: u64 = cap_right!(1, 0x00000000001FFFFFu64); +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_UNUSED1_22: u64 = cap_right!(1, 0x0000000000200000u64); +#[deprecated(since = "0.2.165", note = "Not stable across OS versions")] pub const CAP_UNUSED1_57: u64 = cap_right!(1, 0x0100000000000000u64); pub const CAP_FCNTL_GETFL: u32 = 1 << 3; pub const CAP_FCNTL_SETFL: u32 = 1 << 4; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index b3ed7684154a..fca9a126f81c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -238,6 +238,8 @@ cfg_if! { } } + // FIXME(msrv): suggested method was added in 1.85 + #[allow(unpredictable_function_pointer_comparisons)] impl PartialEq for __c_anonymous_elf64_auxv_union { fn eq(&self, other: &__c_anonymous_elf64_auxv_union) -> bool { unsafe { @@ -248,13 +250,6 @@ cfg_if! { } } impl Eq for __c_anonymous_elf64_auxv_union {} - impl fmt::Debug for __c_anonymous_elf64_auxv_union { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("a_val") - .field("a_val", unsafe { &self.a_val }) - .finish() - } - } impl PartialEq for Elf64_Auxinfo { fn eq(&self, other: &Elf64_Auxinfo) -> bool { self.a_type == other.a_type && self.a_un == other.a_un diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index 8ed84021e895..2391801fe458 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -54,19 +54,6 @@ cfg_if! { } } impl Eq for __c_anonymous__freg {} - impl fmt::Debug for __c_anonymous__freg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__c_anonymous__freg") - .field("__b8", &self.__b8) - .field("__h16", &self.__h16) - .field("__s32", &self.__s32) - .field("__d64", &self.__d64) - .field("__q128", &self.__q128) - .finish() - } - } - } impl hash::Hash for __c_anonymous__freg { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 9af0efc40f97..8e3507fc743a 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1340,17 +1340,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_posix_spawn_fae { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_posix_fae") - .field("open", &self.open) - .field("dup2", &self.dup2) - .finish() - } - } - } - impl hash::Hash for __c_anonymous_posix_spawn_fae { fn hash(&self, state: &mut H) { unsafe { @@ -1368,17 +1357,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_ifc_ifcu") - .field("ifcu_buf", &self.ifcu_buf) - .field("ifcu_req", &self.ifcu_req) - .finish() - } - } - } - impl hash::Hash for __c_anonymous_ifc_ifcu { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs index b5e72084d5aa..68cd264aadb7 100644 --- a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -19,7 +19,6 @@ s! { } s_no_extra_traits! { - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub union __fpreg { pub u_u64: u64, pub u_d: c_double, diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 515b3ba9d05f..f86919264c0a 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -944,14 +944,6 @@ cfg_if! { impl Eq for mount_info {} - impl fmt::Debug for mount_info { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("mount_info") - // FIXME: .field("align", &self.align) - .finish() - } - } - impl hash::Hash for mount_info { fn hash(&self, state: &mut H) { unsafe { self.align.hash(state) }; @@ -976,22 +968,6 @@ cfg_if! { impl Eq for __c_anonymous_ifr_ifru {} - impl fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_vnetid", unsafe { &self.ifru_vnetid }) - .field("ifru_media", unsafe { &self.ifru_media }) - .field("ifru_data", unsafe { &self.ifru_data }) - .field("ifru_index", unsafe { &self.ifru_index }) - .finish() - } - } - impl hash::Hash for __c_anonymous_ifr_ifru { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 84ca0e146294..d373a9ced086 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -501,20 +501,6 @@ cfg_if! { } } impl Eq for cpuid_info {} - impl fmt::Debug for cpuid_info { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("cpuid_info") - .field("eax_0", &self.eax_0) - .field("eax_1", &self.eax_1) - .field("eax_2", &self.eax_2) - .field("eax_3", &self.eax_3) - .field("as_chars", &self.as_chars) - .field("regs", &self.regs) - .finish() - } - } - } impl PartialEq for __c_anonymous_cpu_topology_info_data { fn eq(&self, other: &__c_anonymous_cpu_topology_info_data) -> bool { @@ -526,17 +512,6 @@ cfg_if! { } } impl Eq for __c_anonymous_cpu_topology_info_data {} - impl fmt::Debug for __c_anonymous_cpu_topology_info_data { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_cpu_topology_info_data") - .field("root", &self.root) - .field("package", &self.package) - .field("core", &self.core) - .finish() - } - } - } impl PartialEq for cpu_topology_node_info { fn eq(&self, other: &cpu_topology_node_info) -> bool { diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index 8a3b02dcc402..0bf4087fde75 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -87,13 +87,6 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } impl hash::Hash for __c_anonymous_uc_sigmask { fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index 8421f389ed9c..9f80d8a71f44 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -89,13 +89,6 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } impl hash::Hash for __c_anonymous_uc_sigmask { fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 2118b926af9c..4da5cd499567 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -128,13 +128,6 @@ cfg_if! { } } impl Eq for __c_anonymous_uc_sigmask {} - impl fmt::Debug for __c_anonymous_uc_sigmask { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("uc_sigmask") - .field("uc_sigmask", unsafe { &self.uc_sigmask }) - .finish() - } - } impl hash::Hash for __c_anonymous_uc_sigmask { fn hash(&self, state: &mut H) { unsafe { self.uc_sigmask.hash(state) } diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 8f477be82c94..f408969175d3 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -994,25 +994,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_netmask", unsafe { &self.ifru_netmask }) - .field("ifru_hwaddr", unsafe { &self.ifru_hwaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_ifindex", unsafe { &self.ifru_ifindex }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_map", unsafe { &self.ifru_map }) - .field("ifru_slave", unsafe { &self.ifru_slave }) - .field("ifru_newname", unsafe { &self.ifru_newname }) - .field("ifru_data", unsafe { &self.ifru_data }) - .finish() - } - } impl fmt::Debug for ifreq { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") @@ -1022,14 +1003,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } impl fmt::Debug for ifconf { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifconf") diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index 4ab40c628a1e..43547cc7ad86 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -212,7 +212,6 @@ s_no_extra_traits! { pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index 6eaa3cda10fc..db8deafe896b 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -264,7 +264,6 @@ s_no_extra_traits! { pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 948ec35f36b0..75ac2e088f7d 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1035,14 +1035,6 @@ pub const NDA_SRC_VNI: c_ushort = 11; pub const UNAME26: c_int = 0x0020000; pub const FDPIC_FUNCPTRS: c_int = 0x0080000; -// linux/if_addr.h -pub const IFA_FLAGS: c_ushort = 8; - -pub const IFA_F_MANAGETEMPADDR: u32 = 0x100; -pub const IFA_F_NOPREFIXROUTE: u32 = 0x200; -pub const IFA_F_MCAUTOJOIN: u32 = 0x400; -pub const IFA_F_STABLE_PRIVACY: u32 = 0x800; - pub const MAX_LINKS: c_int = 32; pub const GENL_UNS_ADMIN_PERM: c_int = 0x10; @@ -1547,6 +1539,8 @@ extern "C" { timeout: *const crate::timespec, sigmask: *const crate::sigset_t, ) -> c_int; + + pub fn mempcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; } cfg_if! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index b94264154271..7321d37a684c 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1669,13 +1669,11 @@ s_no_extra_traits! { } // linux/ptp_clock.h - #[allow(missing_debug_implementations)] pub union __c_anonymous_ptp_perout_request_1 { pub start: ptp_clock_time, pub phase: ptp_clock_time, } - #[allow(missing_debug_implementations)] pub union __c_anonymous_ptp_perout_request_2 { pub on: ptp_clock_time, pub rsv: [c_uint; 4], @@ -1697,7 +1695,6 @@ s_no_extra_traits! { pub xsk_tx_metadata_union: __c_anonymous_xsk_tx_metadata_union, } - #[allow(missing_debug_implementations)] pub union __c_anonymous_xsk_tx_metadata_union { pub request: xsk_tx_metadata_request, pub completion: xsk_tx_metadata_completion, @@ -2063,25 +2060,6 @@ cfg_if! { self.mq_curmsgs.hash(state); } } - impl fmt::Debug for __c_anonymous_ifr_ifru { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifru_addr", unsafe { &self.ifru_addr }) - .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) - .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) - .field("ifru_netmask", unsafe { &self.ifru_netmask }) - .field("ifru_hwaddr", unsafe { &self.ifru_hwaddr }) - .field("ifru_flags", unsafe { &self.ifru_flags }) - .field("ifru_ifindex", unsafe { &self.ifru_ifindex }) - .field("ifru_metric", unsafe { &self.ifru_metric }) - .field("ifru_mtu", unsafe { &self.ifru_mtu }) - .field("ifru_map", unsafe { &self.ifru_map }) - .field("ifru_slave", unsafe { &self.ifru_slave }) - .field("ifru_newname", unsafe { &self.ifru_newname }) - .field("ifru_data", unsafe { &self.ifru_data }) - .finish() - } - } impl fmt::Debug for ifreq { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifreq") @@ -2090,15 +2068,6 @@ cfg_if! { .finish() } } - - impl fmt::Debug for __c_anonymous_ifc_ifcu { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("ifr_ifru") - .field("ifcu_buf", unsafe { &self.ifcu_buf }) - .field("ifcu_req", unsafe { &self.ifcu_req }) - .finish() - } - } impl fmt::Debug for ifconf { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("ifconf") @@ -2172,31 +2141,6 @@ cfg_if! { } } - impl fmt::Debug for iwreq_data { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("iwreq_data") - .field("name", unsafe { &self.name }) - .field("essid", unsafe { &self.essid }) - .field("nwid", unsafe { &self.nwid }) - .field("freq", unsafe { &self.freq }) - .field("sens", unsafe { &self.sens }) - .field("bitrate", unsafe { &self.bitrate }) - .field("txpower", unsafe { &self.txpower }) - .field("rts", unsafe { &self.rts }) - .field("frag", unsafe { &self.frag }) - .field("mode", unsafe { &self.mode }) - .field("retry", unsafe { &self.retry }) - .field("encoding", unsafe { &self.encoding }) - .field("power", unsafe { &self.power }) - .field("qual", unsafe { &self.qual }) - .field("ap_addr", unsafe { &self.ap_addr }) - .field("addr", unsafe { &self.addr }) - .field("param", unsafe { &self.param }) - .field("data", unsafe { &self.data }) - .finish() - } - } - impl fmt::Debug for iw_event { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("iw_event") @@ -2207,14 +2151,6 @@ cfg_if! { } } - impl fmt::Debug for __c_anonymous_iwreq { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("__c_anonymous_iwreq") - .field("ifrn_name", unsafe { &self.ifrn_name }) - .finish() - } - } - impl fmt::Debug for iwreq { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("iwreq") @@ -2768,6 +2704,7 @@ pub const IFA_BROADCAST: c_ushort = 4; pub const IFA_ANYCAST: c_ushort = 5; pub const IFA_CACHEINFO: c_ushort = 6; pub const IFA_MULTICAST: c_ushort = 7; +pub const IFA_FLAGS: c_ushort = 8; pub const IFA_F_SECONDARY: u32 = 0x01; pub const IFA_F_TEMPORARY: u32 = 0x01; @@ -2778,6 +2715,10 @@ pub const IFA_F_HOMEADDRESS: u32 = 0x10; pub const IFA_F_DEPRECATED: u32 = 0x20; pub const IFA_F_TENTATIVE: u32 = 0x40; pub const IFA_F_PERMANENT: u32 = 0x80; +pub const IFA_F_MANAGETEMPADDR: u32 = 0x100; +pub const IFA_F_NOPREFIXROUTE: u32 = 0x200; +pub const IFA_F_MCAUTOJOIN: u32 = 0x400; +pub const IFA_F_STABLE_PRIVACY: u32 = 0x800; // linux/if_link.h pub const IFLA_UNSPEC: c_ushort = 0; @@ -4730,6 +4671,7 @@ pub const UDP_NO_CHECK6_RX: c_int = 102; // include/uapi/linux/mman.h pub const MAP_SHARED_VALIDATE: c_int = 0x3; +pub const MAP_DROPPABLE: c_int = 0x8; // include/uapi/asm-generic/mman-common.h pub const MAP_FIXED_NOREPLACE: c_int = 0x100000; @@ -5630,31 +5572,75 @@ pub const NET_DCCP: c_int = 20; pub const NET_IRDA: c_int = 412; // include/linux/sched.h +/// I'm a virtual CPU. pub const PF_VCPU: c_int = 0x00000001; +/// I am an IDLE thread. pub const PF_IDLE: c_int = 0x00000002; +/// Getting shut down. pub const PF_EXITING: c_int = 0x00000004; +/// Coredumps should ignore this task. pub const PF_POSTCOREDUMP: c_int = 0x00000008; +/// Task is an IO worker. pub const PF_IO_WORKER: c_int = 0x00000010; +/// I'm a workqueue worker. pub const PF_WQ_WORKER: c_int = 0x00000020; +/// Forked but didn't exec. pub const PF_FORKNOEXEC: c_int = 0x00000040; +/// Process policy on mce errors. pub const PF_MCE_PROCESS: c_int = 0x00000080; +/// Used super-user privileges. pub const PF_SUPERPRIV: c_int = 0x00000100; +/// Dumped core. pub const PF_DUMPCORE: c_int = 0x00000200; +/// Killed by a signal. pub const PF_SIGNALED: c_int = 0x00000400; +/// Allocating memory to free memory. +/// +/// See `memalloc_noreclaim_save()`. pub const PF_MEMALLOC: c_int = 0x00000800; +/// `set_user()` noticed that `RLIMIT_NPROC` was exceeded. pub const PF_NPROC_EXCEEDED: c_int = 0x00001000; +/// If unset the fpu must be initialized before use. pub const PF_USED_MATH: c_int = 0x00002000; +/// Kernel thread cloned from userspace thread. pub const PF_USER_WORKER: c_int = 0x00004000; +/// This thread should not be frozen. pub const PF_NOFREEZE: c_int = 0x00008000; +/// I am `kswapd`. pub const PF_KSWAPD: c_int = 0x00020000; +/// All allocations inherit `GFP_NOFS`. +/// +/// See `memalloc_nfs_save()`. pub const PF_MEMALLOC_NOFS: c_int = 0x00040000; +/// All allocations inherit `GFP_NOIO`. +/// +/// See `memalloc_noio_save()`. pub const PF_MEMALLOC_NOIO: c_int = 0x00080000; +/// Throttle writes only against the bdi I write to, I am cleaning +/// dirty pages from some other bdi. pub const PF_LOCAL_THROTTLE: c_int = 0x00100000; +/// I am a kernel thread. pub const PF_KTHREAD: c_int = 0x00200000; +/// Randomize virtual address space. pub const PF_RANDOMIZE: c_int = 0x00400000; +/// Userland is not allowed to meddle with `cpus_mask`. pub const PF_NO_SETAFFINITY: c_int = 0x04000000; +/// Early kill for mce process policy. pub const PF_MCE_EARLY: c_int = 0x08000000; +/// Allocations constrained to zones which allow long term pinning. +/// +/// See `memalloc_pin_save()`. pub const PF_MEMALLOC_PIN: c_int = 0x10000000; +/// Plug has ts that needs updating. +pub const PF_BLOCK_TS: c_int = 0x20000000; +/// This thread called `freeze_processes()` and should not be frozen. +pub const PF_SUSPEND_TASK: c_int = PF_SUSPEND_TASK_UINT as _; +// The used value is the highest possible bit fitting on 32 bits, so directly +// defining it as a signed integer causes the compiler to report an overflow. +// Use instead a private intermediary that assuringly has the correct type and +// cast it where necessary to the wanted final type, which preserves the +// desired information as-is in terms of integer representation. +const PF_SUSPEND_TASK_UINT: c_uint = 0x80000000; pub const CSIGNAL: c_int = 0x000000ff; diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index 729e87366887..ec0ba4c1f926 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -103,7 +103,6 @@ s_no_extra_traits! { pub __fpregs: __riscv_mc_fp_state, } - #[allow(missing_debug_implementations)] pub union __riscv_mc_fp_state { pub __f: __riscv_mc_f_ext_state, pub __d: __riscv_mc_d_ext_state, diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 661405f50eb1..a14dafdf06d9 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -681,6 +681,7 @@ extern "C" { pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void; pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, n: size_t) -> *mut c_void; } extern "C" { diff --git a/src/unix/nto/x86_64.rs b/src/unix/nto/x86_64.rs index 8e938c3bba4f..425f47994946 100644 --- a/src/unix/nto/x86_64.rs +++ b/src/unix/nto/x86_64.rs @@ -101,18 +101,6 @@ cfg_if! { } } - impl fmt::Debug for x86_64_fpu_registers { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("x86_64_fpu_registers") - .field("fsave_area", &self.fsave_area) - .field("fxsave_area", &self.fxsave_area) - .field("xsave_area", &self.xsave_area) - .finish() - } - } - } - impl hash::Hash for x86_64_fpu_registers { fn hash(&self, state: &mut H) { unsafe { diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 4b986e1e9c0c..6f35a1e71284 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -859,16 +859,6 @@ cfg_if! { } } impl Eq for pad128_t {} - impl fmt::Debug for pad128_t { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("pad128_t") - // FIXME: .field("_q", &{self._q}) - .field("_l", &{ self._l }) - .finish() - } - } - } impl hash::Hash for pad128_t { fn hash(&self, state: &mut H) { unsafe { @@ -886,16 +876,6 @@ cfg_if! { } } impl Eq for upad128_t {} - impl fmt::Debug for upad128_t { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("upad128_t") - // FIXME: .field("_q", &{self._q}) - .field("_l", &{ self._l }) - .finish() - } - } - } impl hash::Hash for upad128_t { fn hash(&self, state: &mut H) { unsafe { @@ -2542,6 +2522,14 @@ f! { } safe_f! { + pub fn SIGRTMAX() -> c_int { + unsafe { crate::sysconf(_SC_SIGRT_MAX) as c_int } + } + + pub fn SIGRTMIN() -> c_int { + unsafe { crate::sysconf(_SC_SIGRT_MIN) as c_int } + } + pub {const} fn WIFEXITED(status: c_int) -> bool { (status & 0xFF) == 0 } diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index f4a803175679..d080e6ce8d7f 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -65,7 +65,6 @@ s_no_extra_traits! { pub d_id: crate::door_id_t, } - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub union door_desc_t__d_data { pub d_desc: door_desc_t__d_data__d_desc, d_resv: [c_int; 5], /* Check out /usr/include/sys/door.h */ diff --git a/src/unix/solarish/x86_64.rs b/src/unix/solarish/x86_64.rs index 1ea8ce987dab..4deaac0fc171 100644 --- a/src/unix/solarish/x86_64.rs +++ b/src/unix/solarish/x86_64.rs @@ -110,16 +110,6 @@ cfg_if! { } } impl Eq for __c_anonymous_fp_reg_set {} - impl fmt::Debug for __c_anonymous_fp_reg_set { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - f.debug_struct("__c_anonymous_fp_reg_set") - .field("fpchip_state", &{ self.fpchip_state }) - .field("f_fpregs", &{ self.f_fpregs }) - .finish() - } - } - } impl PartialEq for fpregset_t { fn eq(&self, other: &fpregset_t) -> bool { self.fp_reg_set == other.fp_reg_set diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index f5e582055a5c..b8faf16e9aa1 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -525,18 +525,6 @@ cfg_if! { } } impl Eq for sa_u_t {} - impl fmt::Debug for sa_u_t { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { - let h = match self.sa_handler { - Some(handler) => handler as usize, - None => 0 as usize, - }; - - f.debug_struct("sa_u_t").field("sa_handler", &h).finish() - } - } - } impl hash::Hash for sa_u_t { fn hash(&self, state: &mut H) { unsafe { @@ -555,13 +543,6 @@ cfg_if! { } } impl Eq for sigval {} - impl fmt::Debug for sigval { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_struct("sigval") - .field("sival_ptr", unsafe { &(self.sival_ptr as usize) }) - .finish() - } - } impl hash::Hash for sigval { fn hash(&self, state: &mut H) { unsafe { (self.sival_ptr as usize).hash(state) };