Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Nov 1997 14:31:31 +1000
From:      Stephen McKay <syssgm@dtir.qld.gov.au>
To:        Terry Lambert <tlambert@primenet.com>
Cc:        freebsd-hackers@freebsd.org, gurney_j@resnet.uoregon.edu, syssgm@dtir.qld.gov.au
Subject:   Re: portal pid not correct... 
Message-ID:  <199711040431.OAA27497@ogre.dtir.qld.gov.au>
In-Reply-To: <199711040212.TAA14153@usr09.primenet.com> from Terry Lambert at "Tue, 04 Nov 1997 02:12:36 %2B0000"
References:  <199711040212.TAA14153@usr09.primenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, 4th November 1997, Terry Lambert wrote:

>> I took a look at the code.. and basicly it doesn't become a daemon before
>> tring to mount the fs...  and this is understandable else you can't return
>> a failed mount...
>> 
>> now as I see this, there are a couple ways to fix this...
>> 	a) just become a daemon and then mount, this isn't very attrative
>> 	   as the error doesn't get reported
>> 	b) do something were it will fork off the child, child will
>> 	   immediately SIGSTOP itself, then parent will mount, and then
>> 	   parent will SIGCONT the process for normal execution, or kill
>> 	   it off if the mount failed.
>> 	c) insert your idea hear
>
>Use vfork for the side effect before child exit/exec.  Man vfork for
>details.

Yuck!  vfork() sucks big time.  Forget it exists and you will do well.

To reliably coordinate with your child process use a pipe.  A single byte
sent through the pipe could be your "go" signal.  If you want more, then
pick several different byte values to represent different actions to take.
If the pipe closes unexpectedly, you know that the other party died horribly.
And one of your byte codes could indicate an error and be followed by the
errno and/or an error message.

You can use this method for coordinating either way (the parent waiting until
the child has got something done, or the other way around) so it is better
than vfork() anyway and it is portable back to (at least) Edition 7.

Stephen.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711040431.OAA27497>