Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!rutgers!bellcore!tness7!texbell!bigtex!james From: james@bigtex.uucp (James Van Artsdalen) Newsgroups: comp.unix.questions Subject: Re: process ids Keywords: utmp ps process id Message-ID: <7431@bigtex.uucp> Date: 2 Sep 88 19:38:28 GMT References: <171@ispi.UUCP> Reply-To: james@bigtex.UUCP (James Van Artsdalen) Organization: F.B.N. Software, Austin TX Lines: 17 Why were there four different newgroups in the original posting? In article <171@ispi.UUCP>, jbayer@ispi.UUCP wrote: > I have a need to be able to identify the parent of a process > which is executing on the system. > Anybody have any ideas? Parse the output of ps(1). Something like sscanf("%s %d %d", name, &pid, &ppid) should suffice. If you do parsing the proc structure you'll be lucky if the code survives to the next revision of the kernel, much less to another system. Not really portable, but within SysV it should be. -- James R. Van Artsdalen ...!uunet!utastro!bigtex!james "Live Free or Die" Home: 512-346-2444 Work: 328-0282; 110 Wild Basin Rd. Ste #230, Austin TX 78746