Skip to content

Commit

Permalink
Support confstr on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
magicant committed May 1, 2024
1 parent 3939453 commit 2d6c7a6
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 6 deletions.
1 change: 0 additions & 1 deletion libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,6 @@ clock_getres
clonefile
clonefileat
cmsghdr
confstr
connectx
copyfile
copyfile_callback_t
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 @@ -47,6 +47,8 @@ XDP_UMEM_PGOFF_COMPLETION_RING
XSK_UNALIGNED_BUF_OFFSET_SHIFT
XSK_UNALIGNED_BUF_ADDR_MASK
XDP_PKT_CONTD
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS
adjtimex
aio_cancel
aio_error
Expand Down
27 changes: 27 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3233,6 +3233,33 @@ XATTR_REPLACE
XTABS
YESEXPR
YESSTR
_CS_PATH
_CS_POSIX_V6_ILP32_OFF32_CFLAGS
_CS_POSIX_V6_ILP32_OFF32_LDFLAGS
_CS_POSIX_V6_ILP32_OFF32_LIBS
_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
_CS_POSIX_V6_ILP32_OFFBIG_LIBS
_CS_POSIX_V6_LP64_OFF64_CFLAGS
_CS_POSIX_V6_LP64_OFF64_LDFLAGS
_CS_POSIX_V6_LP64_OFF64_LIBS
_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V6_LPBIG_OFFBIG_LIBS
_CS_POSIX_V7_ILP32_OFF32_CFLAGS
_CS_POSIX_V7_ILP32_OFF32_LDFLAGS
_CS_POSIX_V7_ILP32_OFF32_LIBS
_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS
_CS_POSIX_V7_ILP32_OFFBIG_LIBS
_CS_POSIX_V7_LP64_OFF64_CFLAGS
_CS_POSIX_V7_LP64_OFF64_LDFLAGS
_CS_POSIX_V7_LP64_OFF64_LIBS
_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS
_CS_POSIX_V7_LPBIG_OFFBIG_LIBS
_CS_V6_ENV
_CS_V7_ENV
_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 @@ -489,6 +489,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 @@ -5640,11 +5640,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
28 changes: 28 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,34 @@ 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_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_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_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_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_V6_ENV: ::c_int = 1148;
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_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_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_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_V7_ENV: ::c_int = 1149;

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 @@ -814,6 +814,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_POSIX_V6_WIDTH_RESTRICTED_ENVS: ::c_int = 1;
pub const _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS: ::c_int = 5;

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 @@ -1423,6 +1423,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

0 comments on commit 2d6c7a6

Please sign in to comment.