@PleegWat said:
fork() even more so. Most specifically, a program can background itself from the terminal by calling fork(), setsid(), fork() in succession and letting the parents exit.
in NT a program can background itself by using a convenience API to talk to the CSR (i.e. FreeConsole), or by setting a tag in the executable header so the CSR does not even attempt to do so.
@PleegWat said:
In a fork/exec sequence, there can be other functions inbetween. Most importantly, this affects which file descriptors are inherited by the child process. The following does approximately the same as popen("zcat foo.gz"), without the error handling:
what the fuck, do even fork/exec cases
inherit by default? NT's a lot more granular with this, at least from basedll API...
@tarunik said:
(NtCreateProcess() is quite annoying in that it's both operations in one shot, which is nice for the 'run a program in a subprocess' case, but makes the 'create a subprocess of myself to do some task` case all sorts of ugly.)
NtCreateProcess was internally used by the former native POSIX subsystem to have fork() compatibility, so it can do that as well - just that the Win32 subsystem (win32k especially, basesrv is somewhat reliable) doesn't like that usage at times.
@PleegWat said:
I believe fork() uses copy-on-write pages.
still, you're cloning your page table and handles for no reason
also, I think I'm being a bad imitation of the usual NT-lovers here again... just that POSIX makes no sense to me being NT-headed :)