]> code.delx.au - pulseaudio/blob - src/pulsecore/poll.h
Add copyright notices to all relevant files. (based on svn log)
[pulseaudio] / src / pulsecore / poll.h
1 /* $Id$ */
2
3 /***
4 This file is part of PulseAudio.
5
6 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
7
8 PulseAudio is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published
10 by the Free Software Foundation; either version 2 of the License,
11 or (at your option) any later version.
12
13 PulseAudio is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with PulseAudio; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 USA.
22 ***/
23
24 /***
25 Based on work for the GNU C Library.
26 Copyright (C) 1994,96,97,98,99,2000,2001,2004 Free Software Foundation, Inc.
27 ***/
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
44 /* Type used for the number of file descriptors. */
45 typedef unsigned long int nfds_t;
46
47 /* Data structure describing a polling request. */
48 struct pollfd
49 {
50 int fd; /* File descriptor to poll. */
51 short int events; /* Types of events poller cares about. */
52 short int revents; /* Types of events that actually occurred. */
53 };
54
55 /* Poll the file descriptors described by the NFDS structures starting at
56 FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
57 an event to occur; if TIMEOUT is -1, block until an event occurs.
58 Returns the number of file descriptors with events, zero if timed out,
59 or -1 for errors. */
60 extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);