net_if.h(7POSIX)
πΈ net_if.h(7POSIX) πΈ
ok bestie, so this is a page from the POSIX Programmer's Manual β yes, the whole net_if.h thing, 7POSIX section and all. Come sit with me, we're doing network interface lore today π
β¨ PROLOG β¨
So like, heads up: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so if you're on Linux, go read the corresponding Linux manual page for the deets on Linux behavior, fr), or honestly the interface might not even be implemented on Linux at all. Not me warning you up front π«Ά
π NAME π
net/if.h β sockets local interfaces. That's it, that's the vibe. Local interfaces for your sockets β¨
π SYNOPSIS π
#include <net/if.h>
π DESCRIPTION π
okay so the <net/if.h> header shall define the if_nameindex structure, and it has to include at least these members:
unsigned if_index Numeric index of the interface.
char *if_name Null-terminated name of the interface.
if_index is the numeric index of the interface, and if_name is the null-terminated name of the interface. iconic duo, no cap.
The <net/if.h> header shall also define this symbolic constant for the length of a buffer that contains an interface name (and yes, that length includes the terminating NULL character, don't forget the terminator bestie π):
IF_NAMESIZEβ Interface name length.
And the following shall be declared as functions, and they may also be defined as macros. Function prototypes shall be provided. Look at them, they're gorgeous:
void if_freenameindex(struct if_nameindex *);
char *if_indextoname(unsigned, char *);
struct if_nameindex *if_nameindex(void);
unsigned if_nametoindex(const char *);
Also, just so you know: the following sections are informative. Not normative. Informative. Big difference, iykyk π
π APPLICATION USAGE π
None. Literally none. The section is giving absolutely nothing and I respect it π
π¦ RATIONALE π¦
None. Empty. A whole blank moment β¨
β FUTURE DIRECTIONS β
None. Nothing coming. The future is quiet π
πΈ SEE ALSO πΈ
The System Interfaces volume of POSIX.1β2017, plus these besties: if_freenameindex(), if_indextoname(), if_nameindex(), if_nametoindex(). Go read them, they're the whole point π«Ά
π COPYRIGHT π
okay so legal moment, don't skip it:
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 one's brought to you by IEEE/The Open Group, 2017 β yeah, 2017, she's vintage and she still ate π mwah, go read a man page, ily β¨
π¦ 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