poll.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #ifndef _ESP_PLATFORM_SYS_POLL_H_
  15. #define _ESP_PLATFORM_SYS_POLL_H_
  16. #define POLLIN (1u << 0) /* data other than high-priority may be read without blocking */
  17. #define POLLRDNORM (1u << 1) /* normal data may be read without blocking */
  18. #define POLLRDBAND (1u << 2) /* priority data may be read without blocking */
  19. #define POLLPRI (POLLRDBAND) /* high-priority data may be read without blocking */
  20. // Note: POLLPRI is made equivalent to POLLRDBAND in order to fit all these events into one byte
  21. #define POLLOUT (1u << 3) /* normal data may be written without blocking */
  22. #define POLLWRNORM (POLLOUT) /* equivalent to POLLOUT */
  23. #define POLLWRBAND (1u << 4) /* priority data my be written */
  24. #define POLLERR (1u << 5) /* some poll error occurred */
  25. #define POLLHUP (1u << 6) /* file descriptor was "hung up" */
  26. #define POLLNVAL (1u << 7) /* the specified file descriptor is invalid */
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. struct pollfd {
  31. int fd; /* The descriptor. */
  32. short events; /* The event(s) is/are specified here. */
  33. short revents; /* Events found are returned here. */
  34. };
  35. typedef unsigned int nfds_t;
  36. int poll(struct pollfd *fds, nfds_t nfds, int timeout);
  37. #ifdef __cplusplus
  38. } // extern "C"
  39. #endif
  40. #endif // _ESP_PLATFORM_SYS_POLL_H_