*BSD News Article 26088


Return to BSD News archive

Xref: sserve comp.unix.bsd:13274 comp.unix.programmer:14353
Path: sserve!newshost.anu.edu.au!munnari.oz.au!bunyip.cc.uq.oz.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!usc!howland.reston.ans.net!europa.eng.gtefsd.com!uhog.mit.edu!bloom-beacon.mit.edu!mcrcim.mcgill.edu!homer.cs.mcgill.ca!storm
From: storm@cs.mcgill.ca (Marc WANDSCHNEIDER)
Newsgroups: comp.unix.bsd,comp.unix.programmer
Subject: sigblock and system() under 4.3bsd
Date: 16 Jan 1994 05:26:13 GMT
Organization: SOCS, McGill University, Montreal, Canada
Lines: 55
Message-ID: <2haj5l$jvk@homer.cs.mcgill.ca>
NNTP-Posting-Host: mnementh.cs.mcgill.ca


mooo!

	i'm having an interesting problem with sigblock() and
	system that i'm not sure how to resolve.

	i want to change the following code:

	oldmask = sigblock(....);

	if (!(pid = fork)) {
		sigsetmask(oldmask);
		....
		execlp(...);
	}

	wait()
	sigsetmask(oldmask);

	to not fork, and just system() instead.

	however, then, i'm not sure how to restore the child's
	signal mask, since i'm assuming that signal masks are
	inherited during a fork().

	the obvious solutions to me are:

	1. wrap the system() cal:

		omask = sigsetmask(oldmask)
		system()
		oldmask = sigsetmask(omask)

	  but this defeats the whole purpose of setting
	up the mask in the first place.

	2. just let the child process have those signals blocked, but
	it's not clear to me whether this is a good thing or a bd thing.

	this is basically a funciton that is invoking an
	editor to edit a temp file set up by th eprogram [edquota].

	any thoughts on how to resolve this?  was the original sigblock needed
	in the first place?  [it's blocking sigint, sighup, and sigquit]

	thanks.


					toodlepip
					marc'em.
-- 
-----------------------------------------------------------------------------
Marc Wandschneider					    Seattle, WA
Barney the Dinosaur sings! You faint... Barney sings!  Barney sings! --More--
You Die... --More--