poll.h(0P)

✨ poll.h ✨ β€” the POSIX glow-up πŸ’…

okay bestie, we're diving into poll.h, straight out of the POSIX Programmer's Manual (that's the 0P in the header, iykyk). Buckle up, this one's short but it's load-bearing. 🫢


🌸 PROLOG 🌸

so like, real talk first: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for the deets on Linux behavior), or the interface may not be implemented on Linux at all. Not me warning you before you commit πŸ’€


πŸ‘‘ NAME πŸ‘‘

poll.h β€” definitions for the poll() function. That's the whole job. She's a header. She contains multitudes. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <poll.h>

that's it. that's the line. slay. πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the <poll.h> header shall define the pollfd structure, and it shall include at least these members:

int    fd       The following descriptor being polled.
short  events   The input event flags (see below).
short  revents  The output event flags (see below).

input flags go in events, output flags come back in revents. that's the whole vibe. πŸ”


The <poll.h> header shall define the following type through typedef:

  • nfds_t β€” an unsigned integer type used for the number of file descriptors. (she counts. she's the count girlie. πŸ”’)

The implementation shall support one or more programming environments in which the width of nfds_t is no greater than the width of type long. The names of these programming environments can be obtained using the confstr() function or the getconf utility. portable girlies, take note πŸ“


The <poll.h> header shall define the following symbolic constants β€” and zero or more of which may be OR'ed together to form the events or revents members in the pollfd structure:

  • POLLIN β€” Data other than high-priority data may be read without blocking. πŸ“₯
  • POLLRDNORM β€” Normal data may be read without blocking.
  • POLLRDBAND β€” Priority data may be read without blocking.
  • POLLPRI β€” High priority data may be read without blocking. ⚑
  • POLLOUT β€” Normal data may be written without blocking. πŸ“€
  • POLLWRNORM β€” Equivalent to POLLOUT.
  • POLLWRBAND β€” Priority data may be written.
  • POLLERR β€” An error has occurred (revents only). πŸ’€
  • POLLHUP β€” Device has been disconnected (revents only). πŸͺ«
  • POLLNVAL β€” Invalid fd member (revents only). 🚫
ngl the revents-only ones are the ones that show up uninvited. You didn't ask for them in events. They just arrive. main character energy fr.

The significance and semantics of normal, priority, and high-priority data are file and device-specific. So like, don't @ me, @ your driver. 🫠


The following shall be declared as a function and may also be defined as a macro. A function prototype shall be provided.

int   poll(struct pollfd [], nfds_t, int);

iconic signature. no notes. πŸ‘‘


The following sections are informative. (aka: the chill ones, no requirements here bestie)


🌈 APPLICATION USAGE 🌈

None.

(yeah. she said nothing. respect. πŸ™ˆ)


🧚 RATIONALE 🧚

None.

(also nothing. a queen of restraint. ✨)


⭐ FUTURE DIRECTIONS ⭐

None.

(no plans, no drama, no roadmap. she's at peace. 🌸)


πŸ”₯ SEE ALSO πŸ”₯

  • The System Interfaces volume of POSIX.1‐2017, confstr(), poll()
  • The Shell and Utilities volume of POSIX.1‐2017, getconf

go read those, bestie, they're the sequel πŸ’œ


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, and honestly? she ate. no crumbs. periodt. πŸ’…πŸ¦‹πŸ‘‘
πŸ“¦ where this page comes from