nix-rust / nix

Rust friendly bindings to *nix APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable most macos functions on all of apple_targets

asomers opened this issue · comments

A quick search through libc shows that there's only one function we use that's defined on macos but isn't defined on tvos, watchos, and ios as well: clock_settime. Even that, I suspect, is a mistake, given that clock_gettime is defined for all of them.
We should replace #[cfg(target_os = macos)] with #[cfg(apple_targets)] everywhere.
Honestly, I don't know why Apple needs so many different Rust targets.

From this PR Add tvOS and watchOS support, identical to iOS support, iOS, tvOS, and watchOS are the same thing, though I have no idea how we can test whether clock_settime is available on iOS, libc does not have a CI for it

Well, it seems that this symbol is not available on iOS/tvOS/watchOS, from the PR that added it for macOS:

Looking at time.h for macOS 11.5 clock_settime still doesn't seem to be exported for iOS. Declaring it only for macOS (using rust-lang/libc#2208 as an example of how).

And I checked the apple's latest libc(Libc-1534.40.2), still, no support for iOS/tvOS/watchOS