reading /dev/mem - questions

Horst Laumer hotte at sunrise.in-berlin.de
Thu Nov 29 12:24:43 AEST 1990


shark at asylum.SF.CA.US (Dylan Rhodes) writes:
>	Okay, so now that I have root access and everything, I thought
>I'd write my own version of 'w' - that is, a program that tells me
>who's on, and what they're doing.
>	From what I can gather, w and ps get this information from
>reading memory, from /dev/mem and/or /dev/kmem.
>Questions:
>	- Am I on the right track?
>	- What *is* the difference between /dev/mem and /dev/kmem?
>	- Does anybody have the source code to a 'w' or 'ps' program
>	  that I can peruse?

You haven't whodo ? This would solve your problem (I found that binary
in /etc), since it gives system name, login-name, -time and -tty of
every active user and what commands he/she is running (even background
jobs and where their tty is). Try to get the sources, if someone's got
them (/etc/whodo came with the OS to me).

I got a pretty well working PD-system-monitor 'u386mon', who's author is
'wht at n4hgf' as the binary tells me. Sorry, but the sources are unavail
in the moment, perhaps someone else got it (I'm looking for the latest
release, too, got 2.00 but lost source by disk-error).

To solve your problem, I'll give you some hints according to AT&T's
Programmers Ref.:
utmp(4), getut(3c), <utmp.h>, /etc/utmp, /etc/wtmp

These deal with user- and accounting-information, as does who.

With ps, that's quite another highway. See ps(1) in the Files Section,
there is also a little handy definition about the difference between
/dev/mem and /dev/kmem.

Good luck
hl

-- 
============================================================================
Horst Laumer, Kantstrasse 107, D-1000 Berlin 12 ! Bang-Adress: 
Domain: hotte at sunrise.in-berlin.de              ! Junk-Food for Autorouters
Bang:   ...unido!fub!geminix!sunrise!hotte      ! -- me --



More information about the Comp.unix.questions mailing list