Originally posted by oiaohm
View Post
It's certainly racy, not only can a process disappear and pid recycled at any point, you also need to create a tempfile there to avoid multiple daemons writing into the same file.
pidfd is clearly the elegant solution here.
Originally posted by oiaohm
View Post
• the disposition of SIGCHLD has not been explicitly set to SIG_IGN (see sigaction(2));
• the SA_NOCLDWAIT flag was not specified while establishing a handler for SIGCHLD or while setting the disposition of that signal to SIG_DFL (see sigaction(2)); and
• the zombie process was not reaped elsewhere in the program (e.g., either by an asynchronously executed signal handler or by wait(2) or similar in another thread).
• the SA_NOCLDWAIT flag was not specified while establishing a handler for SIGCHLD or while setting the disposition of that signal to SIG_DFL (see sigaction(2)); and
• the zombie process was not reaped elsewhere in the program (e.g., either by an asynchronously executed signal handler or by wait(2) or similar in another thread).
Originally posted by oiaohm
View Post
Originally posted by oiaohm
View Post
Unix should grow up and fix its API that works in the old days but no longer work now.
Fork + exec is another example of in-efficient API with vfork + exec being a broken and racy replacement.
I remember there is a proposal of new API that closely models after posix_spawn in last year's Linux conference, hope it is in the kernel soon as that would also implementing a seccomp sandbox easier if adopted everywhere.
Comment