-
-
Notifications
You must be signed in to change notification settings - Fork 694
Description
Description
It is technically possible to do, even if there are a few failure cases. For instance, here's a C++ project I wrote which does it: https://github.com/samuelvenable/OpenBSD-Get-Executable-Path The code would need to be rewritten to be in C, but the same basic code logic would be used. Some of the code logic might be omitted or considered redundant depending on your needs. OpenBSD has no official API for this, so I admit, writing our own solution is pretty hacky. It tests against the ino_t and dev_t of the file to make sure it matches up with a valid hard link to the exact intended file. It returns an empty string when it fails, as you documented. I got help from the OpenBSD mailing lists to write this solution, so it's as good as it things get.
The only dependencies are libc and libkvm which are provided by OpenBSD's base system.
Motivation
This is mainly for consistency with other platforms. OpenBSD is the only platform missing this feature.
Additional context
No response