blob: b3d3ee4e6eab9e7d94a916405c1f9cb589690e68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// SPDX-License-Identifier: GPL-3.0-or-later
#include "../libnetdata.h"
#if defined(OS_MACOS)
int getsysctl_by_name(const char *name, void *ptr, size_t len) {
size_t nlen = len;
if (unlikely(sysctlbyname(name, ptr, &nlen, NULL, 0) == -1)) {
netdata_log_error("MACOS: sysctl(%s...) failed: %s", name, strerror(errno));
return 1;
}
if (unlikely(nlen != len)) {
netdata_log_error("MACOS: sysctl(%s...) expected %lu, got %lu", name, (unsigned long)len, (unsigned long)nlen);
return 1;
}
return 0;
}
#endif
|