ignore-value: make ignore_value more generic; deprecate ignore_ptr
[gnulib.git] / lib / poll.in.h
1 /* Header for poll(2) emulation
2    Contributed by Paolo Bonzini.
3
4    Copyright 2001-2003, 2007, 2009-2011 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
19    with this program; if not, write to the Free Software Foundation,
20    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
21
22 #ifndef _GL_POLL_H
23
24 #if __GNUC__ >= 3
25 @PRAGMA_SYSTEM_HEADER@
26 #endif
27 @PRAGMA_COLUMNS@
28
29 /* The include_next requires a split double-inclusion guard.  */
30 #if @HAVE_POLL_H@
31 # @INCLUDE_NEXT@ @NEXT_POLL_H@
32 #endif
33
34 #ifndef _GL_POLL_H
35 #define _GL_POLL_H
36
37
38 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
39
40 /* The definition of _GL_WARN_ON_USE is copied here.  */
41
42
43 #if !@HAVE_POLL_H@
44
45 /* fake a poll(2) environment */
46 # define POLLIN      0x0001      /* any readable data available   */
47 # define POLLPRI     0x0002      /* OOB/Urgent readable data      */
48 # define POLLOUT     0x0004      /* file descriptor is writeable  */
49 # define POLLERR     0x0008      /* some poll error occurred      */
50 # define POLLHUP     0x0010      /* file descriptor was "hung up" */
51 # define POLLNVAL    0x0020      /* requested events "invalid"    */
52 # define POLLRDNORM  0x0040
53 # define POLLRDBAND  0x0080
54 # define POLLWRNORM  0x0100
55 # define POLLWRBAND  0x0200
56
57 struct pollfd
58 {
59   int fd;                       /* which file descriptor to poll */
60   short events;                 /* events we are interested in   */
61   short revents;                /* events found on return        */
62 };
63
64 typedef unsigned long nfds_t;
65
66 /* Define INFTIM only if doing so conforms to POSIX.  */
67 # if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
68 #  define INFTIM (-1)
69 # endif
70
71 #endif
72
73
74 #if @GNULIB_POLL@
75 # if @REPLACE_POLL@
76 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
77 #   undef poll
78 #   define poll rpl_poll
79 #  endif
80 _GL_FUNCDECL_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
81 _GL_CXXALIAS_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
82 # else
83 #  if !@HAVE_POLL@
84 _GL_FUNCDECL_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
85 #  endif
86 _GL_CXXALIAS_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
87 # endif
88 _GL_CXXALIASWARN (poll);
89 #elif defined GNULIB_POSIXCHECK
90 # undef poll
91 # if HAVE_RAW_DECL_POLL
92 _GL_WARN_ON_USE (poll, "poll is unportable - "
93                  "use gnulib module poll for portability");
94 # endif
95 #endif
96
97
98 #endif /* _GL_POLL_H */
99 #endif /* _GL_POLL_H */