Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish_0.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
});
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/aix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,7 @@ sigismember
signal
sigpending
sigprocmask
sigqueue
sigset_t
sigsuspend
sigtimedwait
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3985,6 +3985,7 @@ signalfd
signalfd_siginfo
sigpending
sigprocmask
sigqueue
sigset64_t
sigset_t
sigsuspend
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,7 @@ ptrace
pututxline
pwritev
qsort
qsort_r
querylocale
quotactl
radvisory
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/cygwin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ settimeofday
sigaltstack
sigevent
siginfo_t
sigqueue
sigsuspend
sigtimedwait
sigwait
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/freebsd-x86_64.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Elf64_Auxinfo
KINFO_FILE_SIZE
MAP_32BIT
_MC_FLAG_MASK
_MC_FPFMT_NODEV
_MC_FPFMT_XMM
_MC_FPOWNED_FPU
Expand Down
4 changes: 2 additions & 2 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2249,6 +2247,7 @@ ptsname_r
pututxline
pwritev
qsort
qsort_r
querylocale
rallocx
rand
Expand Down Expand Up @@ -2376,6 +2375,7 @@ shmid_ds
sigaltstack
sigevent
siginfo_t
sigqueue
sigsuspend
sigtimedwait
sigwait
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4298,6 +4298,7 @@ sigevent
siginfo_t
signalfd
signalfd_siginfo
sigqueue
sigsuspend
sigtimedwait
sigwait
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,7 @@ ptrace_siginfo
pututxline
pwritev
qsort
qsort_r
rand
readdir_r
readlinkat
Expand Down Expand Up @@ -1599,6 +1600,7 @@ shmid_ds
sigaltstack
sigevent
siginfo_t
sigqueue
sigsuspend
sigtimedwait
sigwait
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/redox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ setgrent
setpwent
setrlimit
setservent
sigqueue
sigtimedwait
sigwait
strcasecmp
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ posix_spawnattr_setsigmask
posix_spawnp
recvmsg
sendmsg
sigqueue
strftime
strftime_l
2 changes: 2 additions & 0 deletions libc-test/semver/windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ putchar
putenv
putenv_s
puts
qsort
qsort_s
raise
rand
read
Expand Down
3 changes: 0 additions & 3 deletions src/new/linux_uapi/linux/can.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down
64 changes: 0 additions & 64 deletions src/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
8 changes: 8 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
);
}

#[allow(deprecated)]
Expand Down
12 changes: 12 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
);
}

cfg_if! {
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
);
}

cfg_if! {
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*mut c_void, *const c_void, *const c_void) -> c_int>,
);
}

#[link(name = "kvm")]
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
arg: *mut c_void,
);
}

#[link(name = "kvm")]
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
arg: *mut c_void,
);
}

#[link(name = "kvm")]
Expand Down
2 changes: 0 additions & 2 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsafe extern "C" fn(*const c_void, *const c_void, *mut c_void) -> c_int>,
arg: *mut c_void,
);
}

#[link(name = "rt")]
Expand Down
11 changes: 4 additions & 7 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading