mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Change signal mask after vfork/clone system call
@ 2010-10-19  7:53 Gregory Giguashvili
  2010-10-20  7:56 ` Gregory Giguashvili
  2010-11-04  6:08 ` Gregory Giguashvili
  0 siblings, 2 replies; 10+ messages in thread
From: Gregory Giguashvili @ 2010-10-19  7:53 UTC (permalink / raw)
  To: linux-kernel

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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-11-05  7:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19  7:53 Change signal mask after vfork/clone system call Gregory Giguashvili
2010-10-20  7:56 ` Gregory Giguashvili
2010-11-04  6:08 ` Gregory Giguashvili
2010-11-04  9:48   ` Alan Cox
2010-11-04 15:37     ` Gregory Giguashvili
2010-11-04 15:45       ` Alan Cox
2010-11-04 16:20         ` Gregory Giguashvili
2010-11-04 16:28           ` Alan Cox
2010-11-04 16:43             ` Gregory Giguashvili
2010-11-05  7:32     ` Gregory Giguashvili

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®