A new rwho daemon
The classic UNIX rwhod program is based on broadcasting and can therefore significantly degrade network and host performance as the number of hosts in the network increases. For this reason, rwhod is often disabled at sites with more than a few hosts.
rwhod++ is intended as a compatible replacement for the standard rwhod program. It avoids the drawbacks of rwhod by using an entirely different approach: rwhod++ actively polls a list of hosts using asynchronous RPC. As the data files generated by rwhod++ are identical to those maintained by rwhod, client programs such as rwho and ruptime need not be replaced when rwhod++ is used.
rwhod++ collects the replies received from remote hosts asynchronously to avoid blocking during RPC calls to hosts that are down, and to precisely meet the user-specified time span for one round through the list of hosts.
On startup, rwhod++ reads a set of hosts from one or more NIS netgroups or files. The hosts are then contacted in a round-robin fashion using rusers and rstat RPC requests. In the first round through the list of hosts, rwhod++ resolves the hostnames and queries the portmapper on each host to obtain the port numbers.
If no positive reply is received from a host after a user-defined number of requests, the host is ``reset''. This causes the hostname to be resolved again and the remote portmapper to be (re-)contacted during the next round to take care of hosts that were rebooted or whose IP addresses have changed since rwhod++ was started.
rwhod++ is usually run on a single host in the local network. This host's /usr/spool/rwho can then be exported via NFS to any number of machines. However, as rwhod++ is using the classic rwhod's data format which was not designed for use by more than a single host (it is byte-order dependent), all hosts using the same data files must have identical byte-order (MSB-first). The canonical way to avoid this problem is to maintain a simple rwho/ruptime cache:
The host running rwhod++ periodically starts rwho and ruptime to save their output into cache files under /usr/spool/rwho/cache (actually, rwho and ruptime need to be run once for each permutation of command line options). On all the client machines, the rwho and rupime commands can then be replaced by trivial shell scripts that just cat the respective cache files. This scheme has the additional benefit to greatly reduce the number of NFS requests generated by running vanilla rwho or ruptime.
The rwho command used to periodically refresh the rwho cache must be a copy of the ordinary rwho executable. The ruptime command used to update the ruptime cache must not have the artificial limit on the number of hosts which is present in most versions of ruptime (for example, the 4.4BSD ruptime works fine). Example shell scripts implementing the rwho/ruptime cache as well as a boot-time startup script are included in the distribution (see directory support).
See README for installation instructions.
rwhod++ is free software and is distributed in source form. To compile the source code, you need an ANSI-C compiler. You can get the distribution (``gzipped'' tar file, 24 kbytes) from this server:
If you have an older version of rwhod++, you may want to check the file PATCHLEVEL in your distribution and see if there are any new patches in the official list of patches that need to be applied. The distribution offered here and on the FTP server is always up-to-date with respect to the patch level.
Wilhelm Köhler demonstrated the rwho/ruptime caching scheme and use of RPC calls to poll a set of hosts. Carsten Bormann suggested to directly implement the relevant parts of the RPC protocol (rather than use the RPC library) to achieve asynchronous RPC. The drawing in the graphics version of this document has been inspired by a figure on the cover illustration of People of Darkness by Tony Hillerman.
Oliver Laumann · firstname.lastname@example.org