Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!ptsfa!nonvon!apn
From: apn@nonvon.UUCP (apn)
Newsgroups: comp.unix.questions
Subject: Re: Access to structure in 
Message-ID: <1411@nonvon.UUCP>
Date: Thu, 25-Dec-86 22:53:49 EST
Article-I.D.: nonvon.1411
Posted: Thu Dec 25 22:53:49 1986
Date-Received: Fri, 26-Dec-86 03:44:02 EST
References: <1485@brl-adm.ARPA> <96@osupyr.UUCP>
Organization: NONVON Systems Computer Research Group
Lines: 66
Summary: reading user descriptor struct

In article <96@osupyr.UUCP>, dusan@osupyr.UUCP (Dusan Nedeljkovic) writes:
> Does anyone have any clues as to how to access the "user" structure
> in  ?
> 
> 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  )

	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] 


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                               *}