Path: utzoo!attcan!uunet!husc6!think!bloom-beacon!tut.cis.ohio-state.edu!osu-cis!att!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: comp.unix.questions Subject: Re: proc table in /dev/kmem Summary: ps might be too slow Message-ID: <3041@ttrdc.UUCP> Date: 15 Nov 88 06:48:59 GMT References: <1865@loral.UUCP> <4161@encore.UUCP> <4920@pdn.UUCP> Organization: AT&T, Skokie, IL Lines: 23 In article <4920@pdn.UUCP>, reggie@pdn.UUCP (George W. Leach) writes: < In article <4161@encore.UUCP> bzs@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-----|