init and process group id's for SYS V

Jim Webb jrw at hropus.UUCP
Fri Sep 12 01:32:58 AEST 1986


> I am developing a kind of "auxiliary init" program for SYS V, that spawns gettys
> for lines just being connected to a data switch.  What sequence does
> /etc/init use to spawn a getty (or whatever)? 

It execs "/bin/sh -c exec XXXXXXX"  wherever XXXXXXX is the command from
/etc/inittab.  This allows you to use all of the shell special chars, redirection,
etc.  Note, however that you *cannot* have a pipe in there; I leave it
up to the reader to see why not...

> Also, how does /etc/init know which child process has died when it gets
> a SIGCLD?  According to the prog. manual, wait() gives you the status,
> but not the process number.

Read further.  The wait() syscall does two things.  One, which you point
out, slams status info into the int pointed to as the argument.  It also
returns the pid of the child that terminated.  Eg:

			pid=wait(&status);

>                               Perhaps the process number is passed as an
> additional argument to the signal catching function?

Nope, the only argument passed to the catching function is the signal number.
However, since this is UNIX, and full of contradictions, more arguments
are passed if it is a hardware induced signal...
-- 
Jim Webb             "Out of phase--get help"          ...!ihnp4!hropus!jrw



More information about the Comp.unix.wizards mailing list