1 /*** 2 This file is part of PulseAudio. 3 4 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB 5 6 PulseAudio is free software; you can redistribute it and/or modify 7 it under the terms of the GNU Lesser General Public License as published 8 by the Free Software Foundation; either version 2.1 of the License, 9 or (at your option) any later version. 10 11 PulseAudio is distributed in the hope that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public License 17 along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 18 ***/ 19 20 /*** 21 Based on work for the GNU C Library. 22 Copyright (C) 1994,96,97,98,99,2000,2001,2004 Free Software Foundation, Inc. 23 ***/ 24 25 #if defined(HAVE_POLL_H) 26 #include <poll.h> 27 #else 28 29 /* Event types that can be polled for. These bits may be set in `events' 30 to indicate the interesting event types; they will appear in `revents' 31 to indicate the status of the file descriptor. */ 32 #define POLLIN 0x001 /* There is data to read. */ 33 #define POLLPRI 0x002 /* There is urgent data to read. */ 34 #define POLLOUT 0x004 /* Writing now will not block. */ 35 36 /* Event types always implicitly polled for. These bits need not be set in 37 `events', but they will appear in `revents' to indicate the status of 38 the file descriptor. */ 39 #define POLLERR 0x008 /* Error condition. */ 40 #define POLLHUP 0x010 /* Hung up. */ 41 #define POLLNVAL 0x020 /* Invalid polling request. */ 42 43 /* Data structure describing a polling request. */ 44 struct pollfd { 45 int fd; /* File descriptor to poll. */ 46 short int events; /* Types of events poller cares about. */ 47 short int revents; /* Types of events that actually occurred. */ 48 }; 49 50 /* Poll the file descriptors described by the NFDS structures starting at 51 FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for 52 an event to occur; if TIMEOUT is -1, block until an event occurs. 53 Returns the number of file descriptors with events, zero if timed out, 54 or -1 for errors. */ 55 56 #endif /* HAVE_POLL_H */ 57 58 #if defined(HAVE_POLL_H) && !defined(OS_IS_DARWIN) 59 #define pa_poll(fds,nfds,timeout) poll((fds),(nfds),(timeout)) 60 #else 61 int pa_poll(struct pollfd *fds, unsigned long nfds, int timeout); 62 #endif 63