Path: utzoo!utgpu!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!att!cuuxb!dlm From: dlm@cuuxb.ATT.COM (Dennis L. Mumaugh) Newsgroups: comp.unix.wizards Subject: Re: a.out pathname Summary: partly Keywords: a.out exec Message-ID: <2167@cuuxb.ATT.COM> Date: 4 Nov 88 17:09:22 GMT References: <297@sky.COM> <395@auspex.UUCP> Reply-To: dlm@cuuxb.UUCP (Dennis L. Mumaugh) Distribution: na Organization: ATT Data Systems Group, Lisle, Ill. Lines: 25 In article <395@auspex.UUCP> guy@auspex.UUCP (Guy Harris) writes: >>Is the FIRST argument to execxx squirreled away somewhere? > >No. Actually, Guy isn't exactly correct. The kernel does remember part of the name of the a.out used in the exec for accounting purposes. The last part of the path (i.e. the file name but not path and directory) is saved in the ublock. The kernel accounting writes this and other information into a file on the process's exit. This information is also in a program's core dump. [Useful if you find random cores in / ]. But if you mean "Can my process find out the name of the file that was used for execution?" Guy is right. Only if one has a /proc file system ala System V Release 3.1.1 for the 3B15 or Version 8/9 can one get this information and then it isn't easy and one must be root. [ Of course if you are root, then you can read /dev/kmem and reverse engineer the exec and find out. A 45 on the Knuth Scale of difficulty. ] -- =Dennis L. Mumaugh Lisle, IL ...!{att,lll-crg}!cuuxb!dlm OR cuuxb!dlm@arpa.att.com