a.out pathname

Jim Thomas thomas at sky.COM
Thu Nov 3 06:54:05 AEST 1988


I want to append data to an a.out file.  Then I want the executing program
to read the data (which, of course, would have been ignored by the exec
itself).

>From an executing program how do I open the a.out file that
was exec'd?  That's easy -- get its pathname.  One way to get that
pathname (i.e., the first argument to execxx, not argv[0]) is to search
process, text, and in-core inode tables to get the inode number plus
major and minor device numbers and then to search the directories in the
corresponding file system.  Too time-consuming.  Is there
a better way?  Is the FIRST argument to execxx squirreled away somewhere?

If someone would suggest how to write a program that would QUICKLY find
the FULL pathname of its exec'd a.out file, regardless which directory
the a.out file happened to be installed in, I'd be grateful.  I'm
currently using SunOS 3.5.

Jim Thomas                            uunet!swan.ulowell.edu!sky!thomas
SKY Computers Inc., Foot of John Street, Lowell, MA 01852 (508)454-6200



More information about the Comp.unix.wizards mailing list