Merge branch 'jk/perf-no-dups'
[git/git.git] / compat / poll / poll.h
CommitLineData
49521af8
EFL
1/* Header for poll(2) emulation
2 Contributed by Paolo Bonzini.
3
4 Copyright 2001, 2002, 2003, 2007, 2009, 2010 Free Software Foundation, Inc.
5
6 This file is part of gnulib.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
48425792 19 with this program; if not, see <http://www.gnu.org/licenses/>. */
49521af8
EFL
20
21#ifndef _GL_POLL_H
22#define _GL_POLL_H
23
d7e357fb
JS
24#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
25/* Vista has its own, socket-only poll() */
26#undef POLLIN
27#undef POLLPRI
28#undef POLLOUT
29#undef POLLERR
30#undef POLLHUP
31#undef POLLNVAL
32#undef POLLRDNORM
33#undef POLLRDBAND
34#undef POLLWRNORM
35#undef POLLWRBAND
36#define pollfd compat_pollfd
37#endif
38
49521af8
EFL
39/* fake a poll(2) environment */
40#define POLLIN 0x0001 /* any readable data available */
41#define POLLPRI 0x0002 /* OOB/Urgent readable data */
42#define POLLOUT 0x0004 /* file descriptor is writeable */
43#define POLLERR 0x0008 /* some poll error occurred */
44#define POLLHUP 0x0010 /* file descriptor was "hung up" */
45#define POLLNVAL 0x0020 /* requested events "invalid" */
46#define POLLRDNORM 0x0040
47#define POLLRDBAND 0x0080
48#define POLLWRNORM 0x0100
49#define POLLWRBAND 0x0200
50
51struct pollfd
52{
53 int fd; /* which file descriptor to poll */
54 short events; /* events we are interested in */
55 short revents; /* events found on return */
56};
57
58typedef unsigned long nfds_t;
59
60extern int poll (struct pollfd *pfd, nfds_t nfd, int timeout);
61
62/* Define INFTIM only if doing so conforms to POSIX. */
63#if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
64#define INFTIM (-1)
65#endif
66
67#endif /* _GL_POLL_H */