commits
Adding some basic functionality to sysctl_machdep
Primary motivation for this: JavaScriptCore. Generating the DSYM for that takes *forever* (but I still want to build the library)
See https://github.com/darlinghq/darling/issues/766#issuecomment-619623968
This is necessary to avoid name conflicts on case-insensitive filesystems
Plus, the CMakeLists already has this as the project name
It's supposed to return 0 if it succeeds, -1 otherwise. See `man 2 getentropy`
(It's also supposed to return EIO if it reads less bytes than were requested; this also fixes that)
It's okay because Linux's `fsync` guarantees the same that macOS's `F_FULLFSYNC` does: the data will be written to the disk and, if necessary, it will wait for the disk cache to be flushed
We were already returning ENOSYS in `__unknown_syscall`, but that prints a message saying the syscall is unimplemented.
This version is a valid implementation of the syscalls (it's not guaranteed to be available on all systems).
This was causing some directory entries to be skipped because we were reading more directory entries from Linux than we had space for in the user provided buffer
The last commit changed `openat` to use Linux O_PATH for BSD O_SYMLINK, which is necessary to open a file handle to the symlink itself rather than its target. Unfortunately, this means that some syscalls (like `flistxattr`) need to modified because Linux doesn't support O_PATH descriptors in them
`fgetxattr` and `fsetxattr` will also need fixing
Fixes #761
Linux CMSGs are aligned to 8 bytes, but BSD CMSgs are aligned to 4 bytes.
We were correctly adding 4 to the length of BSD message to account for the extra 4 bytes in the message length field, but we were still aligning the data to 4 bytes. This fixes that by aligning to 8 bytes instead.
In macOS (and some BSDs), symlinks have modifiable permissions, but in Linux, they do not.
Telling Linux to perform fchmodat on a symlink will cause it to modify the permissions on the symlink's target
(and return ENOENT if you try to modify permissions on a symlink that doesn't have a valid target)
The last commit changed `openat` to use Linux O_PATH for BSD O_SYMLINK, which is necessary to open a file handle to the symlink itself rather than its target. Unfortunately, this means that some syscalls (like `flistxattr`) need to modified because Linux doesn't support O_PATH descriptors in them
`fgetxattr` and `fsetxattr` will also need fixing