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 2010-09-20 "" "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 ||
53 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
55 /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
61 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
62 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
69 function returns a pointer to a structure containing
70 the broken-out fields of a record in the group database
71 (e.g., the local group file
77 it returns the first entry; thereafter, it returns successive entries.
81 function rewinds to the beginning
82 of the group database, to allow repeated scans.
86 function is used to close the group database
87 after all processing has been performed.
89 The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
94 char *gr_name; /* group name */
95 char *gr_passwd; /* group password */
96 gid_t gr_gid; /* group ID */
97 char **gr_mem; /* group members */
104 function returns a pointer to a
107 or NULL if there are no more entries or an error occurs.
112 If one wants to check
114 after the call, it should be set to zero before the call.
116 The return value may point to a static area, and may be overwritten
117 by subsequent calls to
122 (Do not pass the returned pointer to
133 The calling process already has too many open files.
136 Too many open files in the system.
140 Insufficient memory to allocate
145 Insufficient buffer space supplied.
149 local group database file
151 SVr4, 4.3BSD, POSIX.1-2001.
157 .BR getgrouplist (3),