1995-08-09 08:06:35 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Objective Caml */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
1996-04-30 07:53:58 -07:00
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1995-08-09 08:06:35 -07:00
|
|
|
/* Automatique. Distributed only by permission. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
1995-05-08 08:18:32 -07:00
|
|
|
#include <mlvalues.h>
|
|
|
|
#include <alloc.h>
|
|
|
|
|
|
|
|
#ifdef HAS_GETGROUPS
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
1996-09-04 07:15:31 -07:00
|
|
|
#include "unixsupport.h"
|
1995-05-08 08:18:32 -07:00
|
|
|
|
|
|
|
value unix_getgroups() /* ML */
|
|
|
|
{
|
|
|
|
int gidset[NGROUPS];
|
|
|
|
int n;
|
|
|
|
value res;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
n = getgroups(NGROUPS, gidset);
|
|
|
|
if (n == -1) uerror("getgroups", Nothing);
|
|
|
|
res = alloc_tuple(n);
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
Field(res, i) = Val_int(gidset[i]);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
value unix_getgroups() { invalid_argument("getgroups not implemented"); }
|
|
|
|
|
|
|
|
#endif
|