Skip to content

Commit

Permalink
Add fcntl OFD commands for macOS
Browse files Browse the repository at this point in the history
Obey shellcheck
ci/style.sh should be executable
Define PRIVATE on apple to expose OFD commands
Require macos-14
  • Loading branch information
anacrolix committed Feb 23, 2024
1 parent b101560 commit 10ace1e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions ci/install-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ fi
if [ "$OS" = "windows" ]; then
: "${TARGET?The TARGET environment variable must be set.}"
rustup set profile minimal
rustup update --force $toolchain-"$TARGET"
rustup default $toolchain-"$TARGET"
rustup update --force "$toolchain-$TARGET"
rustup default "$toolchain-$TARGET"
else
rustup set profile minimal
rustup update --force $toolchain
rustup default $toolchain
rustup update --force "$toolchain"
rustup default "$toolchain"
fi

if [ -n "$TARGET" ]; then
Expand Down
Empty file modified ci/style.sh
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ fn test_apple(target: &str) {
let mut cfg = ctest_cfg();
cfg.flag("-Wno-deprecated-declarations");
cfg.define("__APPLE_USE_RFC_3542", None);
cfg.define("PRIVATE", None);

headers! { cfg:
"aio.h",
Expand Down
11 changes: 7 additions & 4 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,10 @@ COPYFILE_STATE_SRC_FD
COPYFILE_STATE_SRC_FILENAME
COPYFILE_STATE_STATUS_CB
COPYFILE_STATE_STATUS_CTX
COPYFILE_STATE_XATTRNAME
COPYFILE_STATE_WAS_CLONED
COPYFILE_VERBOSE
COPYFILE_STATE_XATTRNAME
COPYFILE_UNLINK
COPYFILE_VERBOSE
COPYFILE_XATTR
CR0
CR1
Expand Down Expand Up @@ -440,6 +440,9 @@ F_LOG2PHYS
F_LOG2PHYS_EXT
F_NOCACHE
F_NODIRECT
F_OFD_GETLK
F_OFD_SETLK
F_OFD_SETLKW
F_PEOFPOSMODE
F_PREALLOCATE
F_PUNCHHOLE
Expand Down Expand Up @@ -1969,19 +1972,19 @@ posix_spawn_file_actions_t
posix_spawnattr_destroy
posix_spawnattr_get_qos_class_np
posix_spawnattr_getarchpref_np
posix_spawnattr_getbinpref_np
posix_spawnattr_getflags
posix_spawnattr_getpgroup
posix_spawnattr_getsigdefault
posix_spawnattr_getsigmask
posix_spawnattr_init
posix_spawnattr_set_qos_class_np
posix_spawnattr_setarchpref_np
posix_spawnattr_setbinpref_np
posix_spawnattr_setflags
posix_spawnattr_setpgroup
posix_spawnattr_setsigdefault
posix_spawnattr_setsigmask
posix_spawnattr_getbinpref_np
posix_spawnattr_setbinpref_np
posix_spawnattr_t
posix_spawnp
preadv
Expand Down
4 changes: 4 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3412,6 +3412,10 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55;
pub const F_NODIRECT: ::c_int = 62;
pub const F_LOG2PHYS_EXT: ::c_int = 65;
pub const F_BARRIERFSYNC: ::c_int = 85;
// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h
pub const F_OFD_SETLK: ::c_int = 90; /* Acquire or release open file description lock */
pub const F_OFD_SETLKW: ::c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */
pub const F_OFD_GETLK: ::c_int = 92; /* Examine OFD lock */
pub const F_PUNCHHOLE: ::c_int = 99;
pub const F_TRIM_ACTIVE_FILE: ::c_int = 100;
pub const F_SPECULATIVE_READ: ::c_int = 101;
Expand Down

0 comments on commit 10ace1e

Please sign in to comment.