]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/getgrent.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / getgrent.3
CommitLineData
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
30getgrent, 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 43The \fBgetgrent\fP()
f2738b39
MK
44function returns a pointer to a structure containing
45the broken-out fields of a record in the group database
c13182ef 46(e.g., the local group file
f2738b39
MK
47.IR /etc/group ,
48NIS, and LDAP).
49The first time it is called
fea681da
MK
50it returns the first entry; thereafter, it returns successive entries.
51.PP
c13182ef 52The \fBsetgrent\fP() function rewinds to the beginning
f2738b39 53of the group database, to allow repeated scans.
fea681da 54.PP
63aa9df0 55The \fBendgrent\fP() function is used to close the group database
f2738b39 56after all processing has been performed.
fea681da
MK
57.PP
58The \fIgroup\fP structure is defined in \fI<grp.h>\fP as follows:
59.sp
f2738b39 60.RS +0.25i
fea681da 61.nf
fea681da 62struct 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 71The \fBgetgrent\fP() function returns a pointer to a
c13182ef
MK
72.I group
73structure,
fea681da
MK
74or NULL if there are no more entries or an error occurs.
75.LP
76Upon error,
77.I errno
f2738b39
MK
78may be set.
79If one wants to check
80.I errno
81after the call, it should be set to zero before the call.
fea681da
MK
82.SH ERRORS
83.TP
84.B EINTR
85A signal was caught.
86.TP
87.B EIO
88I/O error.
89.TP
90.B EMFILE
91The calling process already has too many open files.
92.TP
93.B ENFILE
94Too many open files in the system.
95.TP
fea681da 96.B ENOMEM
f2738b39 97.\" not in POSIX
fea681da 98Insufficient memory to allocate group information structure.
f2738b39
MK
99.TP
100.B ERANGE
101Insufficient buffer space supplied.
fea681da
MK
102.SH FILES
103.TP
104.I /etc/group
f2738b39 105local group database file
fea681da 106.SH "CONFORMING TO"
68e1685c 107SVr4, 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)