ENDGRENT(3P)
π«Ά ENDGRENT(3P) β the group database entry functions, bestie π
okay so first things first, this page is part of the POSIX Programmer's Manual β¨. heads up tho: the Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for details of Linux behavior), or honestly the interface may not even be implemented on Linux. π so like, vibe check your platform first.
β¨ NAME β¨
endgrent, getgrent, setgrent β group database entry functions π
πΈ SYNOPSIS πΈ
#include <grp.h>
void endgrent(void);
struct group *getgrent(void);
void setgrent(void);
π DESCRIPTION π
okay so getgrent() shall return a pointer to a struct containing the broken-out fields of an entry in the group database. and like, if the group database is not already open, getgrent() shall open it and hand you back a pointer to a group structure containing the first entry in the database. after that? it shall return a pointer to a group structure containing the next group structure in the group database, so you can just keep calling it and calling it and it'll walk the entire database for you. iconic behavior honestly. π§
now, an implementation that provides extended security controls may impose further implementation-defined restrictions on accessing the group database. in particular, the system may deny the existence of some or all of the group database entries associated with groups other than those groups associated with the caller π, and may omit users other than the caller from the list of members of groups in database entries that are returned. so like, don't be shocked if the vibes are limited. π
the setgrent() function shall rewind the group database so that the next getgrent() call returns the first entry β allowing repeated searches. rewind era. π
the endgrent() function shall close the group database. bye bestie π
the setgrent() and endgrent() functions shall not change the setting of errno if successful. β¨
on error, the setgrent() and endgrent() functions shall set errno to indicate the error. π¨
and since no value is returned by the setgrent() and endgrent() functions, an application wishing to check for error situations should set errno to 0, then call the function, then check errno. that's the whole ritual, no cap. π―οΈ
these functions need not be thread-safe. π§΅π
π RETURN VALUE π
on successful completion, getgrent() shall return a pointer to a group structure. on end-of-file, getgrent() shall return a null pointer and shall not change the setting of errno. on error, getgrent() shall return a null pointer and errno shall be set to indicate the error.
the application shall not modify the structure to which the return value points, nor any storage areas pointed to by pointers within the structure. like, hands off, fr fr. π
the returned pointer, and pointers within the structure, might be invalidated or the structure or the storage areas might be overwritten by a subsequent call to getgrgid(), getgrnam(), or getgrent(). the returned pointer, and pointers within the structure, might also be invalidated if the calling thread is terminated. so like, it's giving temporary. π
π₯ ERRORS π₯
these functions may fail if:
EINTRβ a signal was caught during the operation. π΅EIOβ an I/O error has occurred. π
in addition, the getgrent() and setgrent() functions may fail if:
EMFILEβ all file descriptors available to the process are currently open. πͺπͺπͺENFILEβ the maximum allowable number of files is currently open in the system. π
the following sections are informative. (so like, cute to know, not the law π)
πΈ EXAMPLES πΈ
None. (yeah, nothing, we move π«Ά)
β¨ APPLICATION USAGE β¨
these functions are provided due to their historical usage. ποΈ applications should avoid dependencies on fields in the group database, whether the database is a single file, or where in the file system name space the database resides. applications should use getgrnam() and getgrgid() whenever possible because it avoids these dependencies. like, lowkey just do that instead. π
π RATIONALE π
None.
π¦ FUTURE DIRECTIONS π¦
None.
π SEE ALSO π
endpwent(), getgrgid(), getgrnam(), getlogin()
The Base Definitions volume of POSIX.1β2017, <grp.h>
π COPYRIGHT π
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. π the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . π
okay that's the whole page bestie, mwah π this one came from IEEE/The Open Group, 2017 β the ENDGRENT(3P) of it all β and yeah, that's a wrap, slay. β¨ππ¦
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms