diff --git a/.cirrus.yml b/.cirrus.yml index 93a4ad50a9594..656696c825752 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,20 +1,31 @@ task: only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BASE_BRANCH == 'libc-0.2' || $CIRRUS_BASE_BRANCH == 'main' + env: + HOME: /tmp # cargo cache needs it + TARGET: x86_64-unknown-freebsd matrix: - - name: nightly freebsd-13 + - name: nightly freebsd-13 i686 + # Test i686 FreeBSD in 32-bit emulation on a 64-bit host. + env: + TARGET: i686-unknown-freebsd freebsd_instance: image_family: freebsd-13-3 - - name: nightly freebsd-14 + - name: nightly freebsd-13 x86_64 freebsd_instance: - image: freebsd-14-0-release-amd64-ufs - - name: nightly freebsd-15 + image_family: freebsd-13-3 + - name: nightly freebsd-14 x86_64 + freebsd_instance: + image: freebsd-14-1-release-amd64-ufs + - name: nightly freebsd-15 x86_64 freebsd_instance: image_family: freebsd-15-0-snap setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh -y --default-toolchain nightly --profile=minimal + - . $HOME/.cargo/env + - if [ "$TARGET" = "i686-unknown-freebsd" ]; then rustup target add i686-unknown-freebsd; fi test_script: - . $HOME/.cargo/env - - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd - - sh ci/run.sh x86_64-unknown-freebsd + - LIBC_CI=1 sh ci/run.sh $TARGET + - sh ci/run.sh $TARGET diff --git a/ci/style.sh b/ci/style.sh index 7b4508a6524ff..c8d49e163de96 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -18,6 +18,9 @@ else exit 1 fi +# Ensure that `sort` output is not locale-dependent +export LC_ALL=C + for file in libc-test/semver/*.txt; do case "$file" in *TODO*) continue ;; diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index fc066c70affc6..36faea40179a5 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1911,7 +1911,6 @@ clock_getres clonefile clonefileat cmsghdr -confstr connectx copyfile copyfile_callback_t diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 9dcb5a6c8ca9f..e05d2c2fdbb8d 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -505,7 +505,8 @@ XSK_UNALIGNED_BUF_ADDR_MASK XSK_UNALIGNED_BUF_OFFSET_SHIFT _CS_GNU_LIBC_VERSION _CS_GNU_LIBPTHREAD_VERSION -_CS_PATH +_CS_V6_ENV +_CS_V7_ENV _SC_2_C_VERSION _SC_BASE _SC_CHARCLASS_NAME_MAX @@ -608,7 +609,6 @@ asctime_r backtrace clock_adjtime close_range -confstr copy_file_range ctermid ctime_r diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 646a7153d75c0..b307f90353ef0 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -60,6 +60,8 @@ XDP_USE_SG XDP_ZEROCOPY XSK_UNALIGNED_BUF_ADDR_MASK XSK_UNALIGNED_BUF_OFFSET_SHIFT +_CS_V6_ENV +_CS_V7_ENV adjtimex aio_cancel aio_error diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 89a90010ee4f1..5b0fca57b3e11 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3326,6 +3326,42 @@ XATTR_REPLACE XTABS YESEXPR YESSTR +_CS_PATH +_CS_POSIX_V5_WIDTH_RESTRICTED_ENVS +_CS_POSIX_V6_ILP32_OFF32_CFLAGS +_CS_POSIX_V6_ILP32_OFF32_LDFLAGS +_CS_POSIX_V6_ILP32_OFF32_LIBS +_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS +_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +_CS_POSIX_V6_ILP32_OFFBIG_LIBS +_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS +_CS_POSIX_V6_LP64_OFF64_CFLAGS +_CS_POSIX_V6_LP64_OFF64_LDFLAGS +_CS_POSIX_V6_LP64_OFF64_LIBS +_CS_POSIX_V6_LP64_OFF64_LINTFLAGS +_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +_CS_POSIX_V6_LPBIG_OFFBIG_LIBS +_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS +_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +_CS_POSIX_V7_ILP32_OFF32_CFLAGS +_CS_POSIX_V7_ILP32_OFF32_LDFLAGS +_CS_POSIX_V7_ILP32_OFF32_LIBS +_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS +_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS +_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS +_CS_POSIX_V7_ILP32_OFFBIG_LIBS +_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS +_CS_POSIX_V7_LP64_OFF64_CFLAGS +_CS_POSIX_V7_LP64_OFF64_LDFLAGS +_CS_POSIX_V7_LP64_OFF64_LIBS +_CS_POSIX_V7_LP64_OFF64_LINTFLAGS +_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS +_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS +_CS_POSIX_V7_LPBIG_OFFBIG_LIBS +_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS +_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _IOFBF _IOLBF _IONBF diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 3470f1f2de160..7f750ecae3a19 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -492,6 +492,7 @@ clockid_t close closedir closelog +confstr connect creat dev_t diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 6769b700bc4fd..c6dd20cfd4eb6 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5657,11 +5657,6 @@ extern "C" { pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int; pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "confstr$UNIX2003" - )] - pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t; pub fn lio_listio( mode: ::c_int, aiocb_list: *const *mut aiocb, diff --git a/src/unix/hurd/align.rs b/src/unix/hurd/align.rs deleted file mode 100644 index 1dd7d8e541d29..0000000000000 --- a/src/unix/hurd/align.rs +++ /dev/null @@ -1 +0,0 @@ -// Placeholder file diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 97e783f3c3aa6..453d0392daf72 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -72,7 +72,6 @@ pub type __ptrdiff_t = __sword_type; pub type __socklen_t = __u32_type; pub type __sig_atomic_t = ::c_int; pub type __time64_t = __int64_t; -pub type ssize_t = __ssize_t; pub type wchar_t = ::c_int; pub type wint_t = ::c_uint; pub type gid_t = __gid_t; @@ -4676,16 +4675,6 @@ safe_f! { } } -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } else { - mod no_align; - pub use self::no_align::*; - } -} - cfg_if! { if #[cfg(target_pointer_width = "64")] { mod b64; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 39bb5dc56ad75..3277ec5d26e48 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -886,7 +886,8 @@ pub const FILENAME_MAX: ::c_uint = 4096; pub const POSIX_MADV_DONTNEED: ::c_int = 4; pub const _CS_GNU_LIBC_VERSION: ::c_int = 2; pub const _CS_GNU_LIBPTHREAD_VERSION: ::c_int = 3; -pub const _CS_PATH: ::c_int = 0; +pub const _CS_V6_ENV: ::c_int = 1148; +pub const _CS_V7_ENV: ::c_int = 1149; pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; pub const _SC_PII: ::c_int = 53; @@ -1533,7 +1534,6 @@ extern "C" { pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char; - pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t; pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; /// POSIX version of `basename(3)`, defined in `libgen.h`. #[link_name = "__xpg_basename"] diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 4bfe41d6469d5..4ec30dc15ec5c 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1812,6 +1812,43 @@ pub const _SC_XOPEN_STREAMS: ::c_int = 246; pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247; pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248; +pub const _CS_PATH: ::c_int = 0; +pub const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: ::c_int = 1; +pub const _CS_POSIX_V5_WIDTH_RESTRICTED_ENVS: ::c_int = 4; +pub const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: ::c_int = 5; +pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: ::c_int = 1116; +pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: ::c_int = 1117; +pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: ::c_int = 1118; +pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: ::c_int = 1119; +pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: ::c_int = 1120; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: ::c_int = 1121; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: ::c_int = 1122; +pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: ::c_int = 1123; +pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: ::c_int = 1124; +pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: ::c_int = 1125; +pub const _CS_POSIX_V6_LP64_OFF64_LIBS: ::c_int = 1126; +pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: ::c_int = 1127; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: ::c_int = 1128; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1129; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: ::c_int = 1130; +pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: ::c_int = 1131; +pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: ::c_int = 1132; +pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: ::c_int = 1133; +pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: ::c_int = 1134; +pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: ::c_int = 1135; +pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: ::c_int = 1136; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: ::c_int = 1137; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: ::c_int = 1138; +pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: ::c_int = 1139; +pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: ::c_int = 1140; +pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: ::c_int = 1141; +pub const _CS_POSIX_V7_LP64_OFF64_LIBS: ::c_int = 1142; +pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: ::c_int = 1143; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: ::c_int = 1144; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1145; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: ::c_int = 1146; +pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: ::c_int = 1147; + pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY; pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 14e1e6d3bfd0f..e450385123571 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -899,6 +899,9 @@ pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_O pub const XDP_PKT_CONTD: ::__u32 = 1 << 0; +pub const _CS_V6_ENV: ::c_int = 1148; +pub const _CS_V7_ENV: ::c_int = 1149; + cfg_if! { if #[cfg(target_arch = "s390x")] { pub const POSIX_FADV_DONTNEED: ::c_int = 6; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index d26d9053558ee..11a2491b2c4c7 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1485,6 +1485,18 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(target_os = "android"))] { + extern "C" { + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "confstr$UNIX2003" + )] + pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t; + } + } +} + cfg_if! { if #[cfg(not(target_os = "aix"))] { extern "C" {