poll.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* poll.c
*
* Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
* modify it under the same terms as Perl itself.
*
* For systems that do not have the poll() system call (for example Linux
* kernels < v2.1.23) try to emulate it as closely as possible using select()
*
*/
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "poll.h"
#ifdef I_SYS_TIME
#endif
#ifdef I_TIME
# include <time.h>
#endif
#if defined(HAS_SOCKET) && !defined(VMS) && !defined(ultrix) /* VMS handles sockets via vmsish.h, ULTRIX dies of socket struct redefinitions */
#endif
#include <errno.h>
#ifdef HAS_SELECT
#ifdef I_SYS_SELECT
#endif
#endif
#ifdef EMULATE_POLL_WITH_SELECT
int
{
int i,err;
int n = 0;
int count;
for(i = 0 ; i < (int)nfds ; i++) {
continue;
if(fd > n)
n = fd;
if(events & POLL_CAN_READ)
if(events & POLL_CAN_WRITE)
if(events & POLL_HAS_EXCP)
}
if(timeout >= 0) {
}
if(err < 0) {
#ifdef HAS_FSTAT
for(i = 0 ; i < nfds ; i++) {
goto again;
}
}
}
#endif /* HAS_FSTAT */
return err;
}
count = 0;
for(i = 0 ; i < (int)nfds ; i++) {
if(fd < 0)
continue;
else {
revents &= ~POLL_CAN_READ;
revents &= ~POLL_CAN_WRITE;
revents &= ~POLL_HAS_EXCP;
}
count++;
}
return count;
}
#endif /* EMULATE_POLL_WITH_SELECT */
/* gcc for SunOS 4 produces code from an empty (code/symbolwise)
* ld: poll.o: premature EOF
* To avoid this, have at least something in here. */
static int dummy;
#endif