rlogind / BRL Sys V problem

Doug Gwyn gwyn at brl-smoke.ARPA
Mon Apr 28 14:27:27 AEST 1986


In article <5530 at root44.UUCP> aegl at root44.UUCP (Tony Luck) writes:
>/etc/rlogind ignores SIGCHLD before invoking /bin/login - thus all child
>processes inherit this. The wait(2) library code in Doug's package checks
>to see if you are ignoring SIGCHLD, if you are it waits for all children
>and returns -1 with errno=ECHILD.
>
>1) Why does /etc/rlogind leave SIGCHLD in SIG_IGN state when execl'ing
>   /bin/login - this appears to be a simple oversight - but too many users
>   here will want to break my arms if I just change it and then discover a
>   good reason for this behaivour later!

It's a bug.  SIGCHLD should be set to SIG_DFL to ignore it, not to
SIG_IGN.  (Yes, I am serious!)  I think we found all these and
stamped them out in the BRL edition of 4.2BSD.

>2) Why does the "wait()" code check for SIGCHLD and then wait for all children
>to die - this might be to try to emulate the "if a process ignores SIGCLD
>then it's children won't turn into zombies when they die" mode of system V
>(I thought you needed garlic+holy water for that!)

The emulation does this because the System V documentation says so.
I personally think it's a crock and wouldn't object if you modify
your copy of the emulation to disable this feature.  I see that the
feature is not mentioned in the latest SVID, so portable code should
not depend on it anyway.  If you don't have source, here's the module
in question (compile it under the System V environment):

/*
	wait -- system call emulation for 4.2BSD or BRL PDP-11 UNIX

	last edit:	18-Sep-1983	D A Gwyn
*/

#include	<errno.h>
#include	<signal.h>

extern int	_wait();

int
wait( stat_loc )
	int	*stat_loc;		/* where to put status */
	{
	register void	(*sig)();	/* entry SIGCLD state */

	if ( (sig = signal( SIGCLD, SIG_IGN )) == SIG_IGN )
		{
		while ( _wait( stat_loc ) != -1 || errno != ECHILD )
			;		/* wait for all children */
		return -1;		/* ECHILD */
		}
	else	{
		(void)signal( SIGCLD, sig );	/* restore entry state */
		return _wait( stat_loc );
		}
	}

>... Apart from a few oddities with ioctls that can't be mapped right ...

I'm considering adjusting the terminal ioctl emulation to use CBREAK
under suitable circumstances.  Another possibility is to try to do
something more intelligent with the MIN, TIME fields.  There are
certain mode combinations that can't be emulated correctly, since
the Berkeley terminal driver doesn't have adequate orthogonality.
Of course, the best solution would be to have the kernel provide an
entire AT&T-style terminal handler as a separate line discipline.



More information about the Comp.unix.wizards mailing list