@@ -207,6 +207,9 @@ fn test_apple(target: &str) {
207207 assert ! ( target. contains( "apple" ) ) ;
208208 let x86_64 = target. contains ( "x86_64" ) ;
209209 let i686 = target. contains ( "i686" ) ;
210+ let macos = target. contains ( "darwin" ) || target. contains ( "macos" ) ;
211+ let tvos = target. contains ( "tvos" ) ;
212+ let watchos = target. contains ( "watchos" ) ;
210213
211214 let mut cfg = ctest_cfg ( ) ;
212215
@@ -234,27 +237,29 @@ fn test_apple(target: &str) {
234237 "ifaddrs.h" ,
235238 "langinfo.h" ,
236239 "libgen.h" ,
237- "libproc.h" ,
240+ ( macos , "libproc.h" ) ,
238241 "limits.h" ,
239242 "locale.h" ,
243+ "mach/mach.h" ,
240244 "malloc/malloc.h" ,
241- "net/bpf.h" ,
242- "net/dlil.h" ,
245+ ( macos , "net/bpf.h" ) ,
246+ ( macos , "net/dlil.h" ) ,
243247 "net/if.h" ,
244- "net/if_arp.h" ,
248+ ( macos , "net/if_arp.h" ) ,
245249 "net/if_dl.h" ,
246- "net/if_mib.h" ,
247- "net/if_utun.h" ,
250+ ( macos , "net/if_mib.h" ) ,
251+ ( macos , "net/if_utun.h" ) ,
248252 "net/if_var.h" ,
249- "net/ndrv.h" ,
250- "net/route.h" ,
253+ ( macos , "net/ndrv.h" ) ,
254+ ( macos , "net/route.h" ) ,
251255 "netdb.h" ,
252- "netinet/if_ether.h" ,
256+ ( macos , "netinet/if_ether.h" ) ,
253257 "netinet/in.h" ,
254258 "netinet/ip.h" ,
255259 "netinet/tcp.h" ,
256260 "netinet/udp.h" ,
257- "netinet6/in6_var.h" ,
261+ "netinet6/scope6_var.h" ,
262+ ( macos, "netinet6/in6_var.h" ) ,
258263 "os/clock.h" ,
259264 "os/lock.h" ,
260265 "os/signpost.h" ,
@@ -285,20 +290,20 @@ fn test_apple(target: &str) {
285290 "sys/file.h" ,
286291 "sys/ioctl.h" ,
287292 "sys/ipc.h" ,
288- "sys/kern_control.h" ,
293+ ( macos , "sys/kern_control.h" ) ,
289294 "sys/mman.h" ,
290295 "sys/mount.h" ,
291- "sys/proc_info.h" ,
292- "sys/ptrace.h" ,
296+ ( macos , "sys/proc_info.h" ) ,
297+ ( macos , "sys/ptrace.h" ) ,
293298 "sys/quota.h" ,
294- "sys/random.h" ,
299+ ( macos , "sys/random.h" ) ,
295300 "sys/resource.h" ,
296301 "sys/sem.h" ,
297302 "sys/shm.h" ,
298303 "sys/socket.h" ,
299304 "sys/stat.h" ,
300305 "sys/statvfs.h" ,
301- "sys/sys_domain.h" ,
306+ ( macos , "sys/sys_domain.h" ) ,
302307 "sys/sysctl.h" ,
303308 "sys/time.h" ,
304309 "sys/times.h" ,
@@ -319,7 +324,7 @@ fn test_apple(target: &str) {
319324 "utmpx.h" ,
320325 "wchar.h" ,
321326 "xlocale.h" ,
322- ( x86_64 , "crt_externs.h" ) ,
327+ "crt_externs.h" ,
323328 ) ;
324329
325330 cfg. skip_struct ( move |s| {
@@ -375,6 +380,26 @@ fn test_apple(target: &str) {
375380 "close" if x86_64 => true ,
376381 // FIXME(1.0): std removed libresolv support: https://github.com/rust-lang/rust/pull/102766
377382 "res_init" => true ,
383+ // Marked available everywhere, but the `sys/random.h` header only
384+ // exists on the macOS SDK.
385+ // FIXME(madsmtm): Filed as FB23000895.
386+ "getentropy" => !macos,
387+ // Prohibited on iOS, tvOS, watchOS and visionOS.
388+ // FIXME(madsmtm): Perhaps we should just not expose this symbol?
389+ "system" => !macos,
390+ // Marked unavailable on iOS, tvOS, watchOS and visionOS.
391+ // FIXME(madsmtm): Perhaps we should just not expose these symbols?
392+ "pthread_jit_write_protect_np"
393+ | "pthread_jit_write_protect_supported_np"
394+ | "pthread_jit_write_with_callback_np"
395+ | "pthread_jit_write_freeze_callbacks_np"
396+ | "gethostuuid" => !macos,
397+ // Marked as unavailable on tvOS and watchOS.
398+ // FIXME(madsmtm): Perhaps we should just not expose this symbol?
399+ "execl" | "execle" | "execlp" | "execv" | "execve" | "execvp" | "execvP" | "fork"
400+ | "sigaltstack" | "syscall" | "daemon" | "brk" | "sbrk" | "task_set_info"
401+ | "exchangedata" => tvos || watchos,
402+ ident if ident. starts_with ( "posix_spawn" ) => tvos || watchos,
378403 _ => false ,
379404 }
380405 } ) ;
0 commit comments