Path: utzoo!attcan!uunet!mcvax!unido!gmdzi!valder From: valder@gmdzi.UUCP (Wilhelm Valder) Newsgroups: comp.unix.questions Subject: determine the current directory of a son-process Keywords: unix, current working directory, process Message-ID: <579@gmdzi.UUCP> Date: 21 Jun 88 12:59:43 GMT Organization: GMD, Sankt Augustin, F. R. Germany Lines: 37 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