Add default-monitor-time-sec
[platform/upstream/pulseaudio.git] / src / pulsecore / poll.h
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 #elif OS_IS_WIN32 && HAVE_WINSOCK2_H && (_WIN32_WINNT >= 0x0600)
28 #include <winsock2.h>
29 #else
30
31 /* Event types that can be polled for.  These bits may be set in `events'
32    to indicate the interesting event types; they will appear in `revents'
33    to indicate the status of the file descriptor.  */
34 #define POLLIN          0x001           /* There is data to read.  */
35 #define POLLPRI         0x002           /* There is urgent data to read.  */
36 #define POLLOUT         0x004           /* Writing now will not block.  */
37
38 /* Event types always implicitly polled for.  These bits need not be set in
39    `events', but they will appear in `revents' to indicate the status of
40    the file descriptor.  */
41 #define POLLERR         0x008           /* Error condition.  */
42 #define POLLHUP         0x010           /* Hung up.  */
43 #define POLLNVAL        0x020           /* Invalid polling request.  */
44
45 /* Data structure describing a polling request.  */
46 struct pollfd {
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
58 #endif /* HAVE_POLL_H */
59
60 #if defined(HAVE_POLL_H) && !defined(OS_IS_DARWIN)
61 #define pa_poll(fds,nfds,timeout) poll((fds),(nfds),(timeout))
62 #else
63 int pa_poll(struct pollfd *fds, unsigned long nfds, int timeout);
64 #endif