Messages in this thread | ![/](/images/icornerl.gif) | | From | Gregory Giguashvili <> | Subject | RE: Change signal mask after vfork/clone system call | Date | Thu, 4 Nov 2010 06:08:17 +0000 |
| |
Any comments on this issue? Is there a way to prevent signal mask inheritance when using vfork?
-----Original Message----- From: linux-kernel-owner@vger.kernel.org [mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Gregory Giguashvili Sent: Tuesday, October 19, 2010 9:54 AM To: linux-kernel@vger.kernel.org Subject: Change signal mask after vfork/clone system call
For new processes created by vfork, while signals are blocked using pthread_sigmask: is there a way in a multi-threaded parent to safely unblock signals before the new process is started? Does pthread_atfork like functionality exist for vfork-ed processes maybe?
Ideally, the following code should work, except we're not allowed to call anything in the child process besides exec family of functions.
sigmask_t new; sigmask_t old; sigaddset (&new, SIGCHLD); pthread_sigmask (SIG_BLOCK, &new, &old);
switch (vfork ()) { case 0: // parent break; case -1: // error break; default: // child pthread_sigmask (SIG_SETMASK, &old, NULL); execv (...); _exit (-1); }
Finally, if using fork should be efficient for starting processes from applications with heavy VM/RSS memory footprint, this question becomes obsolete.
Thanks Giga
--------------------------------------------------------------------------------------------------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
--------------------------------------------------------------------------------------------------------------- This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
| ![\](/images/icornerr.gif) |