dfs_poll.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #ifndef DFS_POLL_H__
  10. #define DFS_POLL_H__
  11. #include <rtthread.h>
  12. #ifdef RT_USING_POSIX
  13. #if defined(RT_USING_MLIB)
  14. #include <time.h>
  15. #else
  16. #include <sys/time.h> /* for struct timeval */
  17. #endif
  18. #if !defined(POLLIN) && !defined(POLLOUT)
  19. #define POLLIN (0x01)
  20. #define POLLRDNORM (0x01)
  21. #define POLLRDBAND (0x01)
  22. #define POLLPRI (0x01)
  23. #define POLLOUT (0x02)
  24. #define POLLWRNORM (0x02)
  25. #define POLLWRBAND (0x02)
  26. #define POLLERR (0x04)
  27. #define POLLHUP (0x08)
  28. #define POLLNVAL (0x10)
  29. typedef unsigned int nfds_t;
  30. struct pollfd
  31. {
  32. int fd;
  33. short events;
  34. short revents;
  35. };
  36. #endif /* !defined(POLLIN) && !defined(POLLOUT) */
  37. #define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
  38. int poll(struct pollfd *fds, nfds_t nfds, int timeout);
  39. #endif /* RT_USING_POSIX */
  40. #endif /* DFS_POLL_H__ */