]>
sourceware.org Git - glibc.git/blob - grp/grp.h
1 /* Copyright (C) 1991, 1992, 1995, 1996 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>
30 #include <gnu/types.h>
36 /* The group structure. */
39 char *gr_name
; /* Group name. */
40 char *gr_passwd
; /* Password. */
41 __gid_t gr_gid
; /* Group ID. */
42 char **gr_mem
; /* Member list. */
46 #if defined(__USE_SVID) || defined(__USE_GNU)
52 /* Return a new stream open on the group file. */
53 extern FILE *__grpopen
__P ((void));
55 /* Read a group entry from STREAM, filling in G.
56 Return the `struct group' of G if successful, NULL on failure. */
57 extern struct group
*__grpread
__P ((FILE *__stream
, __ptr_t __g
));
59 /* Return a chunk of memory containing pre-initialized data for __grpread. */
60 extern __ptr_t __grpalloc
__P ((void));
62 /* Scan the group file, filling in G, until SELECTOR returns nonzero for an
63 entry. Return the `struct group' of G if successful, NULL on failure. */
64 extern struct group
*__grpscan
__P ((__ptr_t
*__p
,
65 int (*__selector
) (struct group
*)));
69 #if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
70 /* Rewind the group-file stream. */
71 extern void setgrent
__P ((void));
73 /* Close the group-file stream. */
74 extern void endgrent
__P ((void));
76 /* Read an entry from the group-file stream, opening it if necessary. */
77 extern struct group
*getgrent
__P ((void));
81 /* Read a group entry from STREAM. */
82 extern struct group
*fgetgrent
__P ((FILE *__stream
));
85 /* Search for an entry with a matching group ID. */
86 extern struct group
*getgrgid
__P ((__gid_t __gid
));
88 /* Search for an entry with a matching group name. */
89 extern struct group
*getgrnam
__P ((__const
char *__name
));
91 #ifdef __USE_REENTRANT
92 /* Reasonable value for the buffer sized used in the reentrant
93 functions below. But better use `sysconf'. */
94 #define NSS_BUFLEN_GROUP 1024
96 /* Reentrant versions of some of the functions above.
98 PLEASE NOTE: these functions are not yet standardized. The interface
99 may change in later versions of this library. */
101 #if defined(__USE_SVID) || defined(__USE_MISC) || defined (__USE_BSD)
102 extern int getgrent_r
__P ((struct group
*__resultbuf
, char *buffer
,
103 size_t __buflen
, struct group
**__result
));
106 /* Search for an entry with a matching group ID. */
107 extern int getgrgid_r
__P ((__gid_t __gid
, struct group
*__resultbuf
,
108 char *buffer
, size_t __buflen
,
109 struct group
**__result
));
111 /* Search for an entry with a matching group name. */
112 extern int getgrnam_r
__P ((__const
char *__name
, struct group
*__resultbuf
,
113 char *buffer
, size_t __buflen
,
114 struct group
**__result
));
117 /* Read a group entry from STREAM. */
118 extern int __fgetgrent_r
__P ((FILE * __stream
, struct group
*__resultbuf
,
119 char *buffer
, size_t __buflen
,
120 struct group
**__result
));
121 extern int fgetgrent_r
__P ((FILE * __stream
, struct group
*__resultbuf
,
122 char *buffer
, size_t __buflen
,
123 struct group
**__result
));
126 #endif /* reentrant */
131 #define __need_size_t
134 /* Set the group set for the current user to GROUPS (N of them). */
135 extern int setgroups
__P ((size_t __n
, __const __gid_t
*__groups
));
137 /* Initialize the group set for the current user
138 by reading the group database and using all groups
139 of which USER is a member. Also include GROUP. */
140 extern int initgroups
__P ((__const
char *__user
, __gid_t __group
));
142 #endif /* Use BSD. */
This page took 0.053693 seconds and 6 git commands to generate.