poll_using_select.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #ifndef _POLL_USING_SELECT_H
  13. #define _POLL_USING_SELECT_H
  14. #include <sys/time.h>
  15. #include <sys/types.h>
  16. #include <unistd.h>
  17. #include "slap.h"
  18. /* uncomment for debugging info
  19. #define DEBUG_POLL_AS_SELECT
  20. */
  21. #define MSECONDS 1000
  22. struct my_pollfd {
  23. int fd;
  24. short events;
  25. short revents;
  26. };
  27. /* poll events */
  28. #define POLLIN 0x0001 /* fd is readable */
  29. #define POLLPRI 0x0002 /* high priority info at fd */
  30. #define POLLOUT 0x0004 /* fd is writeable (won't block) */
  31. #define POLLRDNORM 0x0040 /* normal data is readable */
  32. #define POLLWRNORM POLLOUT
  33. #define POLLRDBAND 0x0080 /* out-of-band data is readable */
  34. #define POLLWRBAND 0x0100 /* out-of-band data is writeable */
  35. #define POLLNORM POLLRDNORM
  36. #define POLLERR 0x0008 /* fd has error condition */
  37. #define POLLHUP 0x0010 /* fd has been hung up on */
  38. #define POLLNVAL 0x0020 /* invalid pollfd entry */
  39. int poll_using_select(struct my_pollfd *filedes, int nfds, int timeout);
  40. #endif /* _POLL_USING_SELECT_H */