Add missing zstd.h to coregrind Makefile.am noinst_HEADERS
[valgrind.git] / memcheck / tests / freebsd / bug464476.cpp
blob001ac216735fa60541eac2b4b471422f3112e40a
1 // roughly based on the code for Firefox class BinaryPath
2 // https://searchfox.org/mozilla-central/source/xpcom/build/BinaryPath.h#185
4 #include <iostream>
5 #include <sys/types.h>
6 #include <sys/sysctl.h>
7 #include <limits.h>
8 #include <string>
10 using std::cerr;
11 using std::cout;
12 using std::string;
14 int main(int argc, char **argv)
16 char aResult[PATH_MAX];
17 int mib[4];
18 mib[0] = CTL_KERN;
19 mib[1] = KERN_PROC;
20 mib[2] = KERN_PROC_PATHNAME;
21 mib[3] = -1;
23 size_t len = PATH_MAX;
24 if (sysctl(mib, 4, aResult, &len, nullptr, 0) < 0) {
25 cerr << "sysctl failed\n";
26 return -1;
28 if (string(aResult) == argv[1]) {
29 cout << "OK\n";
30 } else {
31 cerr << "Not OK aResult " << aResult << " argv[1] " << argv[1] << '\n';