TIL you can get the path to the current executable with getauxval(AT_EXECFN) on Linux, no messing with /proc necessary. It's a separate block of memory filled by the kernel, not argv[0] or anything.
-
-
Replying to @whitequark
Nice, there's also the `program_invocation_name` global http://man7.org/linux/man-pages/man3/program_invocation_name.3.html …
1 reply 0 retweets 0 likes -
Replying to @banisterfiend
that's argv[0], and argv[0] usually has a relative path, which doesn't help you if you want to access data adjacent to the executable (most uses of such paths)
1 reply 0 retweets 2 likes
Replying to @whitequark @banisterfiend
To access data adjacent to the executable, do what dynamic linker's RPATH ${ORIGIN} does: dirname(readlink("/proc/self/exe")).
9:47 AM - 10 Jan 2018
0 replies
0 retweets
2 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.