// 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