1ENDGRENT(3P)               POSIX Programmer's Manual              ENDGRENT(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       endgrent, getgrent, setgrent - group database entry functions
13

SYNOPSIS

15       #include <grp.h>
16
17       void endgrent(void);
18       struct group *getgrent(void);
19       void setgrent(void);
20
21

DESCRIPTION

23       The getgrent() function shall return a pointer to a structure  contain‐
24       ing the broken-out fields of an entry in the group database. When first
25       called, getgrent() shall return a pointer to a group structure contain‐
26       ing  the first entry in the group database. Thereafter, it shall return
27       a pointer to a group structure containing the next group  structure  in
28       the  group  database,  so  successive  calls  may be used to search the
29       entire database.
30
31       An implementation that provides extended security controls  may  impose
32       further  implementation-defined  restrictions  on  accessing  the group
33       database. In particular, the system may deny the existence of  some  or
34       all  of  the  group  database entries associated with groups other than
35       those groups associated with the caller and may omit users  other  than
36       the  caller from the list of members of groups in database entries that
37       are returned.
38
39       The setgrent() function  shall  rewind  the  group  database  to  allow
40       repeated searches.
41
42       The  endgrent() function may be called to close the group database when
43       processing is complete.
44
45       These functions need not be reentrant. A function that is not  required
46       to be reentrant is not required to be thread-safe.
47

RETURN VALUE

49       When first called, getgrent() shall return a pointer to the first group
50       structure in the group database. Upon subsequent calls it shall  return
51       the  next  group structure in the group database.  The getgrent() func‐
52       tion shall return a null pointer on end-of-file or an error  and  errno
53       may be set to indicate the error.
54
55       The  return  value may point to a static area which is overwritten by a
56       subsequent call to getgrgid(), getgrnam(), or getgrent().
57

ERRORS

59       The getgrent() function may fail if:
60
61       EINTR  A signal was caught during the operation.
62
63       EIO    An I/O error has occurred.
64
65       EMFILE {OPEN_MAX} file descriptors are currently open  in  the  calling
66              process.
67
68       ENFILE The  maximum  allowable number of files is currently open in the
69              system.
70
71
72       The following sections are informative.
73

EXAMPLES

75       None.
76

APPLICATION USAGE

78       These functions are provided due to their  historical  usage.  Applica‐
79       tions  should  avoid  dependencies  on  fields  in  the group database,
80       whether the database is a single file, or where in the file system name
81       space the database resides. Applications should use getgrnam() and get‐
82       grgid() whenever possible because it avoids these dependencies.
83

RATIONALE

85       None.
86

FUTURE DIRECTIONS

88       None.
89

SEE ALSO

91       getgrgid(), getgrnam(), getlogin(), getpwent(),  the  Base  Definitions
92       volume of IEEE Std 1003.1-2001, <grp.h>
93
95       Portions  of  this text are reprinted and reproduced in electronic form
96       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
97       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
98       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
99       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
100       event of any discrepancy between this version and the original IEEE and
101       The  Open Group Standard, the original IEEE and The Open Group Standard
102       is the referee document. The original Standard can be  obtained  online
103       at http://www.opengroup.org/unix/online.html .
104
105
106
107IEEE/The Open Group                  2003                         ENDGRENT(3P)
Impressum