determine the current directory of a son-process

Wilhelm Valder valder at gmdzi.UUCP
Tue Jun 21 22:59:43 AEST 1988


Does anyone know how to determine the current working directory (CWD) of 
a son-process in UNIX. Any hints, comments, solutions are appreciated.

The problem: In our current implementation of a command listener, we
have one process that builds up a command line and sends it to a son
process (normally /bin/sh or /bin/sh) that has been forked and exec'd
during startup. The two processes communicate via pseudo ttys (pty's).
The command listener in turn should provide a set of facilities to ease
command formulation. Two of these facilities are: expansion of regular
expressions into a string of file names and file name completion.
Whenever the user requests the command listener to complete a partial
file name, this name is replaced by its completed file name (if such a
completion exists). For this purpose the command listener must know
the current working directory of the son process. Up to now I have
found no solution to this problem. The only thing I have found is an
entry in the user-structure of a process that holds some information
about the current directory of this process (namely the entry
'u_cdir'). Unfortunately, this entry is actually a pointer to a
structure of type 'vnode' and I see no way to get the name of the
coresponding directory or to even read the contents of this directory.

I would be very grateful if anybody could give me a hint how to solve this
problem or to state the problem is unsolvable. 

BTW, we are implementing on a SUN3/75 running SUN-OS 3.4.

	
	Thanks in advance for any assistance.

---------------------------------------------------------------------------------
Willi Valder
GMD / F2.G2
Schloss Birlinghoven
D-5205 Sankt Augustin 1, FRG

phone:	(+49 2241) 14-2590
email:	valder%gmdzi&mcvax



More information about the Comp.unix.questions mailing list