System V Release 4.0 Developers

Ron Natalie ron at ron.rutgers.edu
Wed Oct 12 06:08:56 AEST 1988


BSD job control relies heavily on the behaviour of process groups
in the kernel.  What this provides for is the ability to selectively
change what processes are allowed to read and write from the terminal.
It also adds a set of signals that allow processes to be suspended,
either because the user typed the suspend character, or the user attempted
to read or write the terminal when not authorized.  The kernel doesn't
know foreground from background.  All it knows is whether these signals
are caught/ingored or whatever and what the process group on the terminal
and each process are.

The shells are the book keepers of this whole mess.  They essentially do
ioctls to map the terminals process group to that of the foreground processes.
They catch information on process state change from the kernel by the
wait system call and presents that to the user.

If the shell doesn't know about job control, some not so fun things happen
when processes suspend.  Best demonstration, start up /bin/sh and then run
a program like talk and type ^Z.  The shell doesn't know about job control
so it just sits there and waits for the job to exit, which it isn't going
to do because it's suspended.  The csh, and the spiffier /bin/sh varients
actually catch the suspend info and do the process management.

The BRL Bourne Shell is a System VR2 shell.  Starting with VR2 gives us
the shell functions (the /bin/sh flavor of aliases) as well as numerous
bug fixes over the one provided with 4.2 BSD.  One major advantage is
that with VR2 the shell was written in C :-).   After typing ^Z at talk
one too many times, I put job control in to the Bourne shell.  This
change is twisted through so many modules that it is inseperable.  Hence,
you will need a System V source license to get this changes.  Right
after I did this, we got a hot copy of KSH, but AT&T said they had no
plans to make it officially available.  To try to convert a bunch of
tcsh users I added a command editing module to the shell.  This is
a surrogate readc() routine and hence can be sent along as is (although
you'd need sources to compile it in with the rest of the shell).
Doug added some additional features like ~user substitution, shell
TIMEOUT, and ignoreof facility.

-Ron



More information about the Comp.unix.wizards mailing list