Skip to content

Commit c35bfa4

Browse files
Add a few declarations for Apple systems
1 parent 8356615 commit c35bfa4

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
@@ -1075,6 +1075,7 @@ POSIX_SPAWN_SETPGROUP
10751075
POSIX_SPAWN_SETSIGDEF
10761076
POSIX_SPAWN_SETSIGMASK
10771077
POSIX_SPAWN_START_SUSPENDED
1078+
_POSIX_SPAWN_DISABLE_ASLR
10781079
PRIO_DARWIN_BG
10791080
PRIO_DARWIN_NONUI
10801081
PRIO_DARWIN_PROCESS
@@ -2054,6 +2055,8 @@ posix_spawnattr_setflags
20542055
posix_spawnattr_setpgroup
20552056
posix_spawnattr_setsigdefault
20562057
posix_spawnattr_setsigmask
2058+
posix_spawnattr_getbinpref_np
2059+
posix_spawnattr_setbinpref_np
20572060
posix_spawnattr_t
20582061
posix_spawnp
20592062
preadv
@@ -2112,6 +2115,8 @@ pthread_rwlockattr_getpshared
21122115
pthread_rwlockattr_setpshared
21132116
pthread_setname_np
21142117
pthread_stack_frame_decode_np
2118+
pthread_chdir_np
2119+
pthread_fchdir_np
21152120
ptrace
21162121
pututxline
21172122
pwritev

src/unix/bsd/apple/mod.rs

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

46894689
// sys/spawn.h:
4690-
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
4691-
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
4692-
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
4693-
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
4694-
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
4695-
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
4690+
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001;
4691+
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002;
4692+
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004;
4693+
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008;
4694+
pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040;
4695+
pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080;
4696+
pub const _POSIX_SPAWN_DISABLE_ASLR: ::c_int = 0x0100;
46964697
pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
46974698

46984699
// sys/ipc.h:
@@ -5421,6 +5422,8 @@ extern "C" {
54215422
policy: ::c_int,
54225423
param: *const sched_param,
54235424
) -> ::c_int;
5425+
pub fn pthread_chdir_np(path: *const ::c_char) -> ::c_int;
5426+
pub fn pthread_fchdir_np(fd: ::c_int) -> ::c_int;
54245427

54255428
// Available from Big Sur
54265429
pub fn pthread_introspection_hook_install(
@@ -5734,6 +5737,18 @@ extern "C" {
57345737
subpref: *mut ::cpu_subtype_t,
57355738
ocount: *mut ::size_t,
57365739
) -> ::c_int;
5740+
pub fn posix_spawnattr_getbinpref_np(
5741+
attr: *const posix_spawnattr_t,
5742+
count: ::size_t,
5743+
pref: *mut ::cpu_type_t,
5744+
ocount: *mut ::size_t,
5745+
) -> ::c_int;
5746+
pub fn posix_spawnattr_setbinpref_np(
5747+
attr: *mut posix_spawnattr_t,
5748+
count: ::size_t,
5749+
pref: *mut ::cpu_type_t,
5750+
ocount: *mut ::size_t,
5751+
) -> ::c_int;
57375752
pub fn posix_spawnattr_set_qos_class_np(
57385753
attr: *mut posix_spawnattr_t,
57395754
qos_class: ::qos_class_t,

0 commit comments

Comments
 (0)