How do you know if a user is idle?

David Elliott dce at mips.COM
Wed Jul 6 23:56:33 AEST 1988


In article <529 at amc-vlsi.UUCP> earl at doc.uucp (Earl Locken) writes:
>
>How does the system tell if a user is idle?  We run SunOS here, and
>where does the "w" command get the info it prints as the idle time?

Both "w" and "rwhod" get the idle time by stat()ing the tty device
and subtracting the last access time (st_atime) from the current time.

This method works in both BSD and System V (at least, in our System
V, which has rwho in it).

-- 
David Elliott		dce at mips.com  or  {ames,prls,pyramid,decwrl}!mips!dce



More information about the Comp.unix.questions mailing list