1b39c5158Smillert /* 2b39c5158Smillert * poll.h 3b39c5158Smillert * 4b39c5158Smillert * Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved. 5b39c5158Smillert * This program is free software; you can redistribute it and/or 6b39c5158Smillert * modify it under the same terms as Perl itself. 7b39c5158Smillert * 8b39c5158Smillert */ 9b39c5158Smillert 10b39c5158Smillert #ifndef POLL_H 11b39c5158Smillert # define POLL_H 12b39c5158Smillert 13*e0680481Safresh1 #if (defined(HAS_POLL) && defined(I_POLL)) || (defined(POLLWRBAND) && !defined(_WIN32)) 14b39c5158Smillert # include <poll.h> 15b8851fccSafresh1 #elif (defined(HAS_POLL) && defined(I_SYS_POLL)) 16b8851fccSafresh1 # include <sys/poll.h> 17b39c5158Smillert #else 18b39c5158Smillert #ifdef HAS_SELECT 19b39c5158Smillert 20b39c5158Smillert 21b39c5158Smillert /* We shall emulate poll using select */ 22b39c5158Smillert 23b39c5158Smillert #define EMULATE_POLL_WITH_SELECT 24b39c5158Smillert 25*e0680481Safresh1 #ifdef _WIN32 26*e0680481Safresh1 # include <winsock2.h> 27*e0680481Safresh1 #endif 28*e0680481Safresh1 29b39c5158Smillert #ifdef poll 30b39c5158Smillert # undef poll 31b39c5158Smillert #endif 32b39c5158Smillert #define poll Perl_my_poll 33b39c5158Smillert 34*e0680481Safresh1 #if WINVER < 0x0600 35b39c5158Smillert typedef struct pollfd { 36b39c5158Smillert int fd; 37b39c5158Smillert short events; 38b39c5158Smillert short revents; 39b39c5158Smillert } pollfd_t; 40b39c5158Smillert 41b39c5158Smillert #define POLLIN 0x0001 42b39c5158Smillert #define POLLPRI 0x0002 43b39c5158Smillert #define POLLOUT 0x0004 44b39c5158Smillert #define POLLRDNORM 0x0040 45b39c5158Smillert #define POLLWRNORM POLLOUT 46b39c5158Smillert #define POLLRDBAND 0x0080 47b39c5158Smillert #define POLLWRBAND 0x0100 48b39c5158Smillert #define POLLNORM POLLRDNORM 49b39c5158Smillert 50b39c5158Smillert /* Return ONLY events (NON testable) */ 51b39c5158Smillert 52b39c5158Smillert #define POLLERR 0x0008 53b39c5158Smillert #define POLLHUP 0x0010 54b39c5158Smillert #define POLLNVAL 0x0020 55b39c5158Smillert 56*e0680481Safresh1 #endif 57*e0680481Safresh1 58b39c5158Smillert int poll (struct pollfd *, unsigned long, int); 59b39c5158Smillert 60b39c5158Smillert #ifndef HAS_POLL 61b39c5158Smillert # define HAS_POLL 62b39c5158Smillert #endif 63b39c5158Smillert 64b39c5158Smillert #endif /* HAS_SELECT */ 65b39c5158Smillert 66b39c5158Smillert #endif /* I_POLL */ 67b39c5158Smillert 68b39c5158Smillert #endif /* POLL_H */ 69b39c5158Smillert 70