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