Skip to content

Commit 6469c63

Browse files
committed
Support confstr on Linux
1 parent 9e5ecb6 commit 6469c63

File tree

8 files changed

+73
-6
lines changed

8 files changed

+73
-6
lines changed

libc-test/semver/apple.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,6 @@ clock_getres
18641864
clonefile
18651865
clonefileat
18661866
cmsghdr
1867-
confstr
18681867
connectx
18691868
copyfile
18701869
copyfile_callback_t

libc-test/semver/linux-musl.txt

+2
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ XDP_UMEM_PGOFF_COMPLETION_RING
5252
XSK_UNALIGNED_BUF_OFFSET_SHIFT
5353
XSK_UNALIGNED_BUF_ADDR_MASK
5454
XDP_PKT_CONTD
55+
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
56+
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
5557
adjtimex
5658
aio_cancel
5759
aio_error

libc-test/semver/linux.txt

+27
Original file line numberDiff line numberDiff line change
@@ -3234,6 +3234,33 @@ XATTR_REPLACE
32343234
XTABS
32353235
YESEXPR
32363236
YESSTR
3237+
_CS_PATH
3238+
_CS_POSIX_V6_ILP32_OFF32_CFLAGS
3239+
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
3240+
_CS_POSIX_V6_ILP32_OFF32_LIBS
3241+
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
3242+
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
3243+
_CS_POSIX_V6_ILP32_OFFBIG_LIBS
3244+
_CS_POSIX_V6_LP64_OFF64_CFLAGS
3245+
_CS_POSIX_V6_LP64_OFF64_LDFLAGS
3246+
_CS_POSIX_V6_LP64_OFF64_LIBS
3247+
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
3248+
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
3249+
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
3250+
_CS_POSIX_V7_ILP32_OFF32_CFLAGS
3251+
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
3252+
_CS_POSIX_V7_ILP32_OFF32_LIBS
3253+
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
3254+
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
3255+
_CS_POSIX_V7_ILP32_OFFBIG_LIBS
3256+
_CS_POSIX_V7_LP64_OFF64_CFLAGS
3257+
_CS_POSIX_V7_LP64_OFF64_LDFLAGS
3258+
_CS_POSIX_V7_LP64_OFF64_LIBS
3259+
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
3260+
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
3261+
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
3262+
_CS_V6_ENV
3263+
_CS_V7_ENV
32373264
_IOFBF
32383265
_IOLBF
32393266
_IONBF

libc-test/semver/unix.txt

+1
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ clockid_t
489489
close
490490
closedir
491491
closelog
492+
confstr
492493
connect
493494
creat
494495
dev_t

src/unix/bsd/apple/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -5640,11 +5640,6 @@ extern "C" {
56405640
pub fn fchflags(fd: ::c_int, flags: ::c_uint) -> ::c_int;
56415641
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
56425642
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
5643-
#[cfg_attr(
5644-
all(target_os = "macos", target_arch = "x86"),
5645-
link_name = "confstr$UNIX2003"
5646-
)]
5647-
pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t;
56485643
pub fn lio_listio(
56495644
mode: ::c_int,
56505645
aiocb_list: *const *mut aiocb,

src/unix/linux_like/linux/mod.rs

+28
Original file line numberDiff line numberDiff line change
@@ -1634,6 +1634,34 @@ pub const _SC_XOPEN_STREAMS: ::c_int = 246;
16341634
pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
16351635
pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
16361636

1637+
pub const _CS_PATH: ::c_int = 0;
1638+
pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: ::c_int = 1116;
1639+
pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: ::c_int = 1117;
1640+
pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: ::c_int = 1118;
1641+
pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: ::c_int = 1120;
1642+
pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: ::c_int = 1121;
1643+
pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: ::c_int = 1122;
1644+
pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: ::c_int = 1124;
1645+
pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: ::c_int = 1125;
1646+
pub const _CS_POSIX_V6_LP64_OFF64_LIBS: ::c_int = 1126;
1647+
pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: ::c_int = 1128;
1648+
pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1129;
1649+
pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: ::c_int = 1130;
1650+
pub const _CS_V6_ENV: ::c_int = 1148;
1651+
pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: ::c_int = 1132;
1652+
pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: ::c_int = 1133;
1653+
pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: ::c_int = 1134;
1654+
pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: ::c_int = 1136;
1655+
pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: ::c_int = 1137;
1656+
pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: ::c_int = 1138;
1657+
pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: ::c_int = 1140;
1658+
pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: ::c_int = 1141;
1659+
pub const _CS_POSIX_V7_LP64_OFF64_LIBS: ::c_int = 1142;
1660+
pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: ::c_int = 1144;
1661+
pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1145;
1662+
pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: ::c_int = 1146;
1663+
pub const _CS_V7_ENV: ::c_int = 1149;
1664+
16371665
pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
16381666
pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
16391667

src/unix/linux_like/linux/musl/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,9 @@ pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_O
820820

821821
pub const XDP_PKT_CONTD: ::__u32 = 1 << 0;
822822

823+
pub const _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS: ::c_int = 1;
824+
pub const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: ::c_int = 5;
825+
823826
cfg_if! {
824827
if #[cfg(target_arch = "s390x")] {
825828
pub const POSIX_FADV_DONTNEED: ::c_int = 6;

src/unix/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,18 @@ cfg_if! {
14231423
}
14241424
}
14251425

1426+
cfg_if! {
1427+
if #[cfg(not(target_os = "android"))] {
1428+
extern "C" {
1429+
#[cfg_attr(
1430+
all(target_os = "macos", target_arch = "x86"),
1431+
link_name = "confstr$UNIX2003"
1432+
)]
1433+
pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t;
1434+
}
1435+
}
1436+
}
1437+
14261438
cfg_if! {
14271439
if #[cfg(not(target_os = "aix"))] {
14281440
extern "C" {

0 commit comments

Comments
 (0)