1 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * POSIX Standard: 9.2.1 Group Database Access <grp.h>
32 #include <gnu/types.h>
35 /* The group structure. */
38 char *gr_name; /* Group name. */
39 char *gr_passwd; /* Password. */
40 __gid_t gr_gid; /* Group ID. */
41 char **gr_mem; /* Member list. */
45 #if defined(__USE_SVID) || defined(__USE_GNU)
51 /* Return a new stream open on the group file. */
52 extern FILE *EXFUN(__grpopen, (NOARGS));
54 /* Read a group entry from STREAM, filling in G.
55 Return the `struct group' of G if successful, NULL on failure. */
56 extern struct group *EXFUN(__grpread, (FILE *__stream, PTR __g));
58 /* Return a chunk of memory containing pre-initialized data for __grpread. */
59 extern PTR EXFUN(__grpalloc, (NOARGS));
63 #if defined(__USE_SVID) || defined(__USE_MISC)
64 /* Rewind the group-file stream. */
65 extern void EXFUN(setgrent, (NOARGS));
67 /* Close the group-file stream. */
68 extern void EXFUN(endgrent, (NOARGS));
70 /* Read an entry from the group-file stream, opening it if necessary. */
71 extern struct group *EXFUN(getgrent, (NOARGS));
75 /* Read a group entry from STREAM. */
76 extern struct group *EXFUN(fgetgrent, (FILE *__stream));
79 /* Search for an entry with a matching group ID. */
80 extern struct group *EXFUN(getgrgid, (__gid_t __gid));
82 /* Search for an entry with a matching group name. */
83 extern struct group *EXFUN(getgrnam, (CONST char *__name));
91 /* Set the group set for the current user to GROUPS (N of them). */
92 extern int EXFUN(setgroups, (size_t __n, CONST __gid_t *groups));
94 /* Initialize the group set for the current user
95 by reading the group database and using all groups
96 of which USER is a member. Also include GROUP. */
97 extern int EXFUN(initgroups, (CONST char *user, __gid_t group));