Return to BSD News archive
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!uwm.edu!cs.utexas.edu!swrinde!pipex!uunet!heifetz.msen.com!zib-berlin.de!irz401!uriah.sax.de!not-for-mail From: j@uriah.sax.de (J Wunsch) Newsgroups: comp.os.386bsd.development Subject: Re: How to find the filename of the binary executable... Date: 8 Dec 1994 18:57:52 +0100 Organization: Private U**x site, Dresden. Lines: 25 Message-ID: <3c7hf0$au0@bonnie.tcd-dresden.de> References: <3c35e2$6sv@shore.shore.net> <3c3d5b$kor@dagny.galt.com> NNTP-Posting-Host: 192.109.108.139 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit alex wetmore <alex@pc.cc.cmu.edu> wrote: >Robert Withrow (witr@rwwa.com) wrote: >> Can someone tell me how to find the filename of the *binary* >> file being executed (on, say, FreeBSD 1.1.5.1, or sunos.recent)? > >> P.S.: if your answer is argv[0], you don't understand the >> question... > >You can't do this. What if you have the same executable with two names >(through hard links). There needn't even to be a file name associated. If someone rm'd the last link of the file after it has been started, there's no name at all. The file remains existing until the last *reference* (that might be a running process) disappears, then it's being deleted physically. If your system crashes meanwhile, fsck will clear the leftover file on reboot. -- cheers, J"org work: joerg_wunsch@tcd-dresden.de private: joerg_wunsch@uriah.sax.de Never trust an operating system you don't have sources for. ;-)