[net.unix-wizards] Symbolic WCHAN for 4.[12] ps.

alt.tsca%sri-tsca@sri-unix.UUCP (03/07/84)

	If anyone is interested, I have a piece of code that will
allow ps to print out symbolic entries for WCHAN like on 2.9bsd.
The problem is that it isn't very efficient.  As a matter of fact,
it doubles the time it takes to run ps.  I am looking into better
ways of doing it.

	Anyway, the fix is very simple, anyone can do it.  If you
are interested, I'll send you the code and instructions.

					Howard.

ron%brl-vgr@sri-unix.UUCP (03/07/84)

From:      Ron Natalie <ron@brl-vgr>

On both 4.1c and 4.2 BSD we added a third argument to the "sleep"
call that in addition to storing WCHAN and PRI stored a small text
string to indicate what you were waiting on.   PS makes use of this
and we added another magic character to the tty driver (typically
control-T) that types out the status of all the processes on the
current terminal...for example it looks like this right now:

125 (58) WAIT
1989 (58) TTYI
1970 (58) SOCKIO
1971 (58) RUN

First column is PROC number, second number is UID.  125 is my login
shell, 1989 is mail reading from the terminal.  1971 and 1970 are two
processes in the background connected by a pipe.

This is useful to determine what is reading from the terminal or do
make determinations like "it's not in a loop, it's waiting for you
to type something."

-Ron

guy@rlgvax.UUCP (Guy Harris) (03/10/84)

Speaking of control-T implementations, every one I can think of on UNIX
actually sticks a mini-ps in the kernel which is called from the TTY driver.  If
I remember correctly, the original TENEX ^T sent a signal (or its TENEX
equivalent) to either the entire process tree or to the top-level exec,
which woke up and did the "ps".  Just out of curiosity, has anyone implemented
a UNIX ^T as just another interrupt character and hacked a shell to catch
it and do a "ps"?

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy

joe@fluke.UUCP (Joe Kelsey) (03/16/84)

The VMS implementation of ^T (on version 3.0 and later) imlements ^t as
an out-of-band character which DCL catches and then prints some vaguely
informative message.  It has always seemed to me that UNIX needs some
more flexible out-of-band character handling than the current mapping
of specific control characters to signals.  Notice the proliferation of
character tables in the new tty driver to handle all of the Berkeley
features.  Many of these features could quite easily be handled with
some sort of generalized break character mechanism - and probably more
efficiently too!  TOPS-20 has had user settable break masks ever since
it was TENEX and VMS has also had more or less flexible break masks (In
version 3.0, the break mask grew from 32 bits (control characters only)
to variable sized masks from 8 bits to 256 bits (all 8-bit ASCII
characters!)  Some things, like command completion and prompting (added
to the csh using the only break character allowed!) would work much
better with a read termination mask instead of signals.  It's probably
too late to try to pull out all of the local character garbage from the
new tty driver and replace it with some sort of more flexible
mechanism, but it's a nice wish.  Too bad I don't have the time to
really think about doing it...

/Joe