poll.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-09-11 Meco Man First version
  9. */
  10. #ifndef __POLL_H__
  11. #define __POLL_H__
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #ifdef RT_USING_MUSLLIBC
  16. #if !defined(POLLIN) && !defined(POLLOUT)
  17. #define POLLIN 0x001
  18. #define POLLPRI 0x002
  19. #define POLLOUT 0x004
  20. #define POLLERR 0x008
  21. #define POLLHUP 0x010
  22. #define POLLNVAL 0x020
  23. #define POLLRDNORM 0x040
  24. #define POLLRDBAND 0x080
  25. #define POLLWRNORM 0x100
  26. #define POLLWRBAND 0x200
  27. typedef unsigned int nfds_t;
  28. struct pollfd
  29. {
  30. int fd;
  31. short events;
  32. short revents;
  33. };
  34. #endif
  35. #else
  36. #if !defined(POLLIN) && !defined(POLLOUT)
  37. #define POLLIN 0x1
  38. #define POLLOUT 0x2
  39. #define POLLERR 0x4
  40. #define POLLNVAL 0x8
  41. /* Below values are unimplemented */
  42. #define POLLRDNORM 0x10
  43. #define POLLRDBAND 0x20
  44. #define POLLPRI 0x40
  45. #define POLLWRNORM 0x80
  46. #define POLLWRBAND 0x100
  47. #define POLLHUP 0x200
  48. typedef unsigned int nfds_t;
  49. struct pollfd
  50. {
  51. int fd;
  52. short events;
  53. short revents;
  54. };
  55. #endif
  56. #endif /* !defined(POLLIN) && !defined(POLLOUT) */
  57. #define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
  58. int poll(struct pollfd *fds, nfds_t nfds, int timeout);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif /* __POLL_H__ */