summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/os/getgrouplist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnetdata/os/getgrouplist.c')
-rw-r--r--src/libnetdata/os/getgrouplist.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libnetdata/os/getgrouplist.c b/src/libnetdata/os/getgrouplist.c
new file mode 100644
index 000000000..7f32faf33
--- /dev/null
+++ b/src/libnetdata/os/getgrouplist.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#include "../libnetdata.h"
+
+int os_getgrouplist(const char *username __maybe_unused, gid_t gid __maybe_unused, gid_t *supplementary_groups __maybe_unused, int *ngroups __maybe_unused) {
+#if defined(OS_LINUX) || defined(OS_FREEBSD)
+ return getgrouplist(username, gid, supplementary_groups, ngroups);
+#endif
+
+#if defined(OS_MACOS)
+ return getgrouplist(username, gid, (int *)supplementary_groups, ngroups);
+#endif
+
+ errno = ENOSYS;
+ return -1;
+}