Aqcuiring full path to running process from outside the kernel

Sergey Babkin babkin at verizon.net
Tue Aug 22 17:59:26 UTC 2006


>From: Lutz Boehne <lboehne at damogran.de>
>
>> but argv[0] is either an absolute path or a path relative to pwd,
>> unless your shell is broken.
>
>One should also consider users breaking argv[0] intentionally, e.g. 
>pointing it to other files which could lead to undesired/unpredictable 
>behaviour. Even as a fallback it's probably not wise to trust it.

If we get back to the question of why we need the file,
we might not need it at all. As far as I understand,
the problem is that the Watcom compiler works by
sticking a set of messages into the executable files
and then later reading them out of the file, and the
point is to adapt the compiler to work on FreeBSD.

So why not just change the compiler to put the contents of 
this file into a DATA section, at some special symbol.
(I presume that now it puts the messages into some
kind of a COMMENT section).
Then instead of reading the file manually you would have
the contents of the file already pre-mapped into the memory
for you when the program starts. Saves you lots of trouble.

-SB


More information about the freebsd-hackers mailing list