Skip to content

Commit 10ace1e

Browse files
committed
Add fcntl OFD commands for macOS
Obey shellcheck ci/style.sh should be executable Define PRIVATE on apple to expose OFD commands Require macos-14
1 parent b101560 commit 10ace1e

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

ci/install-rust.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ fi
1313
if [ "$OS" = "windows" ]; then
1414
: "${TARGET?The TARGET environment variable must be set.}"
1515
rustup set profile minimal
16-
rustup update --force $toolchain-"$TARGET"
17-
rustup default $toolchain-"$TARGET"
16+
rustup update --force "$toolchain-$TARGET"
17+
rustup default "$toolchain-$TARGET"
1818
else
1919
rustup set profile minimal
20-
rustup update --force $toolchain
21-
rustup default $toolchain
20+
rustup update --force "$toolchain"
21+
rustup default "$toolchain"
2222
fi
2323

2424
if [ -n "$TARGET" ]; then

ci/style.sh

100644100755
File mode changed.

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ fn test_apple(target: &str) {
179179
let mut cfg = ctest_cfg();
180180
cfg.flag("-Wno-deprecated-declarations");
181181
cfg.define("__APPLE_USE_RFC_3542", None);
182+
cfg.define("PRIVATE", None);
182183

183184
headers! { cfg:
184185
"aio.h",

libc-test/semver/apple.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ COPYFILE_STATE_SRC_FD
256256
COPYFILE_STATE_SRC_FILENAME
257257
COPYFILE_STATE_STATUS_CB
258258
COPYFILE_STATE_STATUS_CTX
259-
COPYFILE_STATE_XATTRNAME
260259
COPYFILE_STATE_WAS_CLONED
261-
COPYFILE_VERBOSE
260+
COPYFILE_STATE_XATTRNAME
262261
COPYFILE_UNLINK
262+
COPYFILE_VERBOSE
263263
COPYFILE_XATTR
264264
CR0
265265
CR1
@@ -440,6 +440,9 @@ F_LOG2PHYS
440440
F_LOG2PHYS_EXT
441441
F_NOCACHE
442442
F_NODIRECT
443+
F_OFD_GETLK
444+
F_OFD_SETLK
445+
F_OFD_SETLKW
443446
F_PEOFPOSMODE
444447
F_PREALLOCATE
445448
F_PUNCHHOLE
@@ -1969,19 +1972,19 @@ posix_spawn_file_actions_t
19691972
posix_spawnattr_destroy
19701973
posix_spawnattr_get_qos_class_np
19711974
posix_spawnattr_getarchpref_np
1975+
posix_spawnattr_getbinpref_np
19721976
posix_spawnattr_getflags
19731977
posix_spawnattr_getpgroup
19741978
posix_spawnattr_getsigdefault
19751979
posix_spawnattr_getsigmask
19761980
posix_spawnattr_init
19771981
posix_spawnattr_set_qos_class_np
19781982
posix_spawnattr_setarchpref_np
1983+
posix_spawnattr_setbinpref_np
19791984
posix_spawnattr_setflags
19801985
posix_spawnattr_setpgroup
19811986
posix_spawnattr_setsigdefault
19821987
posix_spawnattr_setsigmask
1983-
posix_spawnattr_getbinpref_np
1984-
posix_spawnattr_setbinpref_np
19851988
posix_spawnattr_t
19861989
posix_spawnp
19871990
preadv

src/unix/bsd/apple/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3412,6 +3412,10 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55;
34123412
pub const F_NODIRECT: ::c_int = 62;
34133413
pub const F_LOG2PHYS_EXT: ::c_int = 65;
34143414
pub const F_BARRIERFSYNC: ::c_int = 85;
3415+
// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h
3416+
pub const F_OFD_SETLK: ::c_int = 90; /* Acquire or release open file description lock */
3417+
pub const F_OFD_SETLKW: ::c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */
3418+
pub const F_OFD_GETLK: ::c_int = 92; /* Examine OFD lock */
34153419
pub const F_PUNCHHOLE: ::c_int = 99;
34163420
pub const F_TRIM_ACTIVE_FILE: ::c_int = 100;
34173421
pub const F_SPECULATIVE_READ: ::c_int = 101;

0 commit comments

Comments
 (0)