Skip to content

Commit 035933c

Browse files
Add a few declarations for Apple systems
1 parent d80e8bd commit 035933c

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
@@ -328,6 +328,9 @@ fn test_apple(target: &str) {
328328

329329
// FIXME: XCode 13.1 doesn't have it.
330330
"TIOCREMOTE" => true,
331+
332+
// Private value used by debuggers.
333+
"_POSIX_SPAWN_DISABLE_ASLR" => true,
331334
_ => false,
332335
}
333336
});
@@ -353,6 +356,9 @@ fn test_apple(target: &str) {
353356
// FIXME: Once the SDK get updated to Ventura's level
354357
"freadlink" | "mknodat" | "mkfifoat" => true,
355358

359+
// Private functions
360+
"pthread_chdir_np" | "pthread_fchdir_np" => true,
361+
356362
_ => false,
357363
}
358364
});

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
@@ -2080,6 +2081,8 @@ posix_spawnattr_setflags
20802081
posix_spawnattr_setpgroup
20812082
posix_spawnattr_setsigdefault
20822083
posix_spawnattr_setsigmask
2084+
posix_spawnattr_getbinpref_np
2085+
posix_spawnattr_setbinpref_np
20832086
posix_spawnattr_t
20842087
posix_spawnp
20852088
preadv
@@ -2138,6 +2141,8 @@ pthread_rwlockattr_setpshared
21382141
pthread_setname_np
21392142
pthread_setschedparam
21402143
pthread_stack_frame_decode_np
2144+
pthread_chdir_np
2145+
pthread_fchdir_np
21412146
ptrace
21422147
pututxline
21432148
pwritev

src/unix/bsd/apple/mod.rs

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

47214721
// sys/spawn.h:
4722-
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
4723-
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
4724-
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
4725-
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
4726-
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
4727-
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
4722+
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001;
4723+
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002;
4724+
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004;
4725+
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008;
4726+
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040;
4727+
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080;
4728+
pub const _POSIX_SPAWN_DISABLE_ASLR: ::c_int = 0x0100;
47284729
pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
47294730

47304731
// sys/ipc.h:
@@ -5466,6 +5467,8 @@ extern "C" {
54665467
policy: ::c_int,
54675468
param: *const sched_param,
54685469
) -> ::c_int;
5470+
pub fn pthread_chdir_np(path: *const ::c_char) -> ::c_int;
5471+
pub fn pthread_fchdir_np(fd: ::c_int) -> ::c_int;
54695472

54705473
// Available from Big Sur
54715474
pub fn pthread_introspection_hook_install(
@@ -5779,6 +5782,18 @@ extern "C" {
57795782
subpref: *mut ::cpu_subtype_t,
57805783
ocount: *mut ::size_t,
57815784
) -> ::c_int;
5785+
pub fn posix_spawnattr_getbinpref_np(
5786+
attr: *const posix_spawnattr_t,
5787+
count: ::size_t,
5788+
pref: *mut ::cpu_type_t,
5789+
ocount: *mut ::size_t,
5790+
) -> ::c_int;
5791+
pub fn posix_spawnattr_setbinpref_np(
5792+
attr: *mut posix_spawnattr_t,
5793+
count: ::size_t,
5794+
pref: *mut ::cpu_type_t,
5795+
ocount: *mut ::size_t,
5796+
) -> ::c_int;
57825797
pub fn posix_spawnattr_set_qos_class_np(
57835798
attr: *mut posix_spawnattr_t,
57845799
qos_class: ::qos_class_t,

0 commit comments

Comments
 (0)