MCPcopy Create free account
hub / github.com/catboost/catboost / FreeBSDGetExecPath

Function FreeBSDGetExecPath

util/system/execpath.cpp:45–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45static inline TString FreeBSDGetExecPath() {
46 int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
47 TTempBuf buf;
48 int r = FreeBSDSysCtl(mib, Y_ARRAY_SIZE(mib), buf);
49 if (r == 0) {
50 return TString(buf.Data(), buf.Filled() - 1);
51 } else if (r == ENOTSUP) { // older FreeBSD version
52 /*
53 * BSD analogue for /proc/self is /proc/curproc.
54 * See:
55 * https://www.freebsd.org/cgi/man.cgi?query=procfs&sektion=5&format=html
56 */
57 TString path("/proc/curproc/file");
58 return NFs::ReadLink(path);
59 } else {
60 return TString();
61 }
62}
63
64static inline TString FreeBSDGetArgv0() {
65 int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid()};

Callers 2

FreeBSDGuessExecPathFunction · 0.85
GetExecPathImplFunction · 0.85

Calls 3

FreeBSDSysCtlFunction · 0.85
DataMethod · 0.45
FilledMethod · 0.45

Tested by

no test coverage detected