poll.h(7POSIX)

🌸 PROLOG 🌸

okay so real talk bestie, this page is part of the POSIX Programmer's Manual. and like, the Linux implementation of this interface? it may differ β€” so if you're on Linux, go consult the corresponding Linux manual page for the deets, or honestly the interface might not even be implemented on Linux at all. vibe check accordingly πŸ’…


✨ NAME ✨

poll.h β€” definitions for the poll() function πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <poll.h>

πŸ’– DESCRIPTION πŸ’–

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

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

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

  • nfds_t β€” an unsigned integer type used for the number of file descriptors. it's giving "how many fds are we even polling bestie" πŸ’«

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. iykyk πŸ‘‘


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. periodt ✨
  • 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. literally the same vibe 🫢
  • 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). πŸ™ˆ
the significance and semantics of normal, priority, and high-priority data are file and device-specific. so like, don't @ me, it depends on the file/device bestie 🌈

the following shall be declared as a function and may also be defined as a macro. a function prototype shall be provided. iconic behavior fr fr:

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

the following sections are informative. πŸ‘‘


🌸 APPLICATION USAGE 🌸

None. (yeah. nothing. not me expecting a whole essay 😭)


πŸ¦‹ RATIONALE πŸ¦‹

None. (same energy, empty bestie πŸ’…)


⭐ FUTURE DIRECTIONS ⭐

None. (the future is literally blank, slay ✨)


πŸ’œ SEE ALSO πŸ’œ

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

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 β€” the poll.h(7POSIX) era, and we ate πŸ’…βœ¨πŸ’–