The biggest improvement is the ability to log xtrace's output to a separate file for each thread. Jumbled output has been a big reason why xtrace is hard to use with multi-threaded programs, but this provides a nice optional solution to that problem. It doesn't come without its drawbacks, however: because xtrace has to open descriptors for the logfiles, it can affect program behavior, especially if the program sees the descriptors and decides to do something with them (like close them, which some programs do).
xtrace no longer buffers output on the stack (which could lead to stack overflows or truncated output). Actually, it doesn't buffer output at all anymore, which might be an issue (it means more potentially jumbled output when using the normal output method). If turns out to be a signifcant issue, we can re-add buffering in xtrace_log using a per-thread buffer rather than an on-stack one.
The kevent family of syscalls is now properly described! This means that those calls will now print much more useful output.
Also, to work around a stack overflow issue when running within signal handlers, xtrace now overrides the default sigstack with its own larger one. It's not apparent why xtrace is using so much stack space, but it seems like 16KiB is enough for now (rather than the default of 8KiB).
Executing the xtrace command with no arguments now produces a help message describing the various environment variables that can be used to modify xtrace's behavior.
Also, the simple printf family of functions in libsystem_kernel now support various argument sizes.
Finally, there's no reason to call the wrapper for `semaphore_signal_trap` in `bsdthread_terminate` (causing unnecessary xtrace output), so call our implementation directly instead.
* Fix the Carbon framework to properly reexport the right frameworks
* Add many missing Carbon-related type definitions
* A couple of fixes in some submodules (see their commits)
We basically have to reimplement locking, memory allocation, and TLS for xtrace directly on top of Linux syscalls because it can't use almost anything external (it can pretty much only use libsystem_kernel).
The one exception is that we use `pthread_key`s from libpthread to make TLS easier to implement. The only side effect that has is that it's one less available key for the application we're tracing to use, but we shouldn't ever see that cause problems (and if we do see it cause problems later on, then we can revise that).
[skip ci]
Skipping CI because I know the build is currently broken with this commit; I'm going to revert our use of mDNSResponder and add back our libsystem_dnssd stub, and then patch up libresolv/libinfo to fix DNS resolution (if necessary)
The main goal of this commit is to make it more easy to add or update any architecture we want to support (such as ARM64). Any changes we want to make would be done in the architectures.cmake file.
The secondary goal of this commit is to encourage a more architecture generic nomenclature. We shouldn't use i368/x86_64 unless we are dealing with code that is specific to those architectures.
The public headers are imported from the macOS SDK and from the last released OpenDirectory (version 146); it's ok to import them from the SDK because they're still APSL licensed
Reason: CMake's dependency scanner doesn't detect that some of the headers are generated and it doesn't try to generate them for other targets that depend on them indirectly (e.g. libc) and therefore parallel builds will fail.
The temporary solution is to check-in the generated headers into the source (just like we were doing before in `platform-include`). The proper solution would be to manually add dependencies for each target that needs the headers (which is pretty much *everything*), but that's ridiculous. Honestly, CMake should be able to detect this on its own, but whatever; this is a workaround.
Added IOKit to usr/include for IOKitTools (IIRC?) because it uses `Kernel/IOKit/IOKitDebugging.h`, and our Kernel framework headers directory is just a symlink to usr/include at the moment (this'll be fixed later)