Skip to content

Commit b1be455

Browse files
krobelusJohnTitor
authored andcommitted
Define _CS_PATH on the BSDs
According to https://man.netbsd.org/confstr.3 _CS_PATH is obsoleted by sysctl (which has a USER_CS_PATH equivalent), but Linux doesn't have that. So the simplest thing for applications is to use _CS_PATH which is part of POSIX. Define, matching the <unistd.h> header. We could maybe share this definition in src/unix/bsd/netbsdlike/mod.rs, but I saw that existing definitions are not shared either, so I'm not sure. $ grep src/unix/bsd/netbsdlike -e _PC_LINK_MAX src/unix/bsd/netbsdlike/netbsd/mod.rs:1599:11:pub const _PC_LINK_MAX: c_int = 1; src/unix/bsd/netbsdlike/openbsd/mod.rs:1193:11:pub const _PC_LINK_MAX: c_int = 1; Originally reported in fish-shell/fish-shell#11892
1 parent 4d939b0 commit b1be455

File tree

8 files changed

+12
-0
lines changed

8 files changed

+12
-0
lines changed

libc-test/semver/dragonfly.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,7 @@ WTRAPPED
11281128
XUCRED_VERSION
11291129
YESEXPR
11301130
YESSTR
1131+
_CS_PATH
11311132
_IOFBF
11321133
_IOLBF
11331134
_IONBF

libc-test/semver/freebsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,6 +1715,7 @@ XUCRED_VERSION
17151715
XU_NGROUPS
17161716
YESEXPR
17171717
YESSTR
1718+
_CS_PATH
17181719
_IOFBF
17191720
_IOLBF
17201721
_IONBF

libc-test/semver/netbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,7 @@ XATTR_CREATE
11271127
XATTR_REPLACE
11281128
YESEXPR
11291129
YESSTR
1130+
_CS_PATH
11301131
_IO
11311132
_IOC
11321133
_IOFBF

libc-test/semver/openbsd.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,7 @@ WSTOPPED
917917
WTRAPPED
918918
YESEXPR
919919
YESSTR
920+
_CS_PATH
920921
_IO
921922
_IOC
922923
_IOFBF

src/unix/bsd/freebsdlike/dragonfly/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,8 @@ pub const VCHECKPT: usize = 19;
13611361
pub const _PC_2_SYMLINKS: c_int = 22;
13621362
pub const _PC_TIMESTAMP_RESOLUTION: c_int = 23;
13631363

1364+
pub const _CS_PATH: c_int = 1;
1365+
13641366
pub const _SC_V7_ILP32_OFF32: c_int = 122;
13651367
pub const _SC_V7_ILP32_OFFBIG: c_int = 123;
13661368
pub const _SC_V7_LP64_OFF64: c_int = 124;

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,8 @@ pub const _SC_RAW_SOCKETS: c_int = 119;
11971197
pub const _SC_SYMLOOP_MAX: c_int = 120;
11981198
pub const _SC_PHYS_PAGES: c_int = 121;
11991199

1200+
pub const _CS_PATH: c_int = 1;
1201+
12001202
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = ptr::null_mut();
12011203
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = ptr::null_mut();
12021204
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = ptr::null_mut();

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,8 @@ pub const _PC_2_SYMLINKS: c_int = 13;
16121612
pub const _PC_ACL_EXTENDED: c_int = 14;
16131613
pub const _PC_MIN_HOLE_SIZE: c_int = 15;
16141614

1615+
pub const _CS_PATH: c_int = 1;
1616+
16151617
pub const _SC_SYNCHRONIZED_IO: c_int = 31;
16161618
pub const _SC_IOV_MAX: c_int = 32;
16171619
pub const _SC_MAPPED_FILES: c_int = 33;

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,8 @@ pub const _PC_SYMLINK_MAX: c_int = 19;
12121212
pub const _PC_SYNC_IO: c_int = 20;
12131213
pub const _PC_TIMESTAMP_RESOLUTION: c_int = 21;
12141214

1215+
pub const _CS_PATH: c_int = 1;
1216+
12151217
pub const _SC_CLK_TCK: c_int = 3;
12161218
pub const _SC_SEM_NSEMS_MAX: c_int = 31;
12171219
pub const _SC_SEM_VALUE_MAX: c_int = 32;

0 commit comments

Comments
 (0)