[comp.unix.wizards] how to find childs current working directory?

bpendlet@esunix.UUCP (Bob Pendleton) (05/21/88)

I have a need to find the current working directory of a child
process. The child is usually csh, but it can be any program. 

The closest I've come to a solution is to use ptrace PEEK_USER to get
at the current directory pointer and some how open the directory so I
can read it using readdir. I don't know if this is possible, or even
the right approach. Any suggestions, pointers to documentation, or
best, code, would be greatly appreciated.

		Thanks

			Bob Pendleton

-- 
Bob Pendleton @ Evans & Sutherland
UUCP Address:  {decvax,ucbvax,ihnp4,allegra}!decwrl!esunix!bpendlet
Alternate:     {ihnp4,seismo}!utah-cs!utah-gr!uplherc!esunix!bpendlet
        I am solely responsible for what I say.

arosen@eagle.ulowell.edu (MFHorn) (05/22/88)

From article <843@esunix.UUCP>, by bpendlet@esunix.UUCP (Bob Pendleton):
> I have a need to find the current working directory of a child
> process. The child is usually csh, but it can be any program. 

I have a want to find the current working directory of ANY process,
not necessarily a child, sibling, parent, 1st cousin, etc.

I can get at the kernel's idea of a process' cwd and root directory,
the vnode structs from the user struct.  But I haven't got the foggiest
idea how to turn them into path-names.

Any pointers?  [pun intended]

Adthanksvance.

Andy Rosen           | arosen@hawk.ulowell.edu | "I got this guitar and I
ULowell, Box #3031   | ulowell!arosen          |  learned how to make it
Lowell, Ma 01854     |                         |  talk" -Thunder Road
                   RD in '88 - The way it should be