4 ms·
It's not enough to merge fork() and execve(), because what actually happens is some variant of: fork(); open(); close(); dup2(); fdcntl(); sigprocmask(); sigac
by caf 12y ago
It's not enough to merge fork() and execve(), because what actually happens is some variant of:
fork();
open();
close();
dup2();
fdcntl();
sigprocmask();
sigaction();
setrlimit();
prctl();
chdir();
chroot();
capset();
execve();
(and perhaps more besides, with new ones potentially added with new features, for example seccomp();)
- dpark 12y agoThat seems like compelling evidence that the Linux method is more complex than the Windows method (or at least no less complex). Calling a bunch of complex functions is not simpler than setting up a bunch of complex params and then calling one function.
- caf 12y agoApproximately zero programs will call all of those functions, but each will call its own required subset of them. If you don't care about running the child with an altered root directory, you don't need to call chroot().
- dpark 12y agoOf course. Most programs also don't need all the esoteric options that can be passed into CreateProcess either.
- caf 12y agoI don't think anyone who's thought about it for a moment disagrees that starting a process has a large degree of potential complexity, regardless of the operating system. The question is whether it's better (more elegant) to load that complexity onto one complex function call, or farm it out to multiple simple function calls. It is apparent that this is a question in which personal taste is involved.