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