4 ms·
There are two syscalls I really wish linux had (well maybe more, but these are the ones I've thought about the most, and are relevant here): 1. A spawn syscall
by thayne 3y ago
There are two syscalls I really wish linux had (well maybe more, but these are the ones I've thought about the most, and are relevant here):
1. A spawn syscall that can replace fork/exec, that defaults to only inheriting the "std" file descriptors (0, 1, and 2), but allows passing others in an array. Has options for replacing the environment and the working directory, decreasing privileges (including capabilities and namespaces), etc. And has a way to return the pidfd for the child process.
2. Something like fork, but it only copies readonly program memory, and instead of returning in the child process, it calls a function, essentially the main function for the child process). This would be useful if you want to fork a child process using the same executable, but unlike fork can actually be thread safe.