Is it possible to get hold of a process's Process control Block given

Paul Fox fox at marlow.uucp
Tue Aug 2 05:33:09 AEST 1988


In article <8807140043.ab12588 at SEM.BRL.ARPA> bardhan at edu.lsu (Sanjoy Bardhan) writes:
>I am checking out some Unix internals. Is it possible to get hold of a process's
>Process control Block given the pid of the process. Essentially I would 
>like to get the code which takes care of the "PCB save" on a preemption 
>or swap.
>

I believe that you will need to walk down the 'struct proc proc[]' array
looking for a pid match.....

That answers your question (albeit badly)...can anybody answer
mine... I am trying to write/port the BSD 'top' utility
posted to usenet sometime ago, to Unix V.3. 

I've successfully managed to port it to SunOS 4 after a lot of changes,
but am having problems with the u-area.

Given that we start from the struct proc of a process, how
do we get to the u-area, if (a) the process/u-area is in memory,
and (b) the process/u-area is swapped out.

The system I am doing this on is uPort V.3/386.

Many thanks,

Paul Fox.



More information about the Comp.unix.wizards mailing list