fakepoll.h 1022 B

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