Skip to content

Commit b1acf8d

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 7d19eed commit b1acf8d

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

.github/workflows/full_ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
contents: read # to fetch code (actions/checkout)
3232

3333
name: macOS
34-
runs-on: macos-13
34+
runs-on: macos-14
3535
strategy:
3636
fail-fast: true
3737
matrix:
@@ -217,10 +217,10 @@ jobs:
217217
max-parallel: 4
218218
matrix:
219219
target:
220-
- { toolchain: stable, os: macos-13 }
221-
- { toolchain: beta, os: macos-13 }
222-
- { toolchain: nightly, os: macos-13 }
223-
- { toolchain: 1.71.0, os: macos-13 }
220+
- { toolchain: stable, os: macos-14 }
221+
- { toolchain: beta, os: macos-14 }
222+
- { toolchain: nightly, os: macos-14 }
223+
- { toolchain: 1.71.0, os: macos-14 }
224224
runs-on: ${{ matrix.target.os }}
225225
steps:
226226
- uses: actions/checkout@v4

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
@@ -3413,6 +3413,10 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55;
34133413
pub const F_NODIRECT: ::c_int = 62;
34143414
pub const F_LOG2PHYS_EXT: ::c_int = 65;
34153415
pub const F_BARRIERFSYNC: ::c_int = 85;
3416+
// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h
3417+
pub const F_OFD_SETLK: ::c_int = 90; /* Acquire or release open file description lock */
3418+
pub const F_OFD_SETLKW: ::c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */
3419+
pub const F_OFD_GETLK: ::c_int = 92; /* Examine OFD lock */
34163420
pub const F_PUNCHHOLE: ::c_int = 99;
34173421
pub const F_TRIM_ACTIVE_FILE: ::c_int = 100;
34183422
pub const F_SPECULATIVE_READ: ::c_int = 101;

0 commit comments

Comments
 (0)