diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 04887c24ac9ce..038056f7ae9dd 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1818,7 +1818,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 b2aa9e81845f0..83dd825584cd0 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 c2fd78177433c..62b188dac8288 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 b74bb17999b43..ced3f2b751508 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3369,6 +3369,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 1f32b8990be27..093dde173137c 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -493,6 +493,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 b90e90136ebdb..ebf196de1752a 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -5599,11 +5599,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/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 552b95329c0ee..f68efbe85bbf5 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -877,7 +877,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; @@ -1525,7 +1526,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 7253ee934ea90..9401949b4f124 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -2027,6 +2027,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 9ca6c6c814e34..bfdbb0f0bad59 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -895,6 +895,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 cdfb9a5c68f14..0b2e877ed43eb 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1478,6 +1478,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" {