[PATCH 04/13] libcsupport: Add dummy for setgroups().

Christian Mauderer christian.mauderer at embedded-brains.de
Thu Apr 21 08:49:44 UTC 2016


From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>

The dummy for setgroups() allows applications using it to build (for example
civetweb webserver).
---
 cpukit/libcsupport/Makefile.am                 |  2 +-
 cpukit/libcsupport/src/setgroups.c             | 26 ++++++++++++++++++++
 testsuites/psxtests/psxhdrs/Makefile.am        |  1 +
 testsuites/psxtests/psxhdrs/unistd/setgroups.c | 33 ++++++++++++++++++++++++++
 4 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 cpukit/libcsupport/src/setgroups.c
 create mode 100644 testsuites/psxtests/psxhdrs/unistd/setgroups.c

diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
index b3ad3db..effe426 100644
--- a/cpukit/libcsupport/Makefile.am
+++ b/cpukit/libcsupport/Makefile.am
@@ -73,7 +73,7 @@ DIRECTORY_SCAN_C_FILES += src/getcwd.c
 ID_C_FILES = src/getegid.c src/geteuid.c src/getgid.c src/getgroups.c \
     src/getlogin.c src/getpgrp.c src/getpid.c src/getppid.c src/getuid.c \
     src/seteuid.c src/setgid.c src/setuid.c src/setegid.c src/setpgid.c \
-    src/setsid.c
+    src/setsid.c src/setgroups.c 
 
 MALLOC_C_FILES = src/malloc_initialize.c src/malloc.c \
     src/realloc.c src/_calloc_r.c src/_malloc_r.c \
diff --git a/cpukit/libcsupport/src/setgroups.c b/cpukit/libcsupport/src/setgroups.c
new file mode 100644
index 0000000..9f75f20
--- /dev/null
+++ b/cpukit/libcsupport/src/setgroups.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#include <unistd.h>
+
+int setgroups(int size, const gid_t *list)
+{
+	/* FIXME: Implement this function properly. Currently it only returns a
+	 * success. */
+
+	(void) size;
+	(void) list;
+
+	return 0;
+}
diff --git a/testsuites/psxtests/psxhdrs/Makefile.am b/testsuites/psxtests/psxhdrs/Makefile.am
index 3eecd84..c3b1f88 100644
--- a/testsuites/psxtests/psxhdrs/Makefile.am
+++ b/testsuites/psxtests/psxhdrs/Makefile.am
@@ -128,6 +128,7 @@ lib_a_SOURCES += unistd/getppid.c
 lib_a_SOURCES += unistd/getuid.c
 lib_a_SOURCES += unistd/pause.c
 lib_a_SOURCES += unistd/setgid.c
+lib_a_SOURCES += unistd/setgroups.c
 lib_a_SOURCES += unistd/setpgid.c
 lib_a_SOURCES += unistd/setsid.c
 lib_a_SOURCES += unistd/setuid.c
diff --git a/testsuites/psxtests/psxhdrs/unistd/setgroups.c b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
new file mode 100644
index 0000000..e8b87ab
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
@@ -0,0 +1,33 @@
+/*
+ *  This test file is used to verify that the header files associated with
+ *  invoking this function are correct.
+ *
+ *  COPYRIGHT (c) 1989-2009.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+
+int test( void );
+
+int test( void )
+{
+  gid_t grouplist[ 20 ];
+  int   gidsetsize;
+  int   result;
+
+  gidsetsize = sizeof(grouplist)/sizeof(grouplist[0]);
+
+  result = setgroups( gidsetsize, grouplist );
+
+  return result;
+}
-- 
1.8.4.5



More information about the devel mailing list