Skip to content

Commit

Permalink
Add a few declarations for Apple systems
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentisambart committed Oct 7, 2023
1 parent d80e8bd commit 035933c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
6 changes: 6 additions & 0 deletions libc-test/build.rs
Expand Up @@ -328,6 +328,9 @@ fn test_apple(target: &str) {

// FIXME: XCode 13.1 doesn't have it.
"TIOCREMOTE" => true,

// Private value used by debuggers.
"_POSIX_SPAWN_DISABLE_ASLR" => true,
_ => false,
}
});
Expand All @@ -353,6 +356,9 @@ fn test_apple(target: &str) {
// FIXME: Once the SDK get updated to Ventura's level
"freadlink" | "mknodat" | "mkfifoat" => true,

// Private functions
"pthread_chdir_np" | "pthread_fchdir_np" => true,

_ => false,
}
});
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/apple.txt
Expand Up @@ -1091,6 +1091,7 @@ POSIX_SPAWN_SETPGROUP
POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGMASK
POSIX_SPAWN_START_SUSPENDED
_POSIX_SPAWN_DISABLE_ASLR
PRIO_DARWIN_BG
PRIO_DARWIN_NONUI
PRIO_DARWIN_PROCESS
Expand Down Expand Up @@ -2080,6 +2081,8 @@ 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 Expand Up @@ -2138,6 +2141,8 @@ pthread_rwlockattr_setpshared
pthread_setname_np
pthread_setschedparam
pthread_stack_frame_decode_np
pthread_chdir_np
pthread_fchdir_np
ptrace
pututxline
pwritev
Expand Down
27 changes: 21 additions & 6 deletions src/unix/bsd/apple/mod.rs
Expand Up @@ -4719,12 +4719,13 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000;
pub const MNT_NOBLOCK: ::c_int = 0x00020000;

// sys/spawn.h:
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008;
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040;
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080;
pub const _POSIX_SPAWN_DISABLE_ASLR: ::c_int = 0x0100;
pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;

// sys/ipc.h:
Expand Down Expand Up @@ -5466,6 +5467,8 @@ extern "C" {
policy: ::c_int,
param: *const sched_param,
) -> ::c_int;
pub fn pthread_chdir_np(path: *const ::c_char) -> ::c_int;
pub fn pthread_fchdir_np(fd: ::c_int) -> ::c_int;

// Available from Big Sur
pub fn pthread_introspection_hook_install(
Expand Down Expand Up @@ -5779,6 +5782,18 @@ extern "C" {
subpref: *mut ::cpu_subtype_t,
ocount: *mut ::size_t,
) -> ::c_int;
pub fn posix_spawnattr_getbinpref_np(
attr: *const posix_spawnattr_t,
count: ::size_t,
pref: *mut ::cpu_type_t,
ocount: *mut ::size_t,
) -> ::c_int;
pub fn posix_spawnattr_setbinpref_np(
attr: *mut posix_spawnattr_t,
count: ::size_t,
pref: *mut ::cpu_type_t,
ocount: *mut ::size_t,
) -> ::c_int;
pub fn posix_spawnattr_set_qos_class_np(
attr: *mut posix_spawnattr_t,
qos_class: ::qos_class_t,
Expand Down

0 comments on commit 035933c

Please sign in to comment.