Skip to content

Commit fcd09b7

Browse files
Add a few declarations for Apple systems
1 parent df3f7c1 commit fcd09b7

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

libc-test/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ fn test_apple(target: &str) {
336336

337337
// FIXME: XCode 13.1 doesn't have it.
338338
"TIOCREMOTE" => true,
339+
340+
// Private value used by debuggers.
341+
"_POSIX_SPAWN_DISABLE_ASLR" => true,
339342
_ => false,
340343
}
341344
});
@@ -361,6 +364,9 @@ fn test_apple(target: &str) {
361364
// FIXME: Once the SDK get updated to Ventura's level
362365
"freadlink" | "mknodat" | "mkfifoat" => true,
363366

367+
// Private functions
368+
"pthread_chdir_np" | "pthread_fchdir_np" => true,
369+
364370
_ => false,
365371
}
366372
});

libc-test/semver/apple.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ POSIX_SPAWN_SETPGROUP
10911091
POSIX_SPAWN_SETSIGDEF
10921092
POSIX_SPAWN_SETSIGMASK
10931093
POSIX_SPAWN_START_SUSPENDED
1094+
_POSIX_SPAWN_DISABLE_ASLR
10941095
PRIO_DARWIN_BG
10951096
PRIO_DARWIN_NONUI
10961097
PRIO_DARWIN_PROCESS
@@ -2084,6 +2085,8 @@ posix_spawnattr_setflags
20842085
posix_spawnattr_setpgroup
20852086
posix_spawnattr_setsigdefault
20862087
posix_spawnattr_setsigmask
2088+
posix_spawnattr_getbinpref_np
2089+
posix_spawnattr_setbinpref_np
20872090
posix_spawnattr_t
20882091
posix_spawnp
20892092
preadv
@@ -2142,6 +2145,8 @@ pthread_rwlockattr_setpshared
21422145
pthread_setname_np
21432146
pthread_setschedparam
21442147
pthread_stack_frame_decode_np
2148+
pthread_chdir_np
2149+
pthread_fchdir_np
21452150
ptrace
21462151
pututxline
21472152
pwritev

src/unix/bsd/apple/mod.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4998,12 +4998,13 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000;
49984998
pub const MNT_NOBLOCK: ::c_int = 0x00020000;
49994999

50005000
// sys/spawn.h:
5001-
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
5002-
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
5003-
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
5004-
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
5005-
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
5006-
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
5001+
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001;
5002+
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002;
5003+
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004;
5004+
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008;
5005+
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040;
5006+
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080;
5007+
pub const _POSIX_SPAWN_DISABLE_ASLR: ::c_int = 0x0100;
50075008
pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
50085009

50095010
// sys/ipc.h:
@@ -5745,6 +5746,8 @@ extern "C" {
57455746
policy: ::c_int,
57465747
param: *const sched_param,
57475748
) -> ::c_int;
5749+
pub fn pthread_chdir_np(path: *const ::c_char) -> ::c_int;
5750+
pub fn pthread_fchdir_np(fd: ::c_int) -> ::c_int;
57485751

57495752
// Available from Big Sur
57505753
pub fn pthread_introspection_hook_install(
@@ -6058,6 +6061,18 @@ extern "C" {
60586061
subpref: *mut ::cpu_subtype_t,
60596062
ocount: *mut ::size_t,
60606063
) -> ::c_int;
6064+
pub fn posix_spawnattr_getbinpref_np(
6065+
attr: *const posix_spawnattr_t,
6066+
count: ::size_t,
6067+
pref: *mut ::cpu_type_t,
6068+
ocount: *mut ::size_t,
6069+
) -> ::c_int;
6070+
pub fn posix_spawnattr_setbinpref_np(
6071+
attr: *mut posix_spawnattr_t,
6072+
count: ::size_t,
6073+
pref: *mut ::cpu_type_t,
6074+
ocount: *mut ::size_t,
6075+
) -> ::c_int;
60616076
pub fn posix_spawnattr_set_qos_class_np(
60626077
attr: *mut posix_spawnattr_t,
60636078
qos_class: ::qos_class_t,

0 commit comments

Comments
 (0)