ENDPROTOENT(3P)
π ENDPROTOENT(3P) π
okay bestie, so this is a page from the POSIX Programmer's Manual β the 3P is giving "POSIX library functions" energy, iykyk β¨
πΈ PROLOG πΈ
Real talk first, bestie: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. π So don't come for me if it's not there.
β¨ NAME β¨
endprotoent, getprotobyname, getprotobynumber, getprotoent, setprotoent β network protocol database functions. it's giving "who is this protocol and why do I need to know" π
π¦ SYNOPSIS π¦
#include <netdb.h>
void endprotoent(void);
struct protoent *getprotobyname(const char *name);
struct protoent *getprotobynumber(int proto);
struct protoent *getprotoent(void);
void setprotoent(int stayopen);
π DESCRIPTION π
So these functions retrieve information about protocols. This info is considered to be stored in a database that you can access either sequentially or randomly. The implementation of this database is unspecified β like, nobody's telling you how it works under the hood, and that's on purpose. π«Ά
The setprotoent() function shall open a connection to the database, and set the next entry to the first entry. If the stayopen argument is non-zero, the connection to the network protocol database shall not be closed after each call to getprotoent() (whether that call is direct, or happens indirectly through one of the other getproto*() functions) β and the implementation may maintain an open file descriptor for the database. so basically: keep the door open, bestie. πͺβ¨
The getprotobyname() function shall search the database from the beginning and find the first entry for which the protocol name specified by name matches the p_name member β opening and closing a connection to the database as necessary.
The getprotobynumber() function shall search the database from the beginning and find the first entry for which the protocol number specified by proto matches the p_proto member β opening and closing a connection to the database as necessary.
The getprotoent() function shall read the next entry of the database, opening and closing a connection to the database as necessary. it's giving "one at a time, in order, no skipping" π
The getprotobyname(), getprotobynumber(), and getprotoent() functions shall each return a pointer to a protoent structure, and the members of that structure shall contain the fields of an entry in the network protocol database.
The endprotoent() function shall close the connection to the database, releasing any open file descriptor. bye bestie, door's closed, lights off. π
These functions need not be thread-safe. no cap. don't say I didn't warn you.
β RETURN VALUE β
Upon successful completion, getprotobyname(), getprotobynumber(), and getprotoent() return a pointer to a protoent structure if the requested entry was found, and a null pointer if the end of the database was reached or the requested entry was not found. Otherwise, a null pointer is returned. π€·βοΈ
The application shall not modify the structure to which the return value points, nor any storage areas pointed to by pointers within the structure. 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 getprotobyname(), getprotobynumber(), or getprotoent(). The returned pointer, and pointers within the structure, might also be invalidated if the calling thread is terminated. π so like, screenshot it in your brain but don't touch it, and definitely don't hold onto it forever.
π ERRORS π
No errors are defined. (iconic, honestly. nothing to report. π)
The following sections are informative. (aka: the vibes section, not the law section β¨)
π EXAMPLES π
None. π nope, not a single one. we're keeping it mysterious.
π APPLICATION USAGE π
None. π also nothing here. slay.
π§ RATIONALE π§
None. π§ the reasoning is lost to time, bestie.
π FUTURE DIRECTIONS π
None. π the future is a mystery and that's fine.
π₯ SEE ALSO π₯
- The Base Definitions volume of POSIX.1β2017,
<netdb.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 .
and that's the whole page, bestie β brought to you by IEEE/The Open Group, dated 2017, living its best life in the POSIX Programmer's Manual. π mwah, go read a man page, ily π«Ά
π¦ 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