From 1771dc01921b88850d731d641a19239c8ca92cc1 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 25 Jun 2026 02:41:50 -0400 Subject: [PATCH 1/4] Fix instances of overflowing literals Most of these just need a conversion function to assert that wrapping values are okay to assign to signed int types. There are a few corrections: * Android `PR_SET_PTRACER_ANY`: https://cs.android.com/android/platform/superproject/+/android-latest-release:bionic/libc/kernel/uapi/linux/prctl.h;l=101;drc=19d5053f12cafecac5174e4c7af4c9fdfd7bcae0 * Linux `PR_SET_PTRACER_ANY`: https://github.com/torvalds/linux/blob/ab9de95c9cf952332ab79453b4b5d1bfca8e514f/include/uapi/linux/prctl.h#L156 * Haiku `B_INFINITE_TIMEOUT` is a `long long`, this is a type change: https://github.com/haiku/haiku/blob/2b75ca9e1c15526b9ff7613363bb792a28a7f7ac/headers/os/kernel/OS.h#L24 --- src/fuchsia/mod.rs | 8 +- src/hermit.rs | 2 +- src/macros.rs | 7 ++ src/new/linux_uapi/linux/futex.rs | 2 +- src/solid/mod.rs | 4 +- src/types.rs | 34 ++++++ src/unix/aix/mod.rs | 112 +++++++++--------- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 18 +-- .../freebsdlike/freebsd/freebsd12/x86_64.rs | 2 +- .../freebsdlike/freebsd/freebsd13/x86_64.rs | 2 +- .../freebsdlike/freebsd/freebsd14/x86_64.rs | 2 +- .../freebsdlike/freebsd/freebsd15/x86_64.rs | 2 +- src/unix/bsd/freebsdlike/freebsd/mod.rs | 22 ++-- src/unix/bsd/freebsdlike/mod.rs | 2 +- src/unix/bsd/netbsdlike/netbsd/mod.rs | 6 +- src/unix/bsd/netbsdlike/openbsd/mod.rs | 4 +- src/unix/cygwin/mod.rs | 6 +- src/unix/haiku/native.rs | 2 +- src/unix/linux_like/android/b32/mod.rs | 2 +- src/unix/linux_like/android/b64/mod.rs | 2 +- src/unix/linux_like/android/mod.rs | 21 ++-- src/unix/linux_like/emscripten/mod.rs | 2 +- src/unix/linux_like/linux/arch/generic/mod.rs | 12 +- src/unix/linux_like/linux/arch/mips/mod.rs | 20 ++-- src/unix/linux_like/linux/arch/powerpc/mod.rs | 30 ++--- src/unix/linux_like/linux/arch/sparc/mod.rs | 2 +- src/unix/linux_like/linux/gnu/b32/mod.rs | 2 +- .../linux_like/linux/gnu/b64/aarch64/mod.rs | 2 +- .../linux/gnu/b64/loongarch64/mod.rs | 2 +- .../linux_like/linux/gnu/b64/mips64/mod.rs | 2 +- .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 2 +- src/unix/linux_like/linux/gnu/b64/s390x.rs | 2 +- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 2 +- src/unix/linux_like/linux/mod.rs | 20 ++-- src/unix/linux_like/linux/musl/mod.rs | 2 +- src/unix/linux_like/linux_l4re_shared.rs | 3 +- src/unix/linux_like/mod.rs | 20 ++-- src/unix/newlib/mod.rs | 2 +- src/unix/nto/mod.rs | 10 +- src/unix/redox/mod.rs | 7 +- src/unix/solarish/illumos.rs | 2 +- src/unix/solarish/mod.rs | 12 +- src/vxworks/mod.rs | 10 +- src/wasi/mod.rs | 4 +- 45 files changed, 239 insertions(+), 197 deletions(-) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 834d4e9fac2b7..6ee8d89a15ba2 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -1606,7 +1606,7 @@ pub const EPOLLWRBAND: c_int = 0x200; pub const EPOLLMSG: c_int = 0x400; pub const EPOLLERR: c_int = 0x8; pub const EPOLLHUP: c_int = 0x10; -pub const EPOLLET: c_int = 0x80000000; +pub const EPOLLET: c_int = u32_cast_int(0x80000000); pub const EPOLL_CTL_ADD: c_int = 1; pub const EPOLL_CTL_MOD: c_int = 3; @@ -1698,7 +1698,7 @@ pub const CLONE_NEWIPC: c_int = 0x08000000; pub const CLONE_NEWUSER: c_int = 0x10000000; pub const CLONE_NEWPID: c_int = 0x20000000; pub const CLONE_NEWNET: c_int = 0x40000000; -pub const CLONE_IO: c_int = 0x80000000; +pub const CLONE_IO: c_int = u32_cast_int(0x80000000); pub const CLONE_NEWCGROUP: c_int = 0x02000000; pub const WNOHANG: c_int = 0x00000001; @@ -1734,7 +1734,7 @@ pub const PTRACE_EVENT_SECCOMP: c_int = 7; pub const __WNOTHREAD: c_int = 0x20000000; pub const __WALL: c_int = 0x40000000; -pub const __WCLONE: c_int = 0x80000000; +pub const __WCLONE: c_int = u32_cast_int(0x80000000); pub const SPLICE_F_MOVE: c_uint = 0x01; pub const SPLICE_F_NONBLOCK: c_uint = 0x02; @@ -2551,7 +2551,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/hermit.rs b/src/hermit.rs index 2cbf57393104e..04699b1ecbb3d 100644 --- a/src/hermit.rs +++ b/src/hermit.rs @@ -157,7 +157,7 @@ pub const F_SETFL: i32 = 4; pub const FD_CLOEXEC: i32 = 1; -pub const FIONBIO: i32 = 0x8008667e; +pub const FIONBIO: i32 = u32_cast_int(0x8008667e); pub const FUTEX_RELATIVE_TIMEOUT: u32 = 1; diff --git a/src/macros.rs b/src/macros.rs index a74b6f240df85..19bab5f498a54 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -87,6 +87,7 @@ macro_rules! prelude { pub(crate) use core::prelude::v1::derive; #[allow(unused_imports)] pub(crate) use core::{ + assert, cfg, fmt, hash, @@ -105,8 +106,14 @@ macro_rules! prelude { size_of_val, }; + #[allow(unused_imports)] + #[cfg(any(target_os = "linux", target_os = "android", target_os = "l4re"))] + pub(crate) use crate::types::u32_cast_ioctl; #[allow(unused_imports)] pub(crate) use crate::types::{ + u16_cast_short, + u32_cast_int, + u32_cast_long, CEnumRepr, Padding, }; diff --git a/src/new/linux_uapi/linux/futex.rs b/src/new/linux_uapi/linux/futex.rs index 86257f265c855..893dee0e00623 100644 --- a/src/new/linux_uapi/linux/futex.rs +++ b/src/new/linux_uapi/linux/futex.rs @@ -51,7 +51,7 @@ pub const FUTEX_WAITERS: u32 = 0x80000000; pub const FUTEX_OWNER_DIED: u32 = 0x40000000; pub const FUTEX_TID_MASK: u32 = 0x3fffffff; -pub const FUTEX_BITSET_MATCH_ANY: c_int = 0xffffffff; +pub const FUTEX_BITSET_MATCH_ANY: c_int = u32_cast_int(0xffffffff); pub const FUTEX_OP_SET: c_int = 0; pub const FUTEX_OP_ADD: c_int = 1; diff --git a/src/solid/mod.rs b/src/solid/mod.rs index c0ba109d39e2f..c15fd8cc786ec 100644 --- a/src/solid/mod.rs +++ b/src/solid/mod.rs @@ -207,10 +207,10 @@ pub const S_IWRITE: c_short = 0o0200; pub const S_IREAD: c_short = 0o0400; pub const S_IFCHR: c_short = 0o2_0000; pub const S_IFDIR: c_short = 0o4_0000; -pub const S_IFMT: c_short = 0o16_0000; +pub const S_IFMT: c_short = u16_cast_short(0o16_0000); pub const S_IFIFO: c_short = 0o1_0000; pub const S_IFBLK: c_short = 0o6_0000; -pub const S_IFREG: c_short = 0o10_0000; +pub const S_IFREG: c_short = u16_cast_short(0o10_0000); pub const LC_ALL: c_int = 0; pub const LC_COLLATE: c_int = 1; diff --git a/src/types.rs b/src/types.rs index d786d2ccb8721..170aefbfb5af2 100644 --- a/src/types.rs +++ b/src/types.rs @@ -65,3 +65,37 @@ pub(crate) type CEnumRepr = c_int; #[cfg(not(target_env = "msvc"))] #[allow(unused)] pub(crate) type CEnumRepr = c_uint; + +/// Used to avoid `overflowing_literals` when the value is in-range for the unsigned number but +/// out-of-range for signed. +#[allow(unused)] +pub(crate) const fn u16_cast_short(x: u16) -> c_short { + assert!(size_of::() <= size_of::()); // Should always be true + x as i16 +} + +/// Used to avoid `overflowing_literals` when the value is in-range for the unsigned number but +/// out-of-range for signed. +#[allow(unused)] +pub(crate) const fn u32_cast_int(x: u32) -> c_int { + // May not be true on 16-bit platforms, but should be everywhere this is used. + assert!(size_of::() <= size_of::()); + x as i32 +} + +/// Used to avoid `overflowing_literals` when the value is in-range for the unsigned number but +/// out-of-range for signed. +#[allow(unused)] +pub(crate) const fn u32_cast_long(x: u32) -> c_long { + assert!(size_of::() <= size_of::()); // Should always be true + x as c_long +} + +/// Used to avoid `overflowing_literals` when the value is in-range for the unsigned number but +/// out-of-range for signed. +#[allow(unused)] +#[cfg(any(target_os = "linux", target_os = "android", target_os = "l4re"))] +pub(crate) const fn u32_cast_ioctl(x: u32) -> crate::Ioctl { + assert!(size_of::() <= size_of::()); // Should always be true + x as crate::Ioctl +} diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 04df0b6ba336d..5e8c5c05b32e2 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -775,7 +775,7 @@ pub const IPV6_FLOWINFO_FLOWLABEL: c_int = 0x00ffffff; pub const IPV6_FLOWINFO_PRIORITY: c_int = 0x0f000000; pub const IPV6_FLOWINFO_PRIFLOW: c_int = 0x0fffffff; pub const IPV6_FLOWINFO_SRFLAG: c_int = 0x10000000; -pub const IPV6_FLOWINFO_VERSION: c_int = 0xf0000000; +pub const IPV6_FLOWINFO_VERSION: c_int = u32_cast_int(0xf0000000); pub const IPV6_HOPLIMIT: c_int = 40; pub const IPV6_HOPOPTS: c_int = 52; pub const IPV6_NEXTHOP: c_int = 48; @@ -810,20 +810,20 @@ pub const DLT_PPP: c_int = 0x17; pub const DLT_FDDI: c_int = 0xf; pub const DLT_ATM: c_int = 0x25; pub const DLT_IPOIB: c_int = 0xc7; -pub const BIOCSETF: c_int = 0x80104267; +pub const BIOCSETF: c_int = u32_cast_int(0x80104267); pub const BIOCGRTIMEOUT: c_int = 0x4010426e; pub const BIOCGBLEN: c_int = 0x40044266; -pub const BIOCSBLEN: c_int = 0xc0044266; +pub const BIOCSBLEN: c_int = u32_cast_int(0xc0044266); pub const BIOCFLUSH: c_int = 0x20004268; pub const BIOCPROMISC: c_int = 0x20004269; pub const BIOCGDLT: c_int = 0x4004426a; -pub const BIOCSRTIMEOUT: c_int = 0x8010426d; +pub const BIOCSRTIMEOUT: c_int = u32_cast_int(0x8010426d); pub const BIOCGSTATS: c_int = 0x4008426f; -pub const BIOCIMMEDIATE: c_int = 0x80044270; +pub const BIOCIMMEDIATE: c_int = u32_cast_int(0x80044270); pub const BIOCVERSION: c_int = 0x40044271; pub const BIOCSDEVNO: c_int = 0x20004272; pub const BIOCGETIF: c_int = 0x4020426b; -pub const BIOCSETIF: c_int = 0x8020426c; +pub const BIOCSETIF: c_int = u32_cast_int(0x8020426c); pub const BPF_ABS: c_int = 32; pub const BPF_ADD: c_int = 0; pub const BPF_ALIGNMENT: c_ulong = 4; @@ -1350,15 +1350,15 @@ pub const IOC_INOUT: c_int = IOC_IN | IOC_OUT; pub const FIOCLEX: c_int = 0x20006601; pub const FIONCLEX: c_int = 0x20006602; pub const FIONREAD: c_int = 0x4004667f; -pub const FIONBIO: c_int = 0x8004667e; -pub const FIOASYNC: c_int = 0x8004667d; -pub const FIOSETOWN: c_int = 0x8004667c; +pub const FIONBIO: c_int = u32_cast_int(0x8004667e); +pub const FIOASYNC: c_int = u32_cast_int(0x8004667d); +pub const FIOSETOWN: c_int = u32_cast_int(0x8004667c); pub const FIOGETOWN: c_int = 0x4004667b; pub const TIOCGETD: c_int = 0x40047400; -pub const TIOCSETD: c_int = 0x80047401; +pub const TIOCSETD: c_int = u32_cast_int(0x80047401); pub const TIOCHPCL: c_int = 0x20007402; pub const TIOCMODG: c_int = 0x40047403; -pub const TIOCMODS: c_int = 0x80047404; +pub const TIOCMODS: c_int = u32_cast_int(0x80047404); pub const TIOCM_LE: c_int = 0x1; pub const TIOCM_DTR: c_int = 0x2; pub const TIOCM_RTS: c_int = 0x4; @@ -1371,45 +1371,45 @@ pub const TIOCM_RNG: c_int = 0x80; pub const TIOCM_RI: c_int = 0x80; pub const TIOCM_DSR: c_int = 0x100; pub const TIOCGETP: c_int = 0x40067408; -pub const TIOCSETP: c_int = 0x80067409; -pub const TIOCSETN: c_int = 0x8006740a; +pub const TIOCSETP: c_int = u32_cast_int(0x80067409); +pub const TIOCSETN: c_int = u32_cast_int(0x8006740a); pub const TIOCEXCL: c_int = 0x2000740d; pub const TIOCNXCL: c_int = 0x2000740e; -pub const TIOCFLUSH: c_int = 0x80047410; -pub const TIOCSETC: c_int = 0x80067411; +pub const TIOCFLUSH: c_int = u32_cast_int(0x80047410); +pub const TIOCSETC: c_int = u32_cast_int(0x80067411); pub const TIOCGETC: c_int = 0x40067412; pub const TANDEM: c_int = 0x1; pub const CBREAK: c_int = 0x2; pub const LCASE: c_int = 0x4; pub const MDMBUF: c_int = 0x800000; pub const XTABS: c_int = 0xc00; -pub const SIOCADDMULTI: c_int = 0x80206931; -pub const SIOCADDRT: c_int = 0x8038720a; -pub const SIOCDARP: c_int = 0x804c6920; -pub const SIOCDELMULTI: c_int = 0x80206932; -pub const SIOCDELRT: c_int = 0x8038720b; -pub const SIOCDIFADDR: c_int = 0x80286919; -pub const SIOCGARP: c_int = 0xc04c6926; -pub const SIOCGIFADDR: c_int = 0xc0286921; -pub const SIOCGIFBRDADDR: c_int = 0xc0286923; -pub const SIOCGIFCONF: c_int = 0xc0106945; -pub const SIOCGIFDSTADDR: c_int = 0xc0286922; -pub const SIOCGIFFLAGS: c_int = 0xc0286911; -pub const SIOCGIFHWADDR: c_int = 0xc0546995; -pub const SIOCGIFMETRIC: c_int = 0xc0286917; -pub const SIOCGIFMTU: c_int = 0xc0286956; -pub const SIOCGIFNETMASK: c_int = 0xc0286925; -pub const SIOCSARP: c_int = 0x804c691e; -pub const SIOCSIFADDR: c_int = 0x8028690c; -pub const SIOCSIFBRDADDR: c_int = 0x80286913; -pub const SIOCSIFDSTADDR: c_int = 0x8028690e; -pub const SIOCSIFFLAGS: c_int = 0x80286910; -pub const SIOCSIFMETRIC: c_int = 0x80286918; -pub const SIOCSIFMTU: c_int = 0x80286958; -pub const SIOCSIFNETMASK: c_int = 0x80286916; -pub const TIOCUCNTL: c_int = 0x80047466; -pub const TIOCCONS: c_int = 0x80047462; -pub const TIOCPKT: c_int = 0x80047470; +pub const SIOCADDMULTI: c_int = u32_cast_int(0x80206931); +pub const SIOCADDRT: c_int = u32_cast_int(0x8038720a); +pub const SIOCDARP: c_int = u32_cast_int(0x804c6920); +pub const SIOCDELMULTI: c_int = u32_cast_int(0x80206932); +pub const SIOCDELRT: c_int = u32_cast_int(0x8038720b); +pub const SIOCDIFADDR: c_int = u32_cast_int(0x80286919); +pub const SIOCGARP: c_int = u32_cast_int(0xc04c6926); +pub const SIOCGIFADDR: c_int = u32_cast_int(0xc0286921); +pub const SIOCGIFBRDADDR: c_int = u32_cast_int(0xc0286923); +pub const SIOCGIFCONF: c_int = u32_cast_int(0xc0106945); +pub const SIOCGIFDSTADDR: c_int = u32_cast_int(0xc0286922); +pub const SIOCGIFFLAGS: c_int = u32_cast_int(0xc0286911); +pub const SIOCGIFHWADDR: c_int = u32_cast_int(0xc0546995); +pub const SIOCGIFMETRIC: c_int = u32_cast_int(0xc0286917); +pub const SIOCGIFMTU: c_int = u32_cast_int(0xc0286956); +pub const SIOCGIFNETMASK: c_int = u32_cast_int(0xc0286925); +pub const SIOCSARP: c_int = u32_cast_int(0x804c691e); +pub const SIOCSIFADDR: c_int = u32_cast_int(0x8028690c); +pub const SIOCSIFBRDADDR: c_int = u32_cast_int(0x80286913); +pub const SIOCSIFDSTADDR: c_int = u32_cast_int(0x8028690e); +pub const SIOCSIFFLAGS: c_int = u32_cast_int(0x80286910); +pub const SIOCSIFMETRIC: c_int = u32_cast_int(0x80286918); +pub const SIOCSIFMTU: c_int = u32_cast_int(0x80286958); +pub const SIOCSIFNETMASK: c_int = u32_cast_int(0x80286916); +pub const TIOCUCNTL: c_int = u32_cast_int(0x80047466); +pub const TIOCCONS: c_int = u32_cast_int(0x80047462); +pub const TIOCPKT: c_int = u32_cast_int(0x80047470); pub const TIOCPKT_DATA: c_int = 0; pub const TIOCPKT_FLUSHREAD: c_int = 1; pub const TIOCPKT_FLUSHWRITE: c_int = 2; @@ -1552,7 +1552,7 @@ pub const POLLOUT: c_short = 0x0002; pub const POLLERR: c_short = 0x4000; pub const POLLHUP: c_short = 0x2000; pub const POLLMSG: c_short = 0x0080; -pub const POLLSYNC: c_short = 0x8000; +pub const POLLSYNC: c_short = u16_cast_short(0x8000); pub const POLLNVAL: c_short = POLLSYNC; pub const POLLNORM: c_short = POLLIN; pub const POLLRDNORM: c_short = 0x0010; @@ -1676,11 +1676,11 @@ pub const SETALL: c_int = 9; // sys/shm.h pub const SHMLBA: c_int = 0x10000000; pub const SHMLBA_EXTSHM: c_int = 0x1000; -pub const SHM_SHMAT: c_int = 0x80000000; +pub const SHM_SHMAT: c_int = u32_cast_int(0x80000000); pub const SHM_RDONLY: c_int = 0o10000; pub const SHM_RND: c_int = 0o20000; pub const SHM_PIN: c_int = 0o4000; -pub const SHM_LGPAGE: c_int = 0o20000000000; +pub const SHM_LGPAGE: c_int = u32_cast_int(0o20000000000); pub const SHM_MAP: c_int = 0o4000; pub const SHM_FMAP: c_int = 0o2000; pub const SHM_COPY: c_int = 0o40000; @@ -2074,30 +2074,30 @@ pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; pub const TIOC: c_int = 0x5400; pub const TIOCGWINSZ: c_int = 0x40087468; -pub const TIOCSWINSZ: c_int = 0x80087467; -pub const TIOCLBIS: c_int = 0x8004747f; -pub const TIOCLBIC: c_int = 0x8004747e; -pub const TIOCLSET: c_int = 0x8004747d; +pub const TIOCSWINSZ: c_int = u32_cast_int(0x80087467); +pub const TIOCLBIS: c_int = u32_cast_int(0x8004747f); +pub const TIOCLBIC: c_int = u32_cast_int(0x8004747e); +pub const TIOCLSET: c_int = u32_cast_int(0x8004747d); pub const TIOCLGET: c_int = 0x4004747c; pub const TIOCSBRK: c_int = 0x2000747b; pub const TIOCCBRK: c_int = 0x2000747a; pub const TIOCSDTR: c_int = 0x20007479; pub const TIOCCDTR: c_int = 0x20007478; -pub const TIOCSLTC: c_int = 0x80067475; +pub const TIOCSLTC: c_int = u32_cast_int(0x80067475); pub const TIOCGLTC: c_int = 0x40067474; pub const TIOCOUTQ: c_int = 0x40047473; pub const TIOCNOTTY: c_int = 0x20007471; pub const TIOCSTOP: c_int = 0x2000746f; pub const TIOCSTART: c_int = 0x2000746e; pub const TIOCGPGRP: c_int = 0x40047477; -pub const TIOCSPGRP: c_int = 0x80047476; +pub const TIOCSPGRP: c_int = u32_cast_int(0x80047476); pub const TIOCGSID: c_int = 0x40047448; -pub const TIOCSTI: c_int = 0x80017472; -pub const TIOCMSET: c_int = 0x8004746d; -pub const TIOCMBIS: c_int = 0x8004746c; -pub const TIOCMBIC: c_int = 0x8004746b; +pub const TIOCSTI: c_int = u32_cast_int(0x80017472); +pub const TIOCMSET: c_int = u32_cast_int(0x8004746d); +pub const TIOCMBIS: c_int = u32_cast_int(0x8004746c); +pub const TIOCMBIC: c_int = u32_cast_int(0x8004746b); pub const TIOCMGET: c_int = 0x4004746a; -pub const TIOCREMOTE: c_int = 0x80047469; +pub const TIOCREMOTE: c_int = u32_cast_int(0x80047469); // sys/user.h pub const MAXCOMLEN: c_int = 32; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 94d64b2da3f22..84abbcf91bfa7 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3162,7 +3162,7 @@ pub const CTLTYPE_STRING: c_int = 3; pub const CTLTYPE_QUAD: c_int = 4; pub const CTLTYPE_OPAQUE: c_int = 5; pub const CTLTYPE_STRUCT: c_int = CTLTYPE_OPAQUE; -pub const CTLFLAG_RD: c_int = 0x80000000; +pub const CTLFLAG_RD: c_int = u32_cast_int(0x80000000); pub const CTLFLAG_WR: c_int = 0x40000000; pub const CTLFLAG_RW: c_int = CTLFLAG_RD | CTLFLAG_WR; pub const CTLFLAG_NOLOCK: c_int = 0x20000000; diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 6c630c197f377..4b5e799a448ec 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -692,13 +692,13 @@ pub const CTL_P1003_1B_SIGQUEUE_MAX: c_int = 24; pub const CTL_P1003_1B_TIMER_MAX: c_int = 25; pub const CTL_P1003_1B_MAXID: c_int = 26; -pub const CPUCTL_RSMSR: c_int = 0xc0106301; -pub const CPUCTL_WRMSR: c_int = 0xc0106302; -pub const CPUCTL_CPUID: c_int = 0xc0106303; -pub const CPUCTL_UPDATE: c_int = 0xc0106304; -pub const CPUCTL_MSRSBIT: c_int = 0xc0106305; -pub const CPUCTL_MSRCBIT: c_int = 0xc0106306; -pub const CPUCTL_CPUID_COUNT: c_int = 0xc0106307; +pub const CPUCTL_RSMSR: c_int = u32_cast_int(0xc0106301); +pub const CPUCTL_WRMSR: c_int = u32_cast_int(0xc0106302); +pub const CPUCTL_CPUID: c_int = u32_cast_int(0xc0106303); +pub const CPUCTL_UPDATE: c_int = u32_cast_int(0xc0106304); +pub const CPUCTL_MSRSBIT: c_int = u32_cast_int(0xc0106305); +pub const CPUCTL_MSRCBIT: c_int = u32_cast_int(0xc0106306); +pub const CPUCTL_CPUID_COUNT: c_int = u32_cast_int(0xc0106307); pub const CPU_SETSIZE: size_t = size_of::() * 8; @@ -1042,7 +1042,7 @@ pub const MSG_SYNC: c_int = 0x00000800; pub const MSG_CMSG_CLOEXEC: c_int = 0x00001000; pub const MSG_FBLOCKING: c_int = 0x00010000; pub const MSG_FNONBLOCKING: c_int = 0x00020000; -pub const MSG_FMASK: c_int = 0xFFFF0000; +pub const MSG_FMASK: c_int = u32_cast_int(0xFFFF0000); // sys/mount.h pub const MNT_NODEV: c_int = 0x00000010; @@ -1101,7 +1101,7 @@ pub const TIOCREMOTE: c_ulong = 0x80047469; pub const TIOCTIMESTAMP: c_ulong = 0x40107459; // Constants used by "at" family of system calls. -pub const AT_FDCWD: c_int = 0xFFFAFDCD; // invalid file descriptor +pub const AT_FDCWD: c_int = u32_cast_int(0xFFFAFDCD); // invalid file descriptor pub const AT_SYMLINK_NOFOLLOW: c_int = 1; pub const AT_REMOVEDIR: c_int = 2; pub const AT_EACCESS: c_int = 4; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs index b29171cc509c5..cf720ebe5e517 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs @@ -4,4 +4,4 @@ pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: c_int = 2; pub const PROC_KPTI_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 1; -pub const PROC_KPTI_STATUS_ACTIVE: c_int = 0x80000000; +pub const PROC_KPTI_STATUS_ACTIVE: c_int = u32_cast_int(0x80000000); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs index b29171cc509c5..cf720ebe5e517 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs @@ -4,4 +4,4 @@ pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: c_int = 2; pub const PROC_KPTI_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 1; -pub const PROC_KPTI_STATUS_ACTIVE: c_int = 0x80000000; +pub const PROC_KPTI_STATUS_ACTIVE: c_int = u32_cast_int(0x80000000); diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs index 3e037471fbf68..b490c6e25dd8d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs @@ -4,7 +4,7 @@ pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: c_int = 2; pub const PROC_KPTI_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 1; -pub const PROC_KPTI_STATUS_ACTIVE: c_int = 0x80000000; +pub const PROC_KPTI_STATUS_ACTIVE: c_int = u32_cast_int(0x80000000); pub const PROC_LA_CTL: c_int = crate::PROC_PROCCTL_MD_MIN + 2; pub const PROC_LA_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 3; pub const PROC_LA_CTL_LA48_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs index 3e037471fbf68..b490c6e25dd8d 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs @@ -4,7 +4,7 @@ pub const PROC_KPTI_CTL: c_int = crate::PROC_PROCCTL_MD_MIN; pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: c_int = 1; pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: c_int = 2; pub const PROC_KPTI_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 1; -pub const PROC_KPTI_STATUS_ACTIVE: c_int = 0x80000000; +pub const PROC_KPTI_STATUS_ACTIVE: c_int = u32_cast_int(0x80000000); pub const PROC_LA_CTL: c_int = crate::PROC_PROCCTL_MD_MIN + 2; pub const PROC_LA_STATUS: c_int = crate::PROC_PROCCTL_MD_MIN + 3; pub const PROC_LA_CTL_LA48_ON_EXEC: c_int = 1; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 453f4dcfbda23..9f24027c19046 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2189,7 +2189,7 @@ pub const CTLTYPE_S16: c_int = 0xd; pub const CTLTYPE_S32: c_int = 0xe; pub const CTLTYPE_U32: c_int = 0xf; -pub const CTLFLAG_RD: c_int = 0x80000000; +pub const CTLFLAG_RD: c_int = u32_cast_int(0x80000000); pub const CTLFLAG_WR: c_int = 0x40000000; pub const CTLFLAG_RW: c_int = CTLFLAG_RD | CTLFLAG_WR; pub const CTLFLAG_DORMANT: c_int = 0x20000000; @@ -2437,7 +2437,7 @@ pub const SO_PROTOTYPE: c_int = SO_PROTOCOL; pub const SO_TS_CLOCK: c_int = 0x1017; pub const SO_DOMAIN: c_int = 0x1019; pub const SO_SPLICE: c_int = 0x1023; -pub const SO_VENDOR: c_int = 0x80000000; +pub const SO_VENDOR: c_int = u32_cast_int(0x80000000); pub const SO_TS_REALTIME_MICRO: c_int = 0; pub const SO_TS_BINTIME: c_int = 1; @@ -2552,12 +2552,12 @@ pub const PROC_TRAPCAP_CTL_DISABLE: c_int = 2; pub const PROC_ASLR_FORCE_ENABLE: c_int = 1; pub const PROC_ASLR_FORCE_DISABLE: c_int = 2; pub const PROC_ASLR_NOFORCE: c_int = 3; -pub const PROC_ASLR_ACTIVE: c_int = 0x80000000; +pub const PROC_ASLR_ACTIVE: c_int = u32_cast_int(0x80000000); pub const PROC_PROTMAX_FORCE_ENABLE: c_int = 1; pub const PROC_PROTMAX_FORCE_DISABLE: c_int = 2; pub const PROC_PROTMAX_NOFORCE: c_int = 3; -pub const PROC_PROTMAX_ACTIVE: c_int = 0x80000000; +pub const PROC_PROTMAX_ACTIVE: c_int = u32_cast_int(0x80000000); pub const PROC_STACKGAP_ENABLE: c_int = 0x0001; pub const PROC_STACKGAP_DISABLE: c_int = 0x0002; @@ -2569,7 +2569,7 @@ pub const PROC_NO_NEW_PRIVS_DISABLE: c_int = 2; pub const PROC_WX_MAPPINGS_PERMIT: c_int = 0x0001; pub const PROC_WX_MAPPINGS_DISALLOW_EXEC: c_int = 0x0002; -pub const PROC_WXORX_ENFORCE: c_int = 0x80000000; +pub const PROC_WXORX_ENFORCE: c_int = u32_cast_int(0x80000000); pub const AF_SLOW: c_int = 33; pub const AF_SCLUSTER: c_int = 34; @@ -2713,7 +2713,7 @@ pub const IFCAP_VXLAN_HWCSUM: c_int = 0x20000000; /// can do IFCAP_TSO on VXLANs pub const IFCAP_VXLAN_HWTSO: c_int = 0x40000000; /// can do TLS with rate limiting -pub const IFCAP_TXTLS_RTLMT: c_int = 0x80000000; +pub const IFCAP_TXTLS_RTLMT: c_int = u32_cast_int(0x80000000); pub const IFCAP_HWCSUM_IPV6: c_int = IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6; pub const IFCAP_HWCSUM: c_int = IFCAP_RXCSUM | IFCAP_TXCSUM; @@ -3303,7 +3303,7 @@ pub const RFTHREAD: c_int = 8192; pub const RFSIGSHARE: c_int = 16384; pub const RFLINUXTHPN: c_int = 65536; pub const RFTSIGZMB: c_int = 524288; -pub const RFSPAWN: c_int = 2147483648; +pub const RFSPAWN: c_int = u32_cast_int(2147483648); // For eventfd pub const EFD_SEMAPHORE: c_int = 0x1; @@ -3705,7 +3705,7 @@ pub const P_STATCHILD: c_int = 0x08000000; pub const P_INMEM: c_int = 0x10000000; pub const P_SWAPPINGOUT: c_int = 0x20000000; pub const P_SWAPPINGIN: c_int = 0x40000000; -pub const P_PPTRACE: c_int = 0x80000000; +pub const P_PPTRACE: c_int = u32_cast_int(0x80000000); pub const P_STOPPED: c_int = P_STOPPED_SIG | P_STOPPED_SINGLE | P_STOPPED_TRACE; pub const P2_INHERIT_PROTECTED: c_int = 0x00000001; @@ -3729,11 +3729,11 @@ pub const SZOMB: c_char = 5; pub const SWAIT: c_char = 6; pub const SLOCK: c_char = 7; -pub const P_MAGIC: c_int = 0xbeefface; +pub const P_MAGIC: c_int = u32_cast_int(0xbeefface); pub const TDP_SIGFASTBLOCK: c_int = 0x00000100; pub const TDP_UIOHELD: c_int = 0x10000000; -pub const TDP_SIGFASTPENDING: c_int = 0x80000000; +pub const TDP_SIGFASTPENDING: c_int = u32_cast_int(0x80000000); pub const TDP2_COMPAT32RB: c_int = 0x00000002; pub const P2_PROTMAX_ENABLE: c_int = 0x00000200; pub const P2_PROTMAX_DISABLE: c_int = 0x00000400; @@ -4293,7 +4293,7 @@ safe_f! { } pub const fn INVALID_SINFO_FLAG(x: c_int) -> bool { - (x) & 0xfffffff0 + (x) & u32_cast_int(0xfffffff0) & !(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 1ccf04eb2c85c..729fd6cd8705f 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -596,7 +596,7 @@ pub const MCL_FUTURE: c_int = 0x0002; pub const MNT_EXPUBLIC: c_int = 0x20000000; pub const MNT_NOATIME: c_int = 0x10000000; pub const MNT_NOCLUSTERR: c_int = 0x40000000; -pub const MNT_NOCLUSTERW: c_int = 0x80000000; +pub const MNT_NOCLUSTERW: c_int = u32_cast_int(0x80000000); pub const MNT_NOSYMFOLLOW: c_int = 0x00400000; pub const MNT_SOFTDEP: c_int = 0x00200000; pub const MNT_SUIDDIR: c_int = 0x00100000; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 08afb94b70232..dc84784f268c5 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -968,7 +968,7 @@ pub const TCP_CONGCTL: c_int = 0x20; pub const SOCK_CONN_DGRAM: c_int = 6; pub const SOCK_DCCP: c_int = SOCK_CONN_DGRAM; pub const SOCK_NOSIGPIPE: c_int = 0x40000000; -pub const SOCK_FLAGS_MASK: c_int = 0xf0000000; +pub const SOCK_FLAGS_MASK: c_int = u32_cast_int(0xf0000000); pub const SO_SNDTIMEO: c_int = 0x100b; pub const SO_RCVTIMEO: c_int = 0x100c; @@ -1275,7 +1275,7 @@ pub const MNT_NOATIME: c_int = 0x04000000; pub const MNT_AUTOMOUNTED: c_int = 0x10000000; pub const MNT_SYMPERM: c_int = 0x20000000; pub const MNT_NODEVMTIME: c_int = 0x40000000; -pub const MNT_SOFTDEP: c_int = 0x80000000; +pub const MNT_SOFTDEP: c_int = u32_cast_int(0x80000000); pub const MNT_POSIX1EACLS: c_int = 0x00000800; pub const MNT_ACLS: c_int = MNT_POSIX1EACLS; pub const MNT_WAIT: c_int = 1; @@ -1477,7 +1477,7 @@ pub const CTLFLAG_ALIAS: c_int = 0x00010000; pub const CTLFLAG_MMAP: c_int = 0x00020000; pub const CTLFLAG_OWNDESC: c_int = 0x00040000; pub const CTLFLAG_UNSIGNED: c_int = 0x00080000; -pub const SYSCTL_VERS_MASK: c_int = 0xff000000; +pub const SYSCTL_VERS_MASK: c_int = u32_cast_int(0xff000000); pub const SYSCTL_VERS_0: c_int = 0x00000000; pub const SYSCTL_VERS_1: c_int = 0x01000000; pub const SYSCTL_VERSION: c_int = SYSCTL_VERS_1; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 102e468a470cf..db80d9ae5c2d6 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1539,7 +1539,7 @@ pub const NFSMNT_ACDIRMIN: c_int = 0x100000; // acdirmin field valid pub const NFSMNT_ACDIRMAX: c_int = 0x200000; // acdirmax field valid /* Flags valid only in kernel */ -pub const NFSMNT_INTERNAL: c_int = 0xfffc0000; // Bits set internally +pub const NFSMNT_INTERNAL: c_int = u32_cast_int(0xfffc0000); // Bits set internally pub const NFSMNT_HASWRITEVERF: c_int = 0x40000; // Has write verifier for V3 pub const NFSMNT_GOTPATHCONF: c_int = 0x80000; // Got the V3 pathconf info pub const NFSMNT_GOTFSINFO: c_int = 0x100000; // Got the V3 fsinfo @@ -1553,7 +1553,7 @@ pub const NFSMNT_WANTRCV: c_int = 0x8000000; // Want above pub const NFSMNT_WAITAUTH: c_int = 0x10000000; // Wait for authentication pub const NFSMNT_HASAUTH: c_int = 0x20000000; // Has authenticator pub const NFSMNT_WANTAUTH: c_int = 0x40000000; // Wants an authenticator -pub const NFSMNT_AUTHERR: c_int = 0x80000000; // Authentication error +pub const NFSMNT_AUTHERR: c_int = u32_cast_int(0x80000000); // Authentication error pub const MSDOSFSMNT_SHORTNAME: c_int = 0x1; // Force old DOS short names only pub const MSDOSFSMNT_LONGNAME: c_int = 0x2; // Force Win'95 long names diff --git a/src/unix/cygwin/mod.rs b/src/unix/cygwin/mod.rs index f63a05e9830ef..804bf4ef4c35e 100644 --- a/src/unix/cygwin/mod.rs +++ b/src/unix/cygwin/mod.rs @@ -599,7 +599,7 @@ pub const SA_SIGINFO: c_int = 0x00000002; pub const SA_RESTART: c_int = 0x10000000; pub const SA_ONSTACK: c_int = 0x20000000; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const MINSIGSTKSZ: size_t = 8192; pub const SIGSTKSZ: size_t = 32768; pub const SIGHUP: c_int = 1; @@ -693,8 +693,8 @@ pub const IF_NAMESIZE: size_t = 44; pub const IFNAMSIZ: size_t = IF_NAMESIZE; pub const FIONREAD: c_int = 0x4008667f; -pub const FIONBIO: c_int = 0x8004667e; -pub const FIOASYNC: c_int = 0x8008667d; +pub const FIONBIO: c_int = u32_cast_int(0x8004667e); +pub const FIOASYNC: c_int = u32_cast_int(0x8008667d); pub const FIOCLEX: c_int = 0; // FIXME: does not exist on Cygwin! pub const SIOCGIFCONF: c_ulong = 0x80107364; pub const SIOCGIFFLAGS: c_ulong = 0x80507365; diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 9c86f72638a3c..bc0cd5e15bd57 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -519,7 +519,7 @@ cfg_if! { // kernel/OS.h pub const B_OS_NAME_LENGTH: usize = 32; pub const B_PAGE_SIZE: usize = 4096; -pub const B_INFINITE_TIMEOUT: usize = 9223372036854775807; +pub const B_INFINITE_TIMEOUT: c_longlong = 0x7FFFFFFFFFFFFFFF; pub const B_RELATIVE_TIMEOUT: u32 = 0x8; pub const B_ABSOLUTE_TIMEOUT: u32 = 0x10; diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index d0c2349b98c62..f4f5e369f201a 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -188,7 +188,7 @@ pub const SA_NOCLDSTOP: c_int = 0x00000001; pub const SA_NOCLDWAIT: c_int = 0x00000002; pub const SA_NODEFER: c_int = 0x40000000; pub const SA_ONSTACK: c_int = 0x08000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_SIGINFO: c_int = 0x00000004; diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index 84c35a57f674a..fd4d84f517911 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -145,7 +145,7 @@ pub const SA_NOCLDSTOP: c_int = 0x00000001; pub const SA_NOCLDWAIT: c_int = 0x00000002; pub const SA_NODEFER: c_int = 0x40000000; pub const SA_ONSTACK: c_int = 0x08000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_SIGINFO: c_int = 0x00000004; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 4c074e3d5c8eb..56e10a4e93aea 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -658,6 +658,7 @@ s_no_extra_traits! { } pub const MADV_SOFT_OFFLINE: c_int = 101; +#[allow(overflowing_literals)] // fixed in a future kernel version pub const MS_NOUSER: c_ulong = 0xffffffff80000000; pub const MS_RMT_MASK: c_ulong = 0x02800051; @@ -1270,7 +1271,7 @@ pub const TCGETS: c_int = 0x5401; pub const TCSETS: c_int = 0x5402; pub const TCSETSW: c_int = 0x5403; pub const TCSETSF: c_int = 0x5404; -pub const TCGETS2: c_int = 0x802c542a; +pub const TCGETS2: c_int = u32_cast_int(0x802c542a); pub const TCSETS2: c_int = 0x402c542b; pub const TCSETSW2: c_int = 0x402c542c; pub const TCSETSF2: c_int = 0x402c542d; @@ -1334,24 +1335,24 @@ pub const AI_DEFAULT: c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG; // linux/kexec.h pub const KEXEC_ON_CRASH: c_int = 0x00000001; pub const KEXEC_PRESERVE_CONTEXT: c_int = 0x00000002; -pub const KEXEC_ARCH_MASK: c_int = 0xffff0000; +pub const KEXEC_ARCH_MASK: c_int = u32_cast_int(0xffff0000); pub const KEXEC_FILE_UNLOAD: c_int = 0x00000001; pub const KEXEC_FILE_ON_CRASH: c_int = 0x00000002; pub const KEXEC_FILE_NO_INITRAMFS: c_int = 0x00000004; -pub const LINUX_REBOOT_MAGIC1: c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC1: c_int = u32_cast_int(0xfee1dead); pub const LINUX_REBOOT_MAGIC2: c_int = 672274793; pub const LINUX_REBOOT_MAGIC2A: c_int = 85072278; pub const LINUX_REBOOT_MAGIC2B: c_int = 369367448; pub const LINUX_REBOOT_MAGIC2C: c_int = 537993216; pub const LINUX_REBOOT_CMD_RESTART: c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_HALT: c_int = u32_cast_int(0xCDEF0123); +pub const LINUX_REBOOT_CMD_CAD_ON: c_int = u32_cast_int(0x89ABCDEF); pub const LINUX_REBOOT_CMD_CAD_OFF: c_int = 0x00000000; pub const LINUX_REBOOT_CMD_POWER_OFF: c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_RESTART2: c_int = u32_cast_int(0xA1B2C3D4); +pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = u32_cast_int(0xD000FCE2); pub const LINUX_REBOOT_CMD_KEXEC: c_int = 0x45584543; pub const REG_BASIC: c_int = 0; @@ -1898,7 +1899,7 @@ pub const NF_MAX_VERDICT: c_int = NF_STOP; pub const NF_VERDICT_MASK: c_int = 0x000000ff; pub const NF_VERDICT_FLAG_QUEUE_BYPASS: c_int = 0x00008000; -pub const NF_VERDICT_QMASK: c_int = 0xffff0000; +pub const NF_VERDICT_QMASK: c_int = u32_cast_int(0xffff0000); pub const NF_VERDICT_QBITS: c_int = 16; pub const NF_VERDICT_BITS: c_int = 16; @@ -2790,7 +2791,7 @@ pub const PR_SET_MM_EXE_FILE: c_int = 13; pub const PR_SET_MM_MAP: c_int = 14; pub const PR_SET_MM_MAP_SIZE: c_int = 15; pub const PR_SET_PTRACER: c_int = 0x59616d61; -pub const PR_SET_PTRACER_ANY: c_ulong = 0xffffffffffffffff; +pub const PR_SET_PTRACER_ANY: c_ulong = (-1 as c_long) as c_ulong; pub const PR_SET_CHILD_SUBREAPER: c_int = 36; pub const PR_GET_CHILD_SUBREAPER: c_int = 37; pub const PR_SET_NO_NEW_PRIVS: c_int = 38; @@ -3256,7 +3257,7 @@ pub const PF_NO_SETAFFINITY: c_int = 0x04000000; pub const PF_MCE_EARLY: c_int = 0x08000000; pub const PF_MEMALLOC_PIN: c_int = 0x10000000; -pub const PF_SUSPEND_TASK: c_int = 0x80000000; +pub const PF_SUSPEND_TASK: c_int = u32_cast_int(0x80000000); pub const KLOG_CLOSE: c_int = 0; pub const KLOG_OPEN: c_int = 1; diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 243637437f914..29b16c77e96bd 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -921,7 +921,7 @@ pub const EHWPOISON: c_int = 155; pub const EL2NSYNC: c_int = 156; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index cf70367f8e6bc..9b9a11dd53471 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -210,24 +210,24 @@ pub const TCSBRKP: Ioctl = 0x5425; pub const TIOCSBRK: Ioctl = 0x5427; pub const TIOCCBRK: Ioctl = 0x5428; pub const TIOCGSID: Ioctl = 0x5429; -pub const TCGETS2: Ioctl = 0x802c542a; +pub const TCGETS2: Ioctl = u32_cast_ioctl(0x802c542a); pub const TCSETS2: Ioctl = 0x402c542b; pub const TCSETSW2: Ioctl = 0x402c542c; pub const TCSETSF2: Ioctl = 0x402c542d; pub const TIOCGRS485: Ioctl = 0x542E; pub const TIOCSRS485: Ioctl = 0x542F; -pub const TIOCGPTN: Ioctl = 0x80045430; +pub const TIOCGPTN: Ioctl = u32_cast_ioctl(0x80045430); pub const TIOCSPTLCK: Ioctl = 0x40045431; -pub const TIOCGDEV: Ioctl = 0x80045432; +pub const TIOCGDEV: Ioctl = u32_cast_ioctl(0x80045432); pub const TCGETX: Ioctl = 0x5432; pub const TCSETX: Ioctl = 0x5433; pub const TCSETXF: Ioctl = 0x5434; pub const TCSETXW: Ioctl = 0x5435; pub const TIOCSIG: Ioctl = 0x40045436; pub const TIOCVHANGUP: Ioctl = 0x5437; -pub const TIOCGPKT: Ioctl = 0x80045438; -pub const TIOCGPTLCK: Ioctl = 0x80045439; -pub const TIOCGEXCL: Ioctl = 0x80045440; +pub const TIOCGPKT: Ioctl = u32_cast_ioctl(0x80045438); +pub const TIOCGPTLCK: Ioctl = u32_cast_ioctl(0x80045439); +pub const TIOCGEXCL: Ioctl = u32_cast_ioctl(0x80045440); pub const TIOCGPTPEER: Ioctl = 0x5441; // pub const TIOCGISO7816: Ioctl = 0x80285442; // pub const TIOCSISO7816: Ioctl = 0xc0285443; diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 12d46eb72d5a9..44c5f124d4e1a 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -156,11 +156,11 @@ pub const TIOCEXCL: Ioctl = 0x740d; pub const TIOCNXCL: Ioctl = 0x740e; pub const TIOCSCTTY: Ioctl = 0x5480; pub const TIOCGPGRP: Ioctl = 0x40047477; -pub const TIOCSPGRP: Ioctl = 0x80047476; +pub const TIOCSPGRP: Ioctl = u32_cast_ioctl(0x80047476); pub const TIOCOUTQ: Ioctl = 0x7472; pub const TIOCSTI: Ioctl = 0x5472; pub const TIOCGWINSZ: Ioctl = 0x40087468; -pub const TIOCSWINSZ: Ioctl = 0x80087467; +pub const TIOCSWINSZ: Ioctl = u32_cast_ioctl(0x80087467); pub const TIOCMGET: Ioctl = 0x741d; pub const TIOCMBIS: Ioctl = 0x741b; pub const TIOCMBIC: Ioctl = 0x741c; @@ -170,7 +170,7 @@ pub const TIOCSSOFTCAR: Ioctl = 0x5482; pub const FIONREAD: Ioctl = 0x467f; pub const TIOCINQ: Ioctl = FIONREAD; pub const TIOCLINUX: Ioctl = 0x5483; -pub const TIOCCONS: Ioctl = 0x80047478; +pub const TIOCCONS: Ioctl = u32_cast_ioctl(0x80047478); pub const TIOCGSERIAL: Ioctl = 0x5484; pub const TIOCSSERIAL: Ioctl = 0x5485; pub const TIOCPKT: Ioctl = 0x5470; @@ -182,14 +182,14 @@ pub const TCSBRKP: Ioctl = 0x5486; pub const TIOCSBRK: Ioctl = 0x5427; pub const TIOCCBRK: Ioctl = 0x5428; pub const TIOCGSID: Ioctl = 0x7416; -pub const TCGETS2: Ioctl = 0x4030542a; -pub const TCSETS2: Ioctl = 0x8030542b; -pub const TCSETSW2: Ioctl = 0x8030542c; -pub const TCSETSF2: Ioctl = 0x8030542d; +pub const TCGETS2: Ioctl = u32_cast_ioctl(0x4030542a); +pub const TCSETS2: Ioctl = u32_cast_ioctl(0x8030542b); +pub const TCSETSW2: Ioctl = u32_cast_ioctl(0x8030542c); +pub const TCSETSF2: Ioctl = u32_cast_ioctl(0x8030542d); pub const TIOCGPTN: Ioctl = 0x40045430; -pub const TIOCSPTLCK: Ioctl = 0x80045431; +pub const TIOCSPTLCK: Ioctl = u32_cast_ioctl(0x80045431); pub const TIOCGDEV: Ioctl = 0x40045432; -pub const TIOCSIG: Ioctl = 0x80045436; +pub const TIOCSIG: Ioctl = u32_cast_ioctl(0x80045436); pub const TIOCVHANGUP: Ioctl = 0x5437; pub const TIOCGPKT: Ioctl = 0x40045438; pub const TIOCGPTLCK: Ioctl = 0x40045439; @@ -224,7 +224,7 @@ pub const BLKPBSZGET: Ioctl = 0x2000127B; cfg_if! { if #[cfg(target_env = "musl")] { pub const TIOCGRS485: Ioctl = 0x4020542e; - pub const TIOCSRS485: Ioctl = 0xc020542f; + pub const TIOCSRS485: Ioctl = u32_cast_ioctl(0xc020542f); } } diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 41908261721bf..1aaa4c7e0597c 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -132,21 +132,21 @@ pub const SCM_DEVMEM_DMABUF: c_int = SO_DEVMEM_DMABUF; cfg_if! { if #[cfg(target_env = "gnu")] { pub const TCGETS: Ioctl = 0x403c7413; - pub const TCSETS: Ioctl = 0x803c7414; - pub const TCSETSW: Ioctl = 0x803c7415; - pub const TCSETSF: Ioctl = 0x803c7416; + pub const TCSETS: Ioctl = u32_cast_ioctl(0x803c7414); + pub const TCSETSW: Ioctl = u32_cast_ioctl(0x803c7415); + pub const TCSETSF: Ioctl = u32_cast_ioctl(0x803c7416); } else if #[cfg(target_env = "musl")] { pub const TCGETS: Ioctl = 0x402c7413; - pub const TCSETS: Ioctl = 0x802c7414; - pub const TCSETSW: Ioctl = 0x802c7415; - pub const TCSETSF: Ioctl = 0x802c7416; + pub const TCSETS: Ioctl = u32_cast_ioctl(0x802c7414); + pub const TCSETSW: Ioctl = u32_cast_ioctl(0x802c7415); + pub const TCSETSF: Ioctl = u32_cast_ioctl(0x802c7416); } } pub const TCGETA: Ioctl = 0x40147417; -pub const TCSETA: Ioctl = 0x80147418; -pub const TCSETAW: Ioctl = 0x80147419; -pub const TCSETAF: Ioctl = 0x8014741C; +pub const TCSETA: Ioctl = u32_cast_ioctl(0x80147418); +pub const TCSETAW: Ioctl = u32_cast_ioctl(0x80147419); +pub const TCSETAF: Ioctl = u32_cast_ioctl(0x8014741C); pub const TCSBRK: Ioctl = 0x2000741D; pub const TCXONC: Ioctl = 0x2000741E; pub const TCFLSH: Ioctl = 0x2000741F; @@ -154,11 +154,11 @@ pub const TIOCEXCL: Ioctl = 0x540C; pub const TIOCNXCL: Ioctl = 0x540D; pub const TIOCSCTTY: Ioctl = 0x540E; pub const TIOCGPGRP: Ioctl = 0x40047477; -pub const TIOCSPGRP: Ioctl = 0x80047476; +pub const TIOCSPGRP: Ioctl = u32_cast_ioctl(0x80047476); pub const TIOCOUTQ: Ioctl = 0x40047473; pub const TIOCSTI: Ioctl = 0x5412; pub const TIOCGWINSZ: Ioctl = 0x40087468; -pub const TIOCSWINSZ: Ioctl = 0x80087467; +pub const TIOCSWINSZ: Ioctl = u32_cast_ioctl(0x80087467); pub const TIOCMGET: Ioctl = 0x5415; pub const TIOCMBIS: Ioctl = 0x5416; pub const TIOCMBIC: Ioctl = 0x5417; @@ -172,7 +172,7 @@ pub const TIOCCONS: Ioctl = 0x541D; pub const TIOCGSERIAL: Ioctl = 0x541E; pub const TIOCSSERIAL: Ioctl = 0x541F; pub const TIOCPKT: Ioctl = 0x5420; -pub const FIONBIO: Ioctl = 0x8004667e; +pub const FIONBIO: Ioctl = u32_cast_ioctl(0x8004667e); pub const TIOCNOTTY: Ioctl = 0x5422; pub const TIOCSETD: Ioctl = 0x5423; pub const TIOCGETD: Ioctl = 0x5424; @@ -183,9 +183,9 @@ pub const TIOCGSID: Ioctl = 0x5429; pub const TIOCGRS485: Ioctl = 0x542e; pub const TIOCSRS485: Ioctl = 0x542f; pub const TIOCGPTN: Ioctl = 0x40045430; -pub const TIOCSPTLCK: Ioctl = 0x80045431; +pub const TIOCSPTLCK: Ioctl = u32_cast_ioctl(0x80045431); pub const TIOCGDEV: Ioctl = 0x40045432; -pub const TIOCSIG: Ioctl = 0x80045436; +pub const TIOCSIG: Ioctl = u32_cast_ioctl(0x80045436); pub const TIOCVHANGUP: Ioctl = 0x5437; pub const TIOCGPKT: Ioctl = 0x40045438; pub const TIOCGPTLCK: Ioctl = 0x40045439; @@ -195,7 +195,7 @@ pub const TIOCGPTPEER: Ioctl = 0x20005441; //pub const TIOCSISO7816: Ioctl = 0xc0285443; pub const FIONCLEX: Ioctl = 0x20006602; pub const FIOCLEX: Ioctl = 0x20006601; -pub const FIOASYNC: Ioctl = 0x8004667d; +pub const FIOASYNC: Ioctl = u32_cast_ioctl(0x8004667d); pub const TIOCSERCONFIG: Ioctl = 0x5453; pub const TIOCSERGWILD: Ioctl = 0x5454; pub const TIOCSERSWILD: Ioctl = 0x5455; diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index 40899e97f21c3..42799cdd442e5 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -159,7 +159,7 @@ pub const TCSBRKP: Ioctl = 0x5425; pub const TIOCSBRK: Ioctl = 0x2000747b; pub const TIOCCBRK: Ioctl = 0x2000747a; pub const TIOCGSID: Ioctl = 0x40047485; -pub const TCGETS2: Ioctl = 0x402c540c; +pub const TCGETS2: Ioctl = u32_cast_ioctl(0x402c540c); pub const TCSETS2: Ioctl = 0x802c540d; pub const TCSETSW2: Ioctl = 0x802c540e; pub const TCSETSF2: Ioctl = 0x802c540f; diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs index d9aebbe0efda8..1cc39035c3c4e 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -379,7 +379,7 @@ cfg_if! { pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; - pub const SA_RESETHAND: c_int = 0x80000000; + pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index beafaf4e2d475..a32a360df4267 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -442,7 +442,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 3f01da8c0b989..f5b90a7cd47fc 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -771,7 +771,7 @@ pub const SOCK_DGRAM: c_int = 2; pub const SFD_NONBLOCK: c_int = 0x800; pub const SFD_CLOEXEC: c_int = 0x080000; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; pub const SA_ONSTACK: c_int = 0x08000000; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index dfec9203361d0..39d5198ac1323 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -631,7 +631,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index ee2cd21dec783..73024d39fc1ad 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -482,7 +482,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index 9c4c2f81772b6..1943bd8479197 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -273,7 +273,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 7edd7c5664001..ffdccdae2b480 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -512,7 +512,7 @@ pub const EPROTO: c_int = 71; pub const EDOTDOT: c_int = 73; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index a3584d7a6de3d..42d59ad145479 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1857,7 +1857,7 @@ pub const NF_MAX_VERDICT: c_int = NF_STOP; pub const NF_VERDICT_MASK: c_int = 0x000000ff; pub const NF_VERDICT_FLAG_QUEUE_BYPASS: c_int = 0x00008000; -pub const NF_VERDICT_QMASK: c_int = 0xffff0000; +pub const NF_VERDICT_QMASK: c_int = u32_cast_int(0xffff0000); pub const NF_VERDICT_QBITS: c_int = 16; pub const NF_VERDICT_BITS: c_int = 16; @@ -3176,25 +3176,25 @@ pub const FAN_EPIDFD: c_int = -2; // linux/kexec.h pub const KEXEC_ON_CRASH: c_int = 0x00000001; pub const KEXEC_PRESERVE_CONTEXT: c_int = 0x00000002; -pub const KEXEC_ARCH_MASK: c_int = 0xffff0000; +pub const KEXEC_ARCH_MASK: c_int = u32_cast_int(0xffff0000); pub const KEXEC_FILE_UNLOAD: c_int = 0x00000001; pub const KEXEC_FILE_ON_CRASH: c_int = 0x00000002; pub const KEXEC_FILE_NO_INITRAMFS: c_int = 0x00000004; // linux/reboot.h -pub const LINUX_REBOOT_MAGIC1: c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC1: c_int = u32_cast_int(0xfee1dead); pub const LINUX_REBOOT_MAGIC2: c_int = 672274793; pub const LINUX_REBOOT_MAGIC2A: c_int = 85072278; pub const LINUX_REBOOT_MAGIC2B: c_int = 369367448; pub const LINUX_REBOOT_MAGIC2C: c_int = 537993216; pub const LINUX_REBOOT_CMD_RESTART: c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_HALT: c_int = u32_cast_int(0xCDEF0123); +pub const LINUX_REBOOT_CMD_CAD_ON: c_int = u32_cast_int(0x89ABCDEF); pub const LINUX_REBOOT_CMD_CAD_OFF: c_int = 0x00000000; pub const LINUX_REBOOT_CMD_POWER_OFF: c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_RESTART2: c_int = u32_cast_int(0xA1B2C3D4); +pub const LINUX_REBOOT_CMD_SW_SUSPEND: c_int = u32_cast_int(0xD000FCE2); pub const LINUX_REBOOT_CMD_KEXEC: c_int = 0x45584543; // linux/errqueue.h @@ -3496,7 +3496,7 @@ 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 _; +pub const PF_SUSPEND_TASK: c_int = u32_cast_int(PF_SUSPEND_TASK_UINT); // 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 @@ -3538,7 +3538,7 @@ pub const XDP_OPTIONS: c_int = 8; pub const XDP_OPTIONS_ZEROCOPY: crate::__u32 = 1 << 0; pub const XDP_PGOFF_RX_RING: crate::off_t = 0; -pub const XDP_PGOFF_TX_RING: crate::off_t = 0x80000000; +pub const XDP_PGOFF_TX_RING: crate::off_t = 0x80000000u32 as crate::off_t; pub const XDP_UMEM_PGOFF_FILL_RING: crate::c_ulonglong = 0x100000000; pub const XDP_UMEM_PGOFF_COMPLETION_RING: crate::c_ulonglong = 0x180000000; @@ -3570,7 +3570,7 @@ pub const SCHED_FLAG_ALL: c_int = SCHED_FLAG_RESET_ON_FORK // ioctl_eventpoll: added in Linux 6.9 pub const EPIOCSPARAMS: Ioctl = 0x40088a01; -pub const EPIOCGPARAMS: Ioctl = 0x80088a02; +pub const EPIOCGPARAMS: Ioctl = u32_cast_ioctl(0x80088a02); // siginfo.h pub const SI_DETHREAD: c_int = -7; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 6de4465ce4e3c..130c5022a045c 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -557,7 +557,7 @@ pub const F_WRLCK: c_int = 1; pub const F_UNLCK: c_int = 2; pub const SA_NODEFER: c_int = 0x40000000; -pub const SA_RESETHAND: c_int = 0x80000000; +pub const SA_RESETHAND: c_int = u32_cast_int(0x80000000); pub const SA_RESTART: c_int = 0x10000000; pub const SA_NOCLDSTOP: c_int = 0x00000001; diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index d50efafa0e777..e9a8cf49707e8 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -1125,7 +1125,7 @@ pub const PR_SET_MM_MAP: c_int = 14; pub const PR_SET_MM_MAP_SIZE: c_int = 15; pub const PR_SET_PTRACER: c_int = 0x59616d61; -pub const PR_SET_PTRACER_ANY: c_ulong = 0xffffffffffffffff; +pub const PR_SET_PTRACER_ANY: c_ulong = (-1 as c_long) as c_ulong; pub const PR_SET_CHILD_SUBREAPER: c_int = 36; pub const PR_GET_CHILD_SUBREAPER: c_int = 37; @@ -1425,6 +1425,7 @@ pub const NT_LWPSTATUS: c_int = 16; pub const NT_LWPSINFO: c_int = 17; pub const NT_PRFPXREG: c_int = 20; +#[allow(overflowing_literals)] // fixed in a future kernel version pub const MS_NOUSER: c_ulong = 0xffffffff80000000; f! { diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index bf041847f3e45..b30183eaaa038 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1158,7 +1158,7 @@ pub const CLONE_NEWIPC: c_int = 0x08000000; pub const CLONE_NEWUSER: c_int = 0x10000000; pub const CLONE_NEWPID: c_int = 0x20000000; pub const CLONE_NEWNET: c_int = 0x40000000; -pub const CLONE_IO: c_int = 0x80000000; +pub const CLONE_IO: c_int = u32_cast_int(0x80000000); pub const WNOHANG: c_int = 0x00000001; pub const WUNTRACED: c_int = 0x00000002; @@ -1206,7 +1206,7 @@ cfg_if! { pub const __WNOTHREAD: c_int = 0x20000000; pub const __WALL: c_int = 0x40000000; -pub const __WCLONE: c_int = 0x80000000; +pub const __WCLONE: c_int = u32_cast_int(0x80000000); pub const SPLICE_F_MOVE: c_uint = 0x01; pub const SPLICE_F_NONBLOCK: c_uint = 0x02; @@ -1536,8 +1536,8 @@ cfg_if! { pub const AFFS_SUPER_MAGIC: c_long = 0x0000adff; pub const AFS_SUPER_MAGIC: c_long = 0x5346414f; pub const AUTOFS_SUPER_MAGIC: c_long = 0x0187; - pub const BPF_FS_MAGIC: c_long = 0xcafe4a11; - pub const BTRFS_SUPER_MAGIC: c_long = 0x9123683e; + pub const BPF_FS_MAGIC: c_long = u32_cast_long(0xcafe4a11); + pub const BTRFS_SUPER_MAGIC: c_long = u32_cast_long(0x9123683e); pub const CGROUP2_SUPER_MAGIC: c_long = 0x63677270; pub const CGROUP_SUPER_MAGIC: c_long = 0x27e0eb; pub const CODA_SUPER_MAGIC: c_long = 0x73757245; @@ -1549,12 +1549,12 @@ cfg_if! { pub const EXT2_SUPER_MAGIC: c_long = 0x0000ef53; pub const EXT3_SUPER_MAGIC: c_long = 0x0000ef53; pub const EXT4_SUPER_MAGIC: c_long = 0x0000ef53; - pub const F2FS_SUPER_MAGIC: c_long = 0xf2f52010; + pub const F2FS_SUPER_MAGIC: c_long = u32_cast_long(0xf2f52010); pub const FUSE_SUPER_MAGIC: c_long = 0x65735546; pub const FUTEXFS_SUPER_MAGIC: c_long = 0xbad1dea; pub const HOSTFS_SUPER_MAGIC: c_long = 0x00c0ffee; - pub const HPFS_SUPER_MAGIC: c_long = 0xf995e849; - pub const HUGETLBFS_MAGIC: c_long = 0x958458f6; + pub const HPFS_SUPER_MAGIC: c_long = u32_cast_long(0xf995e849); + pub const HUGETLBFS_MAGIC: c_long = u32_cast_long(0x958458f6); pub const ISOFS_SUPER_MAGIC: c_long = 0x00009660; pub const JFFS2_SUPER_MAGIC: c_long = 0x000072b6; pub const MINIX2_SUPER_MAGIC2: c_long = 0x00002478; @@ -1575,7 +1575,7 @@ cfg_if! { pub const RDTGROUP_SUPER_MAGIC: c_long = 0x7655821; pub const REISERFS_SUPER_MAGIC: c_long = 0x52654973; pub const SECURITYFS_MAGIC: c_long = 0x73636673; - pub const SELINUX_MAGIC: c_long = 0xf97cff8c; + pub const SELINUX_MAGIC: c_long = u32_cast_long(0xf97cff8c); pub const SMACK_MAGIC: c_long = 0x43415d53; pub const SMB_SUPER_MAGIC: c_long = 0x0000517b; pub const SYSFS_MAGIC: c_long = 0x62656572; @@ -1583,7 +1583,7 @@ cfg_if! { pub const TRACEFS_MAGIC: c_long = 0x74726163; pub const UDF_SUPER_MAGIC: c_long = 0x15013346; pub const USBDEVICE_SUPER_MAGIC: c_long = 0x00009fa2; - pub const XENFS_SUPER_MAGIC: c_long = 0xabba1974; + pub const XENFS_SUPER_MAGIC: c_long = u32_cast_long(0xabba1974); pub const NSFS_MAGIC: c_long = 0x6e736673; } else if #[cfg(target_arch = "s390x")] { pub const ADFS_SUPER_MAGIC: c_uint = 0x0000adf5; @@ -1669,7 +1669,7 @@ cfg_if! { pub const STATX_ALL: c_uint = 0x0fff; pub const STATX_MNT_ID: c_uint = 0x1000; pub const STATX_DIOALIGN: c_uint = 0x2000; - pub const STATX__RESERVED: c_int = 0x80000000; + pub const STATX__RESERVED: c_int = u32_cast_int(0x80000000); pub const STATX_ATTR_COMPRESSED: c_int = 0x0004; pub const STATX_ATTR_IMMUTABLE: c_int = 0x0010; pub const STATX_ATTR_APPEND: c_int = 0x0020; diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index a14cc1afe1bee..ee6abccedfb6a 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -609,7 +609,7 @@ pub const SO_SETFIB: c_int = 0x1014; pub const SO_USER_COOKIE: c_int = 0x1015; pub const SO_PROTOCOL: c_int = 0x1016; pub const SO_PROTOTYPE: c_int = SO_PROTOCOL; -pub const SO_VENDOR: c_int = 0x80000000; +pub const SO_VENDOR: c_int = u32_cast_int(0x80000000); pub const SO_DEBUG: c_int = 0x01; pub const SO_ACCEPTCONN: c_int = 0x0002; pub const SO_REUSEADDR: c_int = 0x0004; diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 7ebfc2194bfb0..6c58bb7611d9d 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -953,7 +953,7 @@ cfg_if! { pub const FIONWRITE: c_int = 1074030201; pub const IFF_ACCEPTRTADV: c_int = 0x40000000; pub const IFF_IP6FORWARDING: c_int = 0x20000000; - pub const IFF_SHIM: c_int = 0x80000000; + pub const IFF_SHIM: c_int = u32_cast_int(0x80000000); pub const KERN_ARND: c_int = 81; pub const KERN_IOV_MAX: c_int = 38; pub const KERN_LOGSIGEXIT: c_int = 46; @@ -997,9 +997,9 @@ cfg_if! { pub const BIOCGETIF: c_int = 0x4020426b; pub const BIOCGSEESENT: c_int = 0x40044276; pub const BIOCGSTATS: c_int = 0x4008426f; - pub const BIOCSDLT: c_int = 0x80044278; - pub const BIOCSETIF: c_int = 0x8020426c; - pub const BIOCSSEESENT: c_int = 0x80044277; + pub const BIOCSDLT: c_int = u32_cast_int(0x80044278); + pub const BIOCSETIF: c_int = u32_cast_int(0x8020426c); + pub const BIOCSSEESENT: c_int = u32_cast_int(0x80044277); pub const KERN_ARND: c_int = 37; pub const KERN_IOV_MAX: c_int = 35; pub const KERN_LOGSIGEXIT: c_int = 34; @@ -1015,7 +1015,7 @@ cfg_if! { pub const PF_ARP: c_int = AF_ARP; pub const PF_NATM: c_int = AF_NATM; pub const pseudo_AF_HDRCMPLT: c_int = 31; - pub const SIOCGIFADDR: c_int = 0xc0206921; + pub const SIOCGIFADDR: c_int = u32_cast_int(0xc0206921); pub const SO_SETFIB: c_int = 0x1014; } } diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 797de99668153..3dd4e3b06b8ef 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -731,8 +731,8 @@ pub const S_IRWXO: c_int = 0o0007; pub const S_IROTH: c_int = 0o0004; pub const S_IWOTH: c_int = 0o0002; pub const S_IXOTH: c_int = 0o0001; -pub const UTIME_NOW: c_long = 0xffffffff; -pub const UTIME_OMIT: c_long = 0xfffffffe; +pub const UTIME_NOW: c_long = u32_cast_long(0xffffffff); +pub const UTIME_OMIT: c_long = u32_cast_long(0xfffffffe); // stdlib.h pub const EXIT_SUCCESS: c_int = 0; @@ -986,8 +986,7 @@ pub const WNOWAIT: c_int = 0x0100_0000; pub const __WNOTHREAD: c_int = 0x2000_0000; pub const __WALL: c_int = 0x4000_0000; -#[allow(overflowing_literals)] -pub const __WCLONE: c_int = 0x8000_0000; +pub const __WCLONE: c_int = u32_cast_int(0x8000_0000); // time.h pub const CLOCK_REALTIME: c_int = 1; diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 6f7cd958408b4..21ae99275ae7f 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -171,7 +171,7 @@ pub const EPOLLWRBAND: c_int = 0x200; pub const EPOLLMSG: c_int = 0x400; pub const EPOLLERR: c_int = 0x8; pub const EPOLLHUP: c_int = 0x10; -pub const EPOLLET: c_int = 0x80000000; +pub const EPOLLET: c_int = u32_cast_int(0x80000000); pub const EPOLLRDHUP: c_int = 0x2000; pub const EPOLLONESHOT: c_int = 0x40000000; pub const EPOLLWAKEUP: c_int = 0x20000000; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 5dcafd92e23b7..9c87e7dab9c32 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -839,9 +839,9 @@ pub const SS_DISABLE: c_int = 2; pub const FIOCLEX: c_int = 0x20006601; pub const FIONCLEX: c_int = 0x20006602; pub const FIONREAD: c_int = 0x4004667f; -pub const FIONBIO: c_int = 0x8004667e; -pub const FIOASYNC: c_int = 0x8004667d; -pub const FIOSETOWN: c_int = 0x8004667c; +pub const FIONBIO: c_int = u32_cast_int(0x8004667e); +pub const FIOASYNC: c_int = u32_cast_int(0x8004667d); +pub const FIOSETOWN: c_int = u32_cast_int(0x8004667c); pub const FIOGETOWN: c_int = 0x4004667b; pub const SIGCHLD: c_int = 18; @@ -1032,7 +1032,7 @@ pub const WSTOPPED: c_int = WUNTRACED; pub const WCONTINUED: c_int = 0x08; pub const WNOWAIT: c_int = 0x80; -pub const AT_FDCWD: c_int = 0xffd19553; +pub const AT_FDCWD: c_int = u32_cast_int(0xffd19553); pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1000; pub const AT_SYMLINK_FOLLOW: c_int = 0x2000; pub const AT_REMOVEDIR: c_int = 0x1; @@ -1536,8 +1536,8 @@ pub const IFF_NOFAILOVER: c_int = 0x0008000000; // in.mpathd test address pub const IFF_FAILED: c_int = 0x0010000000; // Interface has failed pub const IFF_STANDBY: c_int = 0x0020000000; // Interface is a hot-spare pub const IFF_INACTIVE: c_int = 0x0040000000; // Functioning but not used -pub const IFF_OFFLINE: c_int = 0x0080000000; // Interface is offline - // If CoS marking is supported +pub const IFF_OFFLINE: c_int = u32_cast_int(0x0080000000); // Interface is offline + // If CoS marking is supported pub const IFF_COS_ENABLED: c_longlong = 0x0200000000; pub const IFF_PREFERRED: c_longlong = 0x0400000000; // Prefer as source addr. pub const IFF_TEMPORARY: c_longlong = 0x0800000000; // RFC3041 diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index aab92c65c59a5..ee1d3017792b9 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -692,9 +692,9 @@ pub const TIMER_ABSTIME: c_int = 0x1; pub const TIMER_RELTIME: c_int = 0x0; // PTHREAD STUFF -pub const PTHREAD_INITIALIZED_OBJ: c_int = 0xF70990EF; +pub const PTHREAD_INITIALIZED_OBJ: c_int = u32_cast_int(0xF70990EF); pub const PTHREAD_DESTROYED_OBJ: c_int = -1; -pub const PTHREAD_VALID_OBJ: c_int = 0xEC542A37; +pub const PTHREAD_VALID_OBJ: c_int = u32_cast_int(0xEC542A37); pub const PTHREAD_INVALID_OBJ: c_int = -1; pub const PTHREAD_UNUSED_YET_OBJ: c_int = -1; @@ -1173,7 +1173,7 @@ pub const FIODISKCHANGE: c_int = 13; pub const FIOCANCEL: c_int = 14; pub const FIOSQUEEZE: c_int = 15; pub const FIOGETNAME: c_int = 18; -pub const FIONBIO: c_int = 0x90040010; +pub const FIONBIO: c_int = u32_cast_int(0x90040010); // limits.h pub const PATH_MAX: c_int = _PARM_PATH_MAX; @@ -1346,7 +1346,7 @@ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { }; const PTHREAD_CONDATTR_INITIALIZER: pthread_condattr_t = pthread_condattr_t { - condAttrStatus: 0xf70990ef, + condAttrStatus: u32_cast_int(0xf70990ef), condAttrPshared: 1, condAttrClockId: CLOCK_REALTIME, }; @@ -1434,7 +1434,7 @@ pub const MS_INVALIDATE: c_int = 0x0004; pub const MAP_FAILED: *mut c_void = !0 as *mut c_void; // sys/ttycom.h -pub const TIOCGWINSZ: c_int = 0x1740087468; +pub const TIOCGWINSZ: i64 = 0x1740087468; pub const TIOCSWINSZ: c_int = -0x7ff78b99; extern_ty! { diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 81de5f37b3f98..cfc5d70931417 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -270,8 +270,8 @@ pub const AT_EACCESS: c_int = 0x0; pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1; pub const AT_SYMLINK_FOLLOW: c_int = 0x2; pub const AT_REMOVEDIR: c_int = 0x4; -pub const UTIME_OMIT: c_long = 0xfffffffe; -pub const UTIME_NOW: c_long = 0xffffffff; +pub const UTIME_OMIT: c_long = u32_cast_long(0xfffffffe); +pub const UTIME_NOW: c_long = u32_cast_long(0xffffffff); pub const S_IFIFO: mode_t = 0o1_0000; pub const S_IFCHR: mode_t = 0o2_0000; pub const S_IFBLK: mode_t = 0o6_0000; From c184aac1a5720e10be232b65a0a6a7ca8789fc7c Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 25 Jun 2026 02:06:39 -0400 Subject: [PATCH 2/4] Update the global lint configuration * Don't completely ignore `overflowing_literals`. This is the main thing since this lint catches things like `u64`-sized constants being assigned to a `c_long`, which is too small on 32-bit platforms. * `safe_packed_borrows` is now a hard error, we don't need to explicitly set the level. * Drop `renamed_and_removed_lints` and `unknown_lints` since we are now more selective about tested versions. Closes: https://github.com/rust-lang/libc/issues/4141 --- .github/workflows/ci.yaml | 11 +++++++---- src/lib.rs | 38 +++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a7985a3990b8f..43caab3c9092a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -107,10 +107,13 @@ jobs: run: | set -eux if [ "${{ matrix.toolchain }}" = "1.65.0" ]; then - # Remove `-Dwarnings` at the MSRV since lints may be different, and allow - # `improper_ctypes` since pointers to ZSTs got the warning prior to 1.72. - # FIXME(msrv): remove this flag when possible. - export RUSTFLAGS="-Aimproper_ctypes" + # * Remove `-Dwarnings` at the MSRV since lints may be different + # * Allow `improper_ctypes` since pointers to ZSTs got the warning prior + # to 1.72. + # * Enable `unknown_lints` since we have some config not known at this + # version. + # FIXME(msrv): update this list when possible. + export RUSTFLAGS="-Aimproper_ctypes -Aunknown_lints" # Remove `ctest` which uses the 2024 edition perl -i -ne 'print unless /"ctest(-test)?",/ || /"libc-test",/' Cargo.toml fi diff --git a/src/lib.rs b/src/lib.rs index cd31f696fd1e5..5b422cb95ad35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -144,30 +144,26 @@ //! practice, breakage is rare and following the above-discussed [Usage Guidelines](#usage-guidelines) //! means that most `libc` users will never encounter a problem. +// Make it a bit easier to build without Cargo #![crate_name = "libc"] #![crate_type = "rlib"] -#![allow( - renamed_and_removed_lints, // Keep this order. - unknown_lints, // Keep this order. - nonstandard_style, - overflowing_literals, - unused_macros, - unused_macro_rules, -)] -#![warn( - missing_copy_implementations, - missing_debug_implementations, - safe_packed_borrows -)] -// Prepare for a future upgrade +// Pretty much all C API doesn't match Rust conventions. +#![allow(nonstandard_style)] +// Not all macros and all patterns are used on all targets. +#![allow(unused_macros)] +#![allow(unused_macro_rules)] +// All traits should be `Copy` and `Debug`. +#![warn(missing_copy_implementations)] +#![warn(missing_debug_implementations)] +// Downgrade deny to a warning. +#![warn(overflowing_literals)] +// Prepare for a future upgrade. #![warn(rust_2024_compatibility)] -// Things missing for 2024 that are blocked on MSRV or breakage -#![allow( - missing_unsafe_on_extern, - edition_2024_expr_fragment_specifier, - // Allowed globally, the warning is enabled in individual modules as we work through them - unsafe_op_in_unsafe_fn -)] +// Things missing for 2024 that are blocked on MSRV or breakage. +#![allow(missing_unsafe_on_extern)] +#![allow(edition_2024_expr_fragment_specifier)] +// Allowed globally, the warning is enabled in individual modules as we work through them +#![allow(unsafe_op_in_unsafe_fn)] #![cfg_attr(libc_deny_warnings, deny(warnings))] // Attributes needed when building as part of the standard library #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))] From 94feba3aef7d4d516bf4fc544b230a5b88051de1 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 25 Jun 2026 04:52:39 -0400 Subject: [PATCH 3/4] doc: Fix cases of `bare_urls` --- src/unix/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index c20a8e3751867..18156b29d1889 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -2243,13 +2243,13 @@ cfg_if! { all(target_os = "freebsd", not(any(freebsd11, freebsd10))), link_name = "readdir_r@FBSD_1.5" )] - #[allow(non_autolinks)] // FIXME(docs): `<>` breaks line length limit. /// The 64-bit libc on Solaris and illumos only has readdir_r. If a /// 32-bit Solaris or illumos target is ever created, it should use /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos: - /// https://illumos.org/man/3lib/libc - /// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html - /// https://www.unix.com/man-page/opensolaris/3LIB/libc/ + /// + /// * + /// * + /// * #[cfg_attr(gnu_file_offset_bits64, link_name = "readdir64_r")] pub fn readdir_r( dirp: *mut crate::DIR, From 72f7ae494a5e6f1b24935af17214625bab0bf0d6 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Thu, 25 Jun 2026 02:41:50 -0400 Subject: [PATCH 4/4] qurt: Remove extra parentheses --- src/new/qurt/limits.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/new/qurt/limits.rs b/src/new/qurt/limits.rs index fefe069c1c19f..2be05ef95d5d3 100644 --- a/src/new/qurt/limits.rs +++ b/src/new/qurt/limits.rs @@ -13,15 +13,15 @@ pub const UCHAR_MAX: c_uchar = 255; // Integer properties pub const INT_MAX: c_int = 2147483647; -pub const INT_MIN: c_int = (-2147483647 - 1); +pub const INT_MIN: c_int = -2147483647 - 1; pub const UINT_MAX: c_uint = 4294967295; pub const LONG_MAX: c_long = 2147483647; -pub const LONG_MIN: c_long = (-2147483647 - 1); +pub const LONG_MIN: c_long = -2147483647 - 1; pub const ULONG_MAX: c_ulong = 4294967295; pub const SHRT_MAX: c_short = 32767; -pub const SHRT_MIN: c_short = (-32768); +pub const SHRT_MIN: c_short = -32768; pub const USHRT_MAX: c_ushort = 65535; // POSIX Limits