ENDHOSTENT(3POSIX)
π ENDHOSTENT π (that's the 3POSIX page, bestie β straight out of the POSIX Programmer's Manual)
πΈ PROLOG πΈ
Okay so first things first, tiny lil heads-up: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the actual Linux tea β), or honestly the interface might not even be implemented on Linux at all. π
β¨ NAME β¨
endhostent, gethostent, sethostent β network host database functions π¦
π SYNOPSIS π
#include <netdb.h>
void endhostent(void);
struct hostent *gethostent(void);
void sethostent(int stayopen);
π DESCRIPTION π
So these functions shall retrieve information about hosts. That info is considered to be stored in a database that you can access sequentially or randomly. The implementation of this database is unspecified β so like, it's giving mystery, it's giving "we don't know her". π
Note: in many cases this database is implemented by the Domain Name System, as documented in RFC 1034, RFC 1035, and RFC 1886.
The sethostent() function shall open a connection to the database and set the next entry for retrieval to the first entry in the database. If the stayopen argument is non-zero, the connection shall not be closed by a call to gethostent(), and the implementation may maintain an open file descriptor. (Iconic. Keeping that fd open like it's holding your spot in line. π«Ά)
The gethostent() function shall read the next entry in the database, opening and closing a connection to the database as necessary.
Entries shall be returned in hostent structures.
The endhostent() function shall close the connection to the database, releasing any open file descriptor. (Closure. We love to see it. π§)
These functions need not be thread-safe. No cap. Protect your peace and your threads accordingly.
π₯ RETURN VALUE π₯
Upon successful completion, the gethostent() function shall return a pointer to a hostent 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. π
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 gethostent(). The returned pointer, and pointers within the structure, might also be invalidated if the calling thread is terminated.
Translation bestie: that pointer is not yours to keep. It's a rental. Do not redecorate. Do not hold onto it across calls. π
π ERRORS π
No errors are defined for endhostent(), gethostent(), and sethostent(). Literally none. Zero. The drama is elsewhere.
The following sections are informative. (So like, vibe reading, not law reading. πβ¨)
πΈ EXAMPLES πΈ
None. π«₯
π¦ APPLICATION USAGE π¦
None.
π RATIONALE π
None.
β FUTURE DIRECTIONS β
None.
π SEE ALSO π
endservent()- 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!! ππ This masterpiece of a spec is brought to you by IEEE/The Open Group, 2017 β aka the ENDHOSTENT(3POSIX) girlies themselves. Stay open, stay sequential, and close that connection when you're done. Periodt. π
β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms