summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2009-04-01 16:50:10 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2009-04-01 16:50:10 +0000
commit238cf4bde3037f3bac90ab476a25bf794156e844 (patch)
tree8fcf447d81f6d00a5ca40b25486e6ed9a5a5e29a /config
parent3c9c7b99493a38590e8848dbac1b0b08d7ea995e (diff)
downloadocaml-238cf4bde3037f3bac90ab476a25bf794156e844.tar.gz
PR#3047: added Unix.setgroups, Unix.initgroups.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@9220 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'config')
-rw-r--r--config/auto-aux/initgroups.c26
-rw-r--r--config/auto-aux/setgroups.c28
-rw-r--r--config/s-templ.h8
3 files changed, 62 insertions, 0 deletions
diff --git a/config/auto-aux/initgroups.c b/config/auto-aux/initgroups.c
new file mode 100644
index 0000000000..b6e0ffbdf2
--- /dev/null
+++ b/config/auto-aux/initgroups.c
@@ -0,0 +1,26 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Copyright 2009 Institut National de Recherche en Informatique et */
+/* en Automatique. All rights reserved. This file is distributed */
+/* under the terms of the GNU Library General Public License, with */
+/* the special exception on linking described in file ../../LICENSE. */
+/* */
+/***********************************************************************/
+
+/* Contributed by Stephane Glondu <steph@glondu.net> */
+
+/* $Id$ */
+
+#include <errno.h>
+
+#include <sys/types.h>
+#include <limits.h>
+#include <grp.h>
+
+int main(void)
+{
+ if (initgroups("root", 0) == -1 && errno != EPERM) return 1;
+ return 0;
+}
diff --git a/config/auto-aux/setgroups.c b/config/auto-aux/setgroups.c
new file mode 100644
index 0000000000..5cfe49c082
--- /dev/null
+++ b/config/auto-aux/setgroups.c
@@ -0,0 +1,28 @@
+/***********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Copyright 2009 Institut National de Recherche en Informatique et */
+/* en Automatique. All rights reserved. This file is distributed */
+/* under the terms of the GNU Library General Public License, with */
+/* the special exception on linking described in file ../../LICENSE. */
+/* */
+/***********************************************************************/
+
+/* Contributed by Stephane Glondu <steph@glondu.net> */
+
+/* $Id$ */
+
+#include <errno.h>
+
+#include <sys/types.h>
+#include <limits.h>
+#include <grp.h>
+
+int main(void)
+{
+ gid_t gidset[1];
+ gidset[0] = 0;
+ if (setgroups(1, gidset) == -1 && errno != EPERM) return 1;
+ return 0;
+}
diff --git a/config/s-templ.h b/config/s-templ.h
index bc4d9643f9..4790478418 100644
--- a/config/s-templ.h
+++ b/config/s-templ.h
@@ -144,6 +144,14 @@
/* Define HAS_GETGROUPS if you have getgroups(). */
+#define HAS_SETGROUPS
+
+/* Define HAS_SETGROUPS if you have setgroups(). */
+
+#define HAS_INITGROUPS
+
+/* Define HAS_INITGROUPS if you have initgroups(). */
+
#define HAS_TERMIOS
/* Define HAS_TERMIOS if you have /usr/include/termios.h and it is