Access to structure in <sys/user.h>
apn
apn at nonvon.UUCP
Fri Dec 26 13:53:49 AEST 1986
In article <96 at osupyr.UUCP>, dusan at osupyr.UUCP (Dusan Nedeljkovic) writes:
> Does anyone have any clues as to how to access the "user" structure
> in <sys/user.h> ?
>
> I need to find information concerning the status of a users process
> for a C program I will be writting. Any help on where to find this
> information (or am I on the wrong track?) would be highly appreciated.
>
>
Reading user struct from C program.
a simple outline:
1] find your process descriptor table entry in ram
by reading from /dev/mem and filling proc structure
( see <sys/proc.h> )
2] determine from the entry that is yours, what the address
of your process is and what device it is on at the
moment. Should either /dev/mem or /dev/swap or for those
lucky few of us /dev/swmem
address of your user struct should be determined
from something like :
(again, this is highly dep. on your CPU, MMU, etc)
(this is for 68k w/ 68451 MMU )
addr = ctob((long) proc_p.addr) for /dev/swap
addr = proc.p_addr + swplo << 9; for /dev/swmem
3] seek to addr in /dev/(fill in appropriate device)
and read something the size of your user structure
4] <done>
Note that all this requires read access to /dev/mem, etc. And thus
may defeat your purpose. Take this only as an outline. Mileage will
vary considerable with flavor of UNIX. This was from sV.
Other than those caveats.... I hope this is of some help.
uucp: ptsfa!nonvon!apn
--
UUCP: ihnp4!ptsfa!nonvon!apn
100 Drakes Landing Road
GreenBrae, CA 94904
+1 415 461 4655
{* War does not determine who is right or wrong........ only who is left *}
{* Only those who attempt the absurd ... will achieve the impossible *}
{* I think... I think it's in my basement... Let me go upstairs and check. *}
{* -escher *}
{* System down for P.M. until further notice *}
More information about the Comp.unix.questions
mailing list