| 28 | } |
| 29 | |
| 30 | static inline int FreeBSDSysCtl(int* mib, size_t mibSize, TTempBuf& res) { |
| 31 | for (size_t i = 0; i < 2; ++i) { |
| 32 | size_t cb = res.Size(); |
| 33 | if (sysctl(mib, mibSize, res.Data(), &cb, nullptr, 0) == 0) { |
| 34 | res.Proceed(cb); |
| 35 | return 0; |
| 36 | } else if (errno == ENOMEM) { |
| 37 | res = TTempBuf(cb); |
| 38 | } else { |
| 39 | return errno; |
| 40 | } |
| 41 | } |
| 42 | return errno; |
| 43 | } |
| 44 | |
| 45 | static inline TString FreeBSDGetExecPath() { |
| 46 | int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; |
no test coverage detected