diff --git a/.cirrus.yml b/.cirrus.yml index fb627124e5b67..8caefcbb28a12 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -21,7 +21,7 @@ task: image: freebsd-14-3-release-amd64-ufs - name: nightly freebsd-15 x86_64 freebsd_instance: - image_family: freebsd-15-0-snap + image: freebsd-15-0-alpha3-amd64-ufs setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/.github/workflows/publish_0.2.yml b/.github/workflows/publish_0.2.yml index 5ad1e97e1c1dc..00d5a7792a548 100644 --- a/.github/workflows/publish_0.2.yml +++ b/.github/workflows/publish_0.2.yml @@ -27,3 +27,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + with: + # FIXME(release): release-pr is broken since we have two release tracks for + # `libc` :( + command: release diff --git a/libc-test/build.rs b/libc-test/build.rs index 53c2b2ad6f549..abf5da9cee334 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2832,6 +2832,9 @@ fn test_freebsd(target: &str) { // Added in FreeBSD 14.2 "SO_SPLICE" if Some(14) > freebsd_ver => true, + // FIXME(deprecated): deprecated in 0.2, removed in main + "TIOCMGDTRWAIT" | "TIOCMSDTRWAIT" => true, + _ => false, } }); diff --git a/libc-test/semver/aix.txt b/libc-test/semver/aix.txt index c8e0fe1c0d3e7..ac82c5576f34c 100644 --- a/libc-test/semver/aix.txt +++ b/libc-test/semver/aix.txt @@ -2473,6 +2473,7 @@ sigismember signal sigpending sigprocmask +sigqueue sigset_t sigsuspend sigtimedwait diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 96c77cb43c5ef..53ab742cf2a6a 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -3985,6 +3985,7 @@ signalfd signalfd_siginfo sigpending sigprocmask +sigqueue sigset64_t sigset_t sigsuspend diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 33f3682d36262..9301252dcc949 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -2231,6 +2231,7 @@ ptrace pututxline pwritev qsort +qsort_r querylocale quotactl radvisory diff --git a/libc-test/semver/cygwin.txt b/libc-test/semver/cygwin.txt index 99e822ca62d18..a978f7312d9c3 100644 --- a/libc-test/semver/cygwin.txt +++ b/libc-test/semver/cygwin.txt @@ -844,6 +844,7 @@ settimeofday sigaltstack sigevent siginfo_t +sigqueue sigsuspend sigtimedwait sigwait diff --git a/libc-test/semver/freebsd-x86_64.txt b/libc-test/semver/freebsd-x86_64.txt index 14ddc25a1b254..a785644bd5cd2 100644 --- a/libc-test/semver/freebsd-x86_64.txt +++ b/libc-test/semver/freebsd-x86_64.txt @@ -1,7 +1,6 @@ Elf64_Auxinfo KINFO_FILE_SIZE MAP_32BIT -_MC_FLAG_MASK _MC_FPFMT_NODEV _MC_FPFMT_XMM _MC_FPOWNED_FPU diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 8150c6ae66913..74ea7dad541e0 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -683,8 +683,6 @@ JAIL_API_VERSION JAIL_ATTACH JAIL_CREATE JAIL_DYING -JAIL_GET_MASK -JAIL_SET_MASK JAIL_SYS_DISABLE JAIL_SYS_INHERIT JAIL_SYS_NEW @@ -2249,6 +2247,7 @@ ptsname_r pututxline pwritev qsort +qsort_r querylocale rallocx rand @@ -2376,6 +2375,7 @@ shmid_ds sigaltstack sigevent siginfo_t +sigqueue sigsuspend sigtimedwait sigwait diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index b82f33365a3d5..318cca51b482e 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -4298,6 +4298,7 @@ sigevent siginfo_t signalfd signalfd_siginfo +sigqueue sigsuspend sigtimedwait sigwait diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 3f7fb66c2efc8..4280ec02de730 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1536,6 +1536,7 @@ ptrace_siginfo pututxline pwritev qsort +qsort_r rand readdir_r readlinkat @@ -1599,6 +1600,7 @@ shmid_ds sigaltstack sigevent siginfo_t +sigqueue sigsuspend sigtimedwait sigwait diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 3e09870a7a76a..eeba3a35a54ce 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -307,6 +307,7 @@ setgrent setpwent setrlimit setservent +sigqueue sigtimedwait sigwait strcasecmp diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index cee5977fc35ee..9b1931c5a24f4 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -75,5 +75,6 @@ posix_spawnattr_setsigmask posix_spawnp recvmsg sendmsg +sigqueue strftime strftime_l diff --git a/libc-test/semver/windows.txt b/libc-test/semver/windows.txt index 281a13bb73034..a91794bed52ef 100644 --- a/libc-test/semver/windows.txt +++ b/libc-test/semver/windows.txt @@ -275,6 +275,8 @@ putchar putenv putenv_s puts +qsort +qsort_s raise rand read diff --git a/src/new/linux_uapi/linux/can.rs b/src/new/linux_uapi/linux/can.rs index 8e48b4a869bb8..b9479a63bacea 100644 --- a/src/new/linux_uapi/linux/can.rs +++ b/src/new/linux_uapi/linux/can.rs @@ -1,9 +1,6 @@ //! Header: `uapi/linux/can.h` -// FIXME(ctest): we shouldn't have to specify the path but garando doesn't find modules otherwise -#[path = "can/j1939.rs"] pub(crate) mod j1939; -#[path = "can/raw.rs"] pub(crate) mod raw; pub use j1939::*; diff --git a/src/primitives.rs b/src/primitives.rs index 307a5dafaa9cb..cec4f96f86eed 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -90,35 +90,6 @@ pub type uint64_t = u64; cfg_if! { if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] { - // This introduces partial support for FFI with __int128 and - // equivalent types on platforms where Rust's definition is validated - // to match the standard C ABI of that platform. - // - // Rust does not guarantee u128/i128 are sound for FFI, and its - // definitions are in fact known to be incompatible. [0] - // - // However these problems aren't fundamental, and are just platform - // inconsistencies. Specifically at the time of this writing: - // - // * For x64 SysV ABIs (everything but Windows), the types are underaligned. - // * For all Windows ABIs, Microsoft doesn't actually officially define __int128, - // and as a result different implementations don't actually agree on its ABI. - // - // But on the other major aarch64 platforms (android, linux, ios, macos) we have - // validated that rustc has the right ABI for these types. This is important because - // aarch64 uses these types in some fundamental OS types like user_fpsimd_struct, - // which represents saved simd registers. - // - // Any API which uses these types will need to `#[ignore(improper_ctypes)]` - // until the upstream rust issue is resolved, but this at least lets us make - // progress on platforms where this type is important. - // - // The list of supported architectures and OSes is intentionally very restricted, - // as careful work needs to be done to verify that a particular platform - // has a conformant ABI. - // - // [0]: https://github.com/rust-lang/rust/issues/54341 - /// C `__int128` (a GCC extension that's part of many ABIs) pub type __int128 = i128; /// C `unsigned __int128` (a GCC extension that's part of many ABIs) @@ -127,40 +98,5 @@ cfg_if! { pub type __int128_t = i128; /// C __uint128_t (alternate name for [__uint128][]) pub type __uint128_t = u128; - - // NOTE: if you add more platforms to here, you may need to cfg - // these consts. They should always match the platform's values - // for `sizeof(__int128)` and `_Alignof(__int128)`. - const _SIZE_128: usize = 16; - const _ALIGN_128: usize = 16; - - // FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily - // disabled. - // macro_rules! static_assert_eq { - // ($a:expr, $b:expr) => { - // const _: [(); $a] = [(); $b]; - // }; - // } - // - // // Since Rust doesn't officially guarantee that these types - // // have compatible ABIs, we const assert that these values have the - // // known size/align of the target platform's libc. If rustc ever - // // tries to regress things, it will cause a compilation error. - // // - // // This isn't a bullet-proof solution because e.g. it doesn't - // // catch the fact that llvm and gcc disagree on how x64 __int128 - // // is actually *passed* on the stack (clang underaligns it for - // // the same reason that rustc *never* properly aligns it). - // static_assert_eq!(size_of::<__int128>(), _SIZE_128); - // static_assert_eq!(align_of::<__int128>(), _ALIGN_128); - - // static_assert_eq!(size_of::<__uint128>(), _SIZE_128); - // static_assert_eq!(align_of::<__uint128>(), _ALIGN_128); - - // static_assert_eq!(size_of::<__int128_t>(), _SIZE_128); - // static_assert_eq!(align_of::<__int128_t>(), _ALIGN_128); - - // static_assert_eq!(size_of::<__uint128_t>(), _SIZE_128); - // static_assert_eq!(align_of::<__uint128_t>(), _ALIGN_128); } } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index a4e0a4c7c9424..0729c0db1e7dd 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -6157,6 +6157,14 @@ extern "C" { search_path: *const c_char, argv: *const *mut c_char, ) -> c_int; + + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + arg: *mut c_void, + compar: Option c_int>, + ); } #[allow(deprecated)] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs index 9705e300bd9ac..64949e5f0daeb 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs @@ -424,6 +424,18 @@ extern "C" { // in FreeBSD 12 pub fn dirname(path: *const c_char) -> *mut c_char; pub fn basename(path: *const c_char) -> *mut c_char; + + // Argument order of the function pointer changed in FreeBSD 14. From 14 onwards the signature + // matches the POSIX specification by having the third argument be a mutable pointer, on + // earlier versions the first argument is the mutable pointer. + #[link_name = "qsort_r@FBSD_1.0"] + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + arg: *mut c_void, + compar: Option c_int>, + ); } cfg_if! { diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 005b26894cc81..ab7d3fb41317e 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -468,6 +468,15 @@ extern "C" { pub fn dirname(path: *mut c_char) -> *mut c_char; pub fn basename(path: *mut c_char) -> *mut c_char; + + #[link_name = "qsort_r@FBSD_1.0"] + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + arg: *mut c_void, + compar: Option c_int>, + ); } cfg_if! { diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 5c40a355fb95b..ff55933938f54 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -507,6 +507,15 @@ extern "C" { pub fn dirname(path: *mut c_char) -> *mut c_char; pub fn basename(path: *mut c_char) -> *mut c_char; + + #[link_name = "qsort_r@FBSD_1.0"] + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + arg: *mut c_void, + compar: Option c_int>, + ); } #[link(name = "kvm")] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs index 4a65d59d5f3b1..3f23f05f5907f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs @@ -509,6 +509,14 @@ extern "C" { pub fn dirname(path: *mut c_char) -> *mut c_char; pub fn basename(path: *mut c_char) -> *mut c_char; + + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + compar: Option c_int>, + arg: *mut c_void, + ); } #[link(name = "kvm")] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs index 778c5ee018e34..cc8d895331f0c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs @@ -511,6 +511,14 @@ extern "C" { pub fn dirname(path: *mut c_char) -> *mut c_char; pub fn basename(path: *mut c_char) -> *mut c_char; + + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + compar: Option c_int>, + arg: *mut c_void, + ); } #[link(name = "kvm")] diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 54a9ec5ab546f..a23eee3b8bb16 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -2950,8 +2950,6 @@ pub const JAIL_CREATE: c_int = 0x01; pub const JAIL_UPDATE: c_int = 0x02; pub const JAIL_ATTACH: c_int = 0x04; pub const JAIL_DYING: c_int = 0x08; -pub const JAIL_SET_MASK: c_int = 0x0f; -pub const JAIL_GET_MASK: c_int = 0x08; pub const JAIL_SYS_DISABLE: c_int = 0; pub const JAIL_SYS_NEW: c_int = 1; pub const JAIL_SYS_INHERIT: c_int = 2; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index a488f61adcf00..d665e3da01e87 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -334,7 +334,6 @@ pub const MINSIGSTKSZ: size_t = 2048; // 512 * 4 pub const _MC_HASSEGS: u32 = 0x1; pub const _MC_HASBASES: u32 = 0x2; pub const _MC_HASFPXSTATE: u32 = 0x4; -pub const _MC_FLAG_MASK: u32 = _MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE; pub const _MC_FPFMT_NODEV: c_long = 0x10000; pub const _MC_FPFMT_XMM: c_long = 0x10002; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index d093847f8983e..713f44fabbdd8 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1238,7 +1238,15 @@ pub const TIOCGETD: c_ulong = 0x4004741a; pub const TIOCSETD: c_ulong = 0x8004741b; pub const TIOCGDRAINWAIT: c_ulong = 0x40047456; pub const TIOCSDRAINWAIT: c_ulong = 0x80047457; +#[cfg_attr( + not(target_os = "dragonfly"), + deprecated = "unused since FreeBSD 8, removed in FreeBSD 15" +)] pub const TIOCMGDTRWAIT: c_ulong = 0x4004745a; +#[cfg_attr( + not(target_os = "dragonfly"), + deprecated = "unused since FreeBSD 8, removed in FreeBSD 15" +)] pub const TIOCMSDTRWAIT: c_ulong = 0x8004745b; pub const TIOCDRAIN: c_ulong = 0x2000745e; pub const TIOCEXT: c_ulong = 0x80047460; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 57549d01236e9..5975cbad4f0ed 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2761,6 +2761,14 @@ extern "C" { new_value: *const itimerspec, old_value: *mut itimerspec, ) -> c_int; + + pub fn qsort_r( + base: *mut c_void, + num: size_t, + size: size_t, + compar: Option c_int>, + arg: *mut c_void, + ); } #[link(name = "rt")] diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 5a6dd61f53566..29f13fb37313e 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1746,13 +1746,10 @@ cfg_if! { /// Build an ioctl number, analogous to the C macro of the same name. const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> Ioctl { - // FIXME(ctest) the `garando_syntax` crate (used by ctest in the CI test suite) - // cannot currently parse these `debug_assert!`s - // - // debug_assert!(dir <= _IOC_DIRMASK); - // debug_assert!(ty <= _IOC_TYPEMASK); - // debug_assert!(nr <= _IOC_NRMASK); - // debug_assert!(size <= (_IOC_SIZEMASK as usize)); + core::debug_assert!(dir <= _IOC_DIRMASK); + core::debug_assert!(ty <= _IOC_TYPEMASK); + core::debug_assert!(nr <= _IOC_NRMASK); + core::debug_assert!(size <= (_IOC_SIZEMASK as usize)); ((dir << _IOC_DIRSHIFT) | (ty << _IOC_TYPESHIFT) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 941f2faa99217..b3ac89e9a889e 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1661,6 +1661,20 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(any( + target_os = "dragonfly", + target_os = "emscripten", + target_os = "hurd", + target_os = "macos", + target_os = "openbsd", + )))] { + extern "C" { + pub fn sigqueue(pid: pid_t, sig: c_int, value: crate::sigval) -> c_int; + } + } +} + cfg_if! { if #[cfg(not(target_os = "android"))] { extern "C" { @@ -1731,6 +1745,10 @@ cfg_if! { all(target_os = "freebsd", any(freebsd11, freebsd10)), link_name = "readdir_r@FBSD_1.0" )] + #[cfg_attr( + 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 diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index d9502386dcae8..42c534c949fa9 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -29,8 +29,8 @@ pub type tcflag_t = u32; pub type time_t = c_longlong; pub type id_t = c_uint; pub type pid_t = usize; -pub type uid_t = u32; -pub type gid_t = u32; +pub type uid_t = c_int; +pub type gid_t = c_int; #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} diff --git a/src/windows/mod.rs b/src/windows/mod.rs index 5cafc855f78a0..2703729fac5bf 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -297,6 +297,19 @@ extern "C" { pub fn isblank(c: c_int) -> c_int; pub fn tolower(c: c_int) -> c_int; pub fn toupper(c: c_int) -> c_int; + pub fn qsort( + base: *mut c_void, + num: size_t, + size: size_t, + compar: Option c_int>, + ); + pub fn qsort_s( + base: *mut c_void, + num: size_t, + size: size_t, + compar: Option c_int>, + arg: *mut c_void, + ); pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE; pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE; pub fn fflush(file: *mut FILE) -> c_int;