tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Proposal: getexecpath(3)



On 2026-10-25 6:02 a.m., Martin Husemann wrote:
On Sun, Oct 25, 2026 at 04:20:57AM -0400, Brad Smith wrote:
I know this is not quite what you are looking for, but FYI, OpenBSD
has since added a getexecpath(3) to libc, first appearing in
OpenBSD 8.0:

   https://man.openbsd.org/getexecpath.3

Unlike NetBSD, OpenBSD did not even have a sysctl like
KERN_PROC_PATHNAME to fall back on, so software was left guessing
from argv[0]. That said, after looking through many open source
projects, I see a lot of them have not been updated to use NetBSD's
sysctl either.
See also:

https://nxr.netbsd.org/xref/src/crypto/external/bsd/openssh/dist/getexecpath.c

It doesn't do the sysctl fallback either.

Martin

Looking at AT_SUN_EXECNAME, that does look proper.


Home | Main Index | Thread Index | Old Index