getprogname / setprogname

Jim Meyering jim@meyering.net
Sat Mar 18 00:44:00 GMT 2006


"H. J. Lu" <hjl@lucon.org> wrote:
> On Fri, Mar 17, 2006 at 07:51:37AM -0800, Ulrich Drepper wrote:
>> H. J. Lu wrote:
>> > Since we are on this topic, sometimes, I want to know the real pathname
>> > of the program. It isn't easy to find it out.
>>
>> Of course it is: readlink() on /proc/self/exe.
>
> It doesn't work before /proc is mounted.

And, like every other symlink in /proc, /proc/self/exe is
invalid when the linked-to name is longer than PATH_MAX.



More information about the Libc-alpha mailing list