1 // roughly based on the code for Firefox class BinaryPath
2 // https://searchfox.org/mozilla-central/source/xpcom/build/BinaryPath.h#185
6 #include <sys/sysctl.h>
14 int main(int argc
, char **argv
)
16 char aResult
[PATH_MAX
];
20 mib
[2] = KERN_PROC_PATHNAME
;
23 size_t len
= PATH_MAX
;
24 if (sysctl(mib
, 4, aResult
, &len
, nullptr, 0) < 0) {
25 cerr
<< "sysctl failed\n";
28 if (string(aResult
) == argv
[1]) {
31 cerr
<< "Not OK aResult " << aResult
<< " argv[1] " << argv
[1] << '\n';