fakepoll.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #include "orconfig.h"
  7. #define POLL_NO_WARN
  8. #if defined(HAVE_POLL_H)
  9. #include <poll.h>
  10. #elif defined(HAVE_SYS_POLL_H)
  11. #include <sys/poll.h>
  12. #endif
  13. /* If _POLL_EMUL_H_ is defined, then poll is just a just a thin wrapper around
  14. * select. On Mac OS 10.3, this wrapper is kinda flakey, and we should
  15. * use our own.
  16. */
  17. #if (defined(HAVE_POLL_H)||defined(HAVE_SYS_POLL_H)) && !defined(_POLL_EMUL_H_)
  18. #define tor_poll poll
  19. #else
  20. #define USE_FAKE_POLL
  21. #endif
  22. #ifdef USE_FAKE_POLL
  23. #ifndef _POLL_EMUL_H_
  24. struct pollfd {
  25. int fd;
  26. short events;
  27. short revents;
  28. };
  29. #define POLLIN 0x0001
  30. #define POLLPRI 0x0002
  31. #define POLLOUT 0x0004
  32. #define POLLERR 0x0008
  33. #define POLLHUP 0x0010
  34. #define POLLNVAL 0x0020
  35. #endif
  36. int tor_poll(struct pollfd *ufds, unsigned int nfds, int timeout);
  37. #endif
  38. #endif
  39. /*
  40. Local Variables:
  41. mode:c
  42. indent-tabs-mode:nil
  43. c-basic-offset:2
  44. End:
  45. */