poll.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef _ESP_PLATFORM_SYS_POLL_H_
  7. #define _ESP_PLATFORM_SYS_POLL_H_
  8. #define POLLIN (1u << 0) /* data other than high-priority may be read without blocking */
  9. #define POLLRDNORM (1u << 1) /* normal data may be read without blocking */
  10. #define POLLRDBAND (1u << 2) /* priority data may be read without blocking */
  11. #define POLLPRI (POLLRDBAND) /* high-priority data may be read without blocking */
  12. // Note: POLLPRI is made equivalent to POLLRDBAND in order to fit all these events into one byte
  13. #define POLLOUT (1u << 3) /* normal data may be written without blocking */
  14. #define POLLWRNORM (POLLOUT) /* equivalent to POLLOUT */
  15. #define POLLWRBAND (1u << 4) /* priority data my be written */
  16. #define POLLERR (1u << 5) /* some poll error occurred */
  17. #define POLLHUP (1u << 6) /* file descriptor was "hung up" */
  18. #define POLLNVAL (1u << 7) /* the specified file descriptor is invalid */
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. struct pollfd {
  23. int fd; /* The descriptor. */
  24. short events; /* The event(s) is/are specified here. */
  25. short revents; /* Events found are returned here. */
  26. };
  27. typedef unsigned int nfds_t;
  28. int poll(struct pollfd *fds, nfds_t nfds, int timeout);
  29. #ifdef __cplusplus
  30. } // extern "C"
  31. #endif
  32. #endif // _ESP_PLATFORM_SYS_POLL_H_