1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
29 .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu)
30 .TH GETGRENT 3 2010-10-21 "" "Linux Programmer's Manual"
32 getgrent, setgrent, endgrent \- get group file entry
35 .B #include <sys/types.h>
38 .B struct group *getgrent(void);
40 .B void setgrent(void);
42 .B void endgrent(void);
46 Feature Test Macro Requirements for glibc (see
47 .BR feature_test_macros (7)):
54 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
55 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED ||
57 /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
63 _SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
64 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
71 function returns a pointer to a structure containing
72 the broken-out fields of a record in the group database
73 (e.g., the local group file
79 it returns the first entry; thereafter, it returns successive entries.
83 function rewinds to the beginning
84 of the group database, to allow repeated scans.
88 function is used to close the group database
89 after all processing has been performed.
91 The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
96 char *gr_name; /* group name */
97 char *gr_passwd; /* group password */
98 gid_t gr_gid; /* group ID */
99 char **gr_mem; /* group members */
104 For more information about the fields of this structure, see
109 function returns a pointer to a
112 or NULL if there are no more entries or an error occurs.
117 If one wants to check
119 after the call, it should be set to zero before the call.
121 The return value may point to a static area, and may be overwritten
122 by subsequent calls to
127 (Do not pass the returned pointer to
138 The calling process already has too many open files.
141 Too many open files in the system.
145 Insufficient memory to allocate
150 Insufficient buffer space supplied.
154 local group database file
156 SVr4, 4.3BSD, POSIX.1-2001.
162 .BR getgrouplist (3),