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