Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 11:38:58 -0500
From:      "David E. Cross" <crossd@o2.cs.rpi.edu>
To:        David Wolfskill <dhw@whistle.com>
Cc:        hackers@FreeBSD.ORG, kpielorz@tdx.co.uk
Subject:   Re: Getting PID of parent pipe?
Message-ID:  <Pine.SGI.4.05.9811241136390.32239-100000@o2.cs.rpi.edu>
In-Reply-To: <199811241614.IAA08037@pau-amma.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 24 Nov 1998, David Wolfskill wrote:

> >Date: Fri, 20 Nov 1998 11:48:49 +0000
> >From: Karl Pielorz <kpielorz@tdx.co.uk>
> 
> >Is there an 'easy' way of getting the PID of a parent process feeding a
> >command's stdin?
> 
> >e.g.
> 
> >cat something | foo | bar
> 
> >I need to get the PID of foo while running as bar...
> 
> If "bar" is something you can control/modify, it would seem that
> getppid() would be an appropriate tool.

that would return to him the PID of the shell process, not the PID of
'foo' (the process which is feeding the pipe).  I don't know of an easy
way from 'bar' to get the PID of 'foo'.  You could do it with a method
similar too lsof, but that would require special privs that you may or may
not have, and a good deal of effort.

--
David Cross


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SGI.4.05.9811241136390.32239-100000>