1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" References consulted:
24 .\" Linux libc source code
25 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
27 .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu)
28 .TH GETGRENT 3 2009-03-30 "" "Linux Programmer's Manual"
30 getgrent, setgrent, endgrent \- get group file entry
33 .B #include <sys/types.h>
36 .B struct group *getgrent(void);
38 .B void setgrent(void);
40 .B void endgrent(void);
44 Feature Test Macro Requirements for glibc (see
45 .BR feature_test_macros (7)):
52 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
57 function returns a pointer to a structure containing
58 the broken-out fields of a record in the group database
59 (e.g., the local group file
62 The first time it is called
63 it returns the first entry; thereafter, it returns successive entries.
67 function rewinds to the beginning
68 of the group database, to allow repeated scans.
72 function is used to close the group database
73 after all processing has been performed.
75 The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
80 char *gr_name; /* group name */
81 char *gr_passwd; /* group password */
82 gid_t gr_gid; /* group ID */
83 char **gr_mem; /* group members */
90 function returns a pointer to a
93 or NULL if there are no more entries or an error occurs.
100 after the call, it should be set to zero before the call.
102 The return value may point to a static area, and may be overwritten
103 by subsequent calls to
108 (Do not pass the returned pointer to
119 The calling process already has too many open files.
122 Too many open files in the system.
126 Insufficient memory to allocate
131 Insufficient buffer space supplied.
135 local group database file
137 SVr4, 4.3BSD, POSIX.1-2001.
143 .BR getgrouplist (3),