[comp.windows.x] Eliminating extra "rwall"s on Suns

guy%gorodish@Sun.COM (Guy Harris) (06/05/87)

> We have about 10 Sun fileservers with lots of Sun 3/50's hanging off of each
> one.  We cross mount all the areas containing users' files on every system
> (including all diskless systems).  (This allows our users to simply log
> into ANY Sun machine and have their files right there.)  Anyway, we had
> complaints from a lot of users about the fact that whenever any fileserver
> was brought down, they would get shutdown messages about it in all of their
> windows!

"wall" (which is what the "rwall" service uses) doesn't send messages
to terminals listed in "/etc/utmp" that are "non-user" entries, where
"non-user" is defined by the macro in our <utmp.h>:

	/*
	 * This is a utmp entry that does not correspond to a genuine user
	 */
	#define nonuser(ut) ((ut).ut_host[0] == 0 && \
		strncmp((ut).ut_line, "tty", 3) == 0 &&
		((ut).ut_line[3] == 'p' \
		|| (ut).ut_line[3] == 'q' \
		|| (ut).ut_line[3] == 'r'))

(yes, I know, it should test for 's' as well, this will be fixed in a
future release).

"xterm" fills in the display name in the "ut_host" field, presumably
to indicate that the "xterm" process in question is painting pictures
on some host other than the one on which it is running.  It might be
a Good Idea were it to forbear from doing so when it is displaying on
the host on which it is running.  This can be considered the default
case; any pseudo-tty entry printed by "who", etc. that does not
contain a host name can be assumed to be a local "xterm".  This means
that "xterm"s *not* displaying on the local machine will get
"(r)wall"ed, but this is probably a Good Thing in many cases -
unless you are also rlogged in to the other machine in something like
a local "xterm" window, "wall"s on that machine wouldn't show up
otherwise.

It is unfortunate that this whole "utmp" nonsense is necessitated by
some UNIX programs (I think, for example, some SCCS programs look in
"utmp", for depressing historical reasons dating back to PWB/UNIX,
based on V6 with its 1-byte (!)  UIDs).  (Note that programs broken
by this will not, for example, be happy when run under "script",
since "script" also establishes a new tty but does not make a "utmp"
entry.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com