Skip to content

Commit d5737a0

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 (backport #4738) (cherry picked from commit b1be455)
1 parent fe277da commit d5737a0

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
@@ -1724,6 +1724,7 @@ XUCRED_VERSION
17241724
XU_NGROUPS
17251725
YESEXPR
17261726
YESSTR
1727+
_CS_PATH
17271728
_IOFBF
17281729
_IOLBF
17291730
_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
@@ -921,6 +921,7 @@ WSTOPPED
921921
WTRAPPED
922922
YESEXPR
923923
YESSTR
924+
_CS_PATH
924925
_IO
925926
_IOC
926927
_IOFBF

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

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

1362+
pub const _CS_PATH: c_int = 1;
1363+
13621364
pub const _SC_V7_ILP32_OFF32: c_int = 122;
13631365
pub const _SC_V7_ILP32_OFFBIG: c_int = 123;
13641366
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
@@ -1613,6 +1613,8 @@ pub const _PC_2_SYMLINKS: c_int = 13;
16131613
pub const _PC_ACL_EXTENDED: c_int = 14;
16141614
pub const _PC_MIN_HOLE_SIZE: c_int = 15;
16151615

1616+
pub const _CS_PATH: c_int = 1;
1617+
16161618
pub const _SC_SYNCHRONIZED_IO: c_int = 31;
16171619
pub const _SC_IOV_MAX: c_int = 32;
16181620
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
@@ -1219,6 +1219,8 @@ pub const _PC_SYMLINK_MAX: c_int = 19;
12191219
pub const _PC_SYNC_IO: c_int = 20;
12201220
pub const _PC_TIMESTAMP_RESOLUTION: c_int = 21;
12211221

1222+
pub const _CS_PATH: c_int = 1;
1223+
12221224
pub const _SC_CLK_TCK: c_int = 3;
12231225
pub const _SC_SEM_NSEMS_MAX: c_int = 31;
12241226
pub const _SC_SEM_VALUE_MAX: c_int = 32;

0 commit comments

Comments
 (0)