]> code.delx.au - pulseaudio/blob - polyp/poll.h
c201014eb423003133f0f2454bc211749d9bfb53
[pulseaudio] / polyp / poll.h
1 /* $Id$ */
2
3 /***
4 Compatibility definitions for System V `poll' interface.
5 Copyright (C) 1994,96,97,98,99,2000,2001,2004 Free Software Foundation, Inc.
6 Copyright (C) 2005, Cendio AB.
7 This file is part of polypaudio.
8 Based on work for the GNU C Library.
9
10 polypaudio is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Library General Public License as published
12 by the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 polypaudio is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public
21 License along with polypaudio; If not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 USA.
24 ***/
25
26 /* Event types that can be polled for. These bits may be set in `events'
27 to indicate the interesting event types; they will appear in `revents'
28 to indicate the status of the file descriptor. */
29 #define POLLIN 0x001 /* There is data to read. */
30 #define POLLPRI 0x002 /* There is urgent data to read. */
31 #define POLLOUT 0x004 /* Writing now will not block. */
32
33 /* Event types always implicitly polled for. These bits need not be set in
34 `events', but they will appear in `revents' to indicate the status of
35 the file descriptor. */
36 #define POLLERR 0x008 /* Error condition. */
37 #define POLLHUP 0x010 /* Hung up. */
38 #define POLLNVAL 0x020 /* Invalid polling request. */
39
40
41 /* Type used for the number of file descriptors. */
42 typedef unsigned long int nfds_t;
43
44 /* Data structure describing a polling request. */
45 struct pollfd
46 {
47 int fd; /* File descriptor to poll. */
48 short int events; /* Types of events poller cares about. */
49 short int revents; /* Types of events that actually occurred. */
50 };
51
52 /* Poll the file descriptors described by the NFDS structures starting at
53 FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
54 an event to occur; if TIMEOUT is -1, block until an event occurs.
55 Returns the number of file descriptors with events, zero if timed out,
56 or -1 for errors. */
57 extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);