Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.2] Backports #4032

Merged
merged 5 commits into from
Nov 13, 2024
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
23 changes: 17 additions & 6 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,6 @@ clock_getres
clonefile
clonefileat
cmsghdr
confstr
connectx
copyfile
copyfile_callback_t
Expand Down
4 changes: 2 additions & 2 deletions libc-test/semver/linux-gnu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -608,7 +609,6 @@ asctime_r
backtrace
clock_adjtime
close_range
confstr
copy_file_range
ctermid
ctime_r
Expand Down
2 changes: 2 additions & 0 deletions libc-test/semver/linux-musl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ clockid_t
close
closedir
closelog
confstr
connect
creat
dev_t
Expand Down
5 changes: 0 additions & 5 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/unix/hurd/align.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/linux_like/linux/gnu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"]
Expand Down
37 changes: 37 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down