[comp.unix.questions] How do you know if a user is idle?

earl@doc.uucp (Earl Locken) (07/05/88)

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?

Thanks.

Earl Locken
Alberta Microelectronic Centre
#200, 1620-29 St. NW, Calgary, Alberta, Canada  T2N 4L7
UUCP: ...{alberta,ubc-cs,utai}!calgary!amc-vlsi!earl

dce@mips.COM (David Elliott) (07/06/88)

In article <529@amc-vlsi.UUCP> earl@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@mips.com  or  {ames,prls,pyramid,decwrl}!mips!dce