proc table in /dev/kmem
Daniel R. Levy
levy at ttrdc.UUCP
Tue Nov 15 16:48:59 AEST 1988
In article <4920 at pdn.UUCP>, reggie at pdn.UUCP (George W. Leach) writes:
< In article <4161 at encore.UUCP> bzs at encore.com (Barry Shein) writes:
< >>I have a situation where given a process id, I need to find the child(ren)
< >>of that pid.
< >Why are you so shy about groveling a ps listing? You don't have to use
< >awk if you're worried about all the overhead/memory, you can use
< >popen() and just get it yourself with a little string manipulation.
< >Do it like the pros, cheat!
< Thats right! We all do this. In fact, take a look at "The UNIX
< Programming Environment", Brian Kernighan and Rob Pike, Prentice-Hall,
< on pages 190-192 at the zap program. Copy and modify it to to your needs.
Well... It's not apparent what his application wants to do with the
information. If this is fairly time critical stuff, e.g., catch and kill
all the children of a given process ASAP, ps may not be fast enough.
I don't know about BSD, but on System V, ps will rebuild the /etc/ps_data
file every time it finds that /etc/passwd has been updated. This can take
several CPU seconds.
--
|------------Dan Levy------------| THE OPINIONS EXPRESSED HEREIN ARE MINE ONLY
| Bell Labs Area 61 (R.I.P., TTY)| AND ARE NOT TO BE IMPUTED TO AT&T.
| Skokie, Illinois |
|-----Path: att!ttbcad!levy-----|
More information about the Comp.unix.questions
mailing list