00001 /* Header for poll(2) emulation 00002 Contributed by Paolo Bonzini. 00003 00004 Copyright 2001, 2002, 2003, 2007 Free Software Foundation, Inc. 00005 00006 This file is part of gnulib. 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as published by 00010 the Free Software Foundation; either version 2, or (at your option) 00011 any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU Lesser General Public License for more details. 00017 00018 You should have received a copy of the GNU Lesser General Public License along 00019 with this program; if not, write to the Free Software Foundation, 00020 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 00021 00022 #ifndef _GL_POLL_H 00023 #define _GL_POLL_H 00024 00025 /* fake a poll(2) environment */ 00026 #define POLLIN 0x0001 /* any readable data available */ 00027 #define POLLPRI 0x0002 /* OOB/Urgent readable data */ 00028 #define POLLOUT 0x0004 /* file descriptor is writeable */ 00029 #define POLLERR 0x0008 /* some poll error occurred */ 00030 #define POLLHUP 0x0010 /* file descriptor was "hung up" */ 00031 #define POLLNVAL 0x0020 /* requested events "invalid" */ 00032 #define POLLRDNORM 0x0040 00033 #define POLLRDBAND 0x0080 00034 #define POLLWRNORM 0x0100 00035 #define POLLWRBAND 0x0200 00036 00037 struct pollfd 00038 { 00039 int fd; /* which file descriptor to poll */ 00040 short events; /* events we are interested in */ 00041 short revents; /* events found on return */ 00042 }; 00043 00044 typedef unsigned long nfds_t; 00045 00046 extern int poll (struct pollfd *pfd, nfds_t nfd, int timeout); 00047 00048 /* Define INFTIM only if doing so conforms to POSIX. */ 00049 #if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) 00050 #define INFTIM (-1) 00051 #endif 00052 00053 #endif /* _GL_POLL_H */