You are not logged in.
As an exercise, I've been wanting to design a shell with better string-handling capabilities than bash — get around the quote-escaping problem, etc. But before I continue, I need to know: are fork()-ed child processes allowed to themselves fork()?
I ask because shells execute commands by fork()-exec(). But you start a subshell to a script? It then has to fork()-exec() the commands therein on its own...
It seems like this wouldn't work because in the child process, fork() returns 0. Or is this only for the fork() call that created it?
Last edited by Peasantoid (2009-05-23 18:11:35)
Offline
They can. Daemons for example do this, and they simply use a structure like if fork() == 0 { if fork() == 0 { daemon_main() ; } EXIT* }
*EDIT
Last edited by Procyon (2009-05-23 17:36:47)
Offline
Ah, thank you.
Offline