Setting the pid to 0 will send the SIGABRT signal to "every process in the process group of the calling process". This means that darlingserver will also get killed as a result (which we don't want to happen).
Instead of duplicating the assembly code, let's have a shared function that both "sys_workq_kernreturn" and "wqueue_entry_point_wrapper" can use to jump to "_start_wqthread".
In `libpthread/src/pthread_asm.S`, `_thread_start` and `_start_wqthread` are designed with the assumption that the code would run from kernel space. This means that the following functions don't follow all of the standard calling conventions that are expected for x86_64 or i386.
Our previous choices for per-thread-WD keys were conflicting with the
keys reserved for the Swift runtime and causing crashes for Swift apps.
Instead, let's use some keys from the newly-reserved Darling range for
pthread keys (200-209). This range seems to be otherwise unused, so it
should be fine for us to use it.
As explained in the comment, Ninja gets confused by the fact that the
subdirectory is added in `darling/src/libsystem_kernel` but it's
actually located in the root of the repo. The system resolves relative
paths using the real path, but Ninja resolves it according to the CMake
subdirectory path.
Ninja was constantly searching for
`darling/src/libsystem_kernel/osfmk/mach_eventlink_types.h` instead of
`osfmk/mach_eventlink_types.h` and therefore constantly thought that the
source that depended on this was out-of-date.
Implemented AT_REMOVEDIR_DATALESS and AT_FDONLY flags.
Implemented the error EINVAL for invalid flags that are passed to *at
functions.
Added AT_EACCESS and AT_REALDEV flags but are currently ignored.
Since we don't build the kernel module anymore, I want to take the opportunity to only include changes that are needed for Darling to function (build and sucessfully bring up `bash`).