]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
2 | .\" | |
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. | |
6 | .\" | |
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. | |
c13182ef | 11 | .\" |
fea681da MK |
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 | |
18 | .\" professionally. | |
c13182ef | 19 | .\" |
fea681da MK |
20 | .\" Formatted or processed versions of this manual, if unaccompanied by |
21 | .\" the source, must acknowledge the copyright and authors of this work. | |
22 | .\" | |
23 | .\" References consulted: | |
24 | .\" Linux libc source code | |
25 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
26 | .\" 386BSD man pages | |
27 | .\" Modified Sat Jul 24 19:29:54 1993 by Rik Faith (faith@cs.unc.edu) | |
28 | .TH GETGRENT 3 1993-04-04 "" "Linux Programmer's Manual" | |
29 | .SH NAME | |
30 | getgrent, setgrent, endgrent \- get group file entry | |
31 | .SH SYNOPSIS | |
32 | .nf | |
33 | .B #include <sys/types.h> | |
34 | .B #include <grp.h> | |
35 | .sp | |
36 | .B struct group *getgrent(void); | |
37 | .sp | |
38 | .B void setgrent(void); | |
39 | .sp | |
40 | .B void endgrent(void); | |
41 | .fi | |
42 | .SH DESCRIPTION | |
63aa9df0 | 43 | The \fBgetgrent\fP() |
f2738b39 MK |
44 | function returns a pointer to a structure containing |
45 | the broken-out fields of a record in the group database | |
c13182ef | 46 | (e.g., the local group file |
f2738b39 MK |
47 | .IR /etc/group , |
48 | NIS, and LDAP). | |
49 | The first time it is called | |
fea681da MK |
50 | it returns the first entry; thereafter, it returns successive entries. |
51 | .PP | |
c13182ef | 52 | The \fBsetgrent\fP() function rewinds to the beginning |
f2738b39 | 53 | of the group database, to allow repeated scans. |
fea681da | 54 | .PP |
63aa9df0 | 55 | The \fBendgrent\fP() function is used to close the group database |
f2738b39 | 56 | after all processing has been performed. |
fea681da MK |
57 | .PP |
58 | The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows: | |
59 | .sp | |
f2738b39 | 60 | .RS +0.25i |
fea681da | 61 | .nf |
fea681da | 62 | struct group { |
f2738b39 MK |
63 | char *gr_name; /* group name */ |
64 | char *gr_passwd; /* group password */ | |
34c97781 | 65 | gid_t gr_gid; /* group ID */ |
f2738b39 | 66 | char **gr_mem; /* group members */ |
fea681da | 67 | }; |
fea681da MK |
68 | .fi |
69 | .RE | |
70 | .SH "RETURN VALUE" | |
63aa9df0 | 71 | The \fBgetgrent\fP() function returns a pointer to a |
c13182ef MK |
72 | .I group |
73 | structure, | |
fea681da MK |
74 | or NULL if there are no more entries or an error occurs. |
75 | .LP | |
76 | Upon error, | |
77 | .I errno | |
f2738b39 MK |
78 | may be set. |
79 | If one wants to check | |
80 | .I errno | |
81 | after the call, it should be set to zero before the call. | |
fea681da MK |
82 | .SH ERRORS |
83 | .TP | |
84 | .B EINTR | |
85 | A signal was caught. | |
86 | .TP | |
87 | .B EIO | |
88 | I/O error. | |
89 | .TP | |
90 | .B EMFILE | |
91 | The calling process already has too many open files. | |
92 | .TP | |
93 | .B ENFILE | |
94 | Too many open files in the system. | |
95 | .TP | |
fea681da | 96 | .B ENOMEM |
f2738b39 | 97 | .\" not in POSIX |
fea681da | 98 | Insufficient memory to allocate group information structure. |
f2738b39 MK |
99 | .TP |
100 | .B ERANGE | |
101 | Insufficient buffer space supplied. | |
fea681da MK |
102 | .SH FILES |
103 | .TP | |
104 | .I /etc/group | |
f2738b39 | 105 | local group database file |
fea681da | 106 | .SH "CONFORMING TO" |
68e1685c | 107 | SVr4, 4.3BSD, POSIX.1-2001. |
fea681da MK |
108 | .SH "SEE ALSO" |
109 | .BR fgetgrent (3), | |
110 | .BR getgrent_r (3), | |
111 | .BR getgrgid (3), | |
c9c3b6f3 MK |
112 | .BR getgrnam (3), |
113 | .BR putgrent (3) |