This question has been asked several times here, but I can’t find answer for the following situation:
My program uses statically linked libraries, which open file handles, so, I’m unable to set FD_CLOEXEC on those file handles
simply calling exec causes alot of errors in new process, because of unavailable file handles
Basically I need:
1. spawn new process without blocking current one
2. terminate current process (close all handles)
Can I do it on linux?
Closing all filedescriptors should be as simple as
This is also a standard step during daemonizing, see e.g. http://www.enderunix.org/docs/eng/daemon.php