fakepoll.h 993 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Copyright 2002,2003 Nick Mathewson, Roger Dingledine. */
  2. /* See LICENSE for licensing information */
  3. /* $Id$ */
  4. #ifndef __FAKEPOLL_H
  5. #define __FAKEPOLL_H
  6. /**
  7. * \file fakepoll.h
  8. * \brief Headers for fakepoll.c
  9. */
  10. #include "orconfig.h"
  11. #define POLL_NO_WARN
  12. #if defined(HAVE_POLL_H)
  13. #include <poll.h>
  14. #elif defined(HAVE_SYS_POLL_H)
  15. #include <sys/poll.h>
  16. #endif
  17. /* If _POLL_EMUL_H_ is defined, then poll is just a just a thin wrapper around
  18. * select. On Mac OS 10.3, this wrapper is kinda flaky, and we should
  19. * use our own.
  20. */
  21. #if !(defined(HAVE_POLL_H)||defined(HAVE_SYS_POLL_H))&&!defined(_POLL_EMUL_H_)
  22. #define USE_FAKE_POLL
  23. #endif
  24. #if defined USE_FAKE_POLL && !defined(_POLL_EMUL_H_)
  25. struct pollfd {
  26. int fd;
  27. short events;
  28. short revents;
  29. };
  30. #define POLLIN 0x0001
  31. #define POLLPRI 0x0002
  32. #define POLLOUT 0x0004
  33. #define POLLERR 0x0008
  34. #define POLLHUP 0x0010
  35. #define POLLNVAL 0x0020
  36. #endif
  37. int tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout);
  38. #endif