Path: utzoo!utgpu!attcan!uunet!mcvax!ukc!stl!stc!idec!marlow!fox From: fox@marlow.uucp (Paul Fox) Newsgroups: comp.unix.wizards Subject: Re: Is it possible to get hold of a process's Process control Block given Message-ID: <429@alice.marlow.uucp> Date: 1 Aug 88 19:33:09 GMT References: <8807140043.ab12588@SEM.BRL.ARPA> Reply-To: fox@marlow.UUCP (Paul Fox) Organization: Reuters Ltd PLC, Marlow, Bucks, England Lines: 26 In article <8807140043.ab12588@SEM.BRL.ARPA> bardhan@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.