> > Hi! > > ---- > > Is there any "shortcut" to get the full path to the > process's executable > file ? Usually |readlink("/proc/self/path/a.out", > buff, buffsize)| or > |getexecname()| can be used - but is there any > _faster_ way (e.g. > something _not_ using a syscall (e.g. is this > information somewhere > above or below the |argv| array stored ?)) ?
getexecname() will only read /proc/self/auxv _once_ (per exec'd process) if I read the code correctly (and ld.so.1 will probably have called it once, so that all user calls are "free" in that regard). However, getexecname() only returns whatever the pathname was that was passed to the exec call, which might have been relative or contained symlinks. If one wants it cleaned up, one would have to run realpath() on it, which would end up calling resolvepath(2) (and maybe getcwd(3c)). So unless you actually _want_ the path as passed to the exec call, I'd say one system call per exec (since you can cache the result) is cheap, and just use the readlink() you mentioned. -- This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code