How do I get what users are doing?
Dan Bernstein
brnstnd at kramden.acf.nyu.edu
Fri Nov 9 18:13:31 AEST 1990
In article <3933 at idunno.Princeton.EDU> subbarao at phoenix.Princeton.EDU (Kartik Subbarao) writes:
[ w ]
> In order to find out what processes are running, it either
> calls ps or is already setgid kmem so it can peek at /dev/kmem.
I haven't seen a version that calls ps. Note that /dev/kmem used to be
readable on most systems (and still is on many), so system-status
programs didn't have to be setuid or setgid.
> Then it does something to find
> out the most "interesting" process for each user and displays it.
Usually w pretends that processes don't wrap around, and takes a System
V view of the world.
The former means that it takes the highest-numbered process as the
latest process invoked on the terminal.
The latter means that it checks first only for processes not ignoring
interrupts, since that (usually) characterizes foreground processes
under System V. Only if it doesn't find a foreground process does it
look for background processes on the terminal. Under BSD, foreground
processes are distinguished by their process groups, though this would
require w to open the terminal and figure out the foreground process
group.
> (I need a new .signature -- any suggestions?)
How 'bout ``It's your fault that I post articles with 100 columns''?
---Dan
More information about the Comp.unix.questions
mailing list