Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: How do I get what users are doing? Message-ID: <24974:Nov907:13:3190@kramden.acf.nyu.edu> Date: 9 Nov 90 07:13:31 GMT References: <16642@hydra.gatech.EDU> <1990Nov08.131534.10938@virtech.uucp> <3933@idunno.Princeton.EDU> Organization: IR Lines: 31 In article <3933@idunno.Princeton.EDU> subbarao@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