Aqcuiring full path to running process from outside the kernel

M. Warner Losh imp at bsdimp.com
Tue Aug 22 23:10:58 UTC 2006


In message: <16315800.1957801156269547401.JavaMail.root at vms062.mailsrvcs.net>
            Sergey Babkin <babkin at verizon.net> writes:
: >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.

And is the main reason that DOS programs, back in the days that watcom
was written, did this editing technique...

Warner


More information about the freebsd-hackers mailing list