a.out pathname

Dennis L. Mumaugh dlm at cuuxb.ATT.COM
Sat Nov 5 03:09:22 AEST 1988


In article <395 at auspex.UUCP> guy at 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 at arpa.att.com



More information about the Comp.unix.wizards mailing list