posix_spawn() tries to present semantics as if no fork() is happening
behind the scenes, so running arbitrary atexit handlers of the parent
in the child seems like the wrong thing to do.
All the file actions stuff is still missing for now,
as is POSIX_SPAWN_SETSCHEDULER (not sure what that's
supposed to do) and POSIX_SPAWN_RESETIDS.
Implemented in userspace for now. Once there are users,
it'll likely make sense to make this a syscall for
performance reasons.
A simple test program of the form
extern char **environ;
int main(int argc, char* argv[])
{
pid_t pid;
char* args[] = { "ls", NULL };
posix_spawnp(&pid, "ls", nullptr, nullptr, args, environ);
}
works fine.