|
Packit |
8f70b4 |
/* Header for poll(2) emulation
|
|
Packit |
8f70b4 |
Contributed by Paolo Bonzini.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
Copyright 2001-2003, 2007, 2009-2018 Free Software Foundation, Inc.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
This file is part of gnulib.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
This program is free software; you can redistribute it and/or modify
|
|
Packit |
8f70b4 |
it under the terms of the GNU General Public License as published by
|
|
Packit |
8f70b4 |
the Free Software Foundation; either version 3, or (at your option)
|
|
Packit |
8f70b4 |
any later version.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
This program is distributed in the hope that it will be useful,
|
|
Packit |
8f70b4 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
8f70b4 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
8f70b4 |
GNU General Public License for more details.
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
You should have received a copy of the GNU General Public License along
|
|
Packit |
8f70b4 |
with this program; if not, see <https://www.gnu.org/licenses/>. */
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#ifndef _@GUARD_PREFIX@_POLL_H
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#if __GNUC__ >= 3
|
|
Packit |
8f70b4 |
@PRAGMA_SYSTEM_HEADER@
|
|
Packit |
8f70b4 |
#endif
|
|
Packit |
8f70b4 |
@PRAGMA_COLUMNS@
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* The include_next requires a split double-inclusion guard. */
|
|
Packit |
8f70b4 |
#if @HAVE_POLL_H@
|
|
Packit |
8f70b4 |
# @INCLUDE_NEXT@ @NEXT_POLL_H@
|
|
Packit |
8f70b4 |
#endif
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#ifndef _@GUARD_PREFIX@_POLL_H
|
|
Packit |
8f70b4 |
#define _@GUARD_PREFIX@_POLL_H
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* The definition of _GL_WARN_ON_USE is copied here. */
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#if !@HAVE_POLL_H@
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* fake a poll(2) environment */
|
|
Packit |
8f70b4 |
# define POLLIN 0x0001 /* any readable data available */
|
|
Packit |
8f70b4 |
# define POLLPRI 0x0002 /* OOB/Urgent readable data */
|
|
Packit |
8f70b4 |
# define POLLOUT 0x0004 /* file descriptor is writable */
|
|
Packit |
8f70b4 |
# define POLLERR 0x0008 /* some poll error occurred */
|
|
Packit |
8f70b4 |
# define POLLHUP 0x0010 /* file descriptor was "hung up" */
|
|
Packit |
8f70b4 |
# define POLLNVAL 0x0020 /* requested events "invalid" */
|
|
Packit |
8f70b4 |
# define POLLRDNORM 0x0040
|
|
Packit |
8f70b4 |
# define POLLRDBAND 0x0080
|
|
Packit |
8f70b4 |
# define POLLWRNORM 0x0100
|
|
Packit |
8f70b4 |
# define POLLWRBAND 0x0200
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
# if !GNULIB_defined_poll_types
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
struct pollfd
|
|
Packit |
8f70b4 |
{
|
|
Packit |
8f70b4 |
int fd; /* which file descriptor to poll */
|
|
Packit |
8f70b4 |
short events; /* events we are interested in */
|
|
Packit |
8f70b4 |
short revents; /* events found on return */
|
|
Packit |
8f70b4 |
};
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
typedef unsigned long nfds_t;
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
# define GNULIB_defined_poll_types 1
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
/* Define INFTIM only if doing so conforms to POSIX. */
|
|
Packit |
8f70b4 |
# if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE)
|
|
Packit |
8f70b4 |
# define INFTIM (-1)
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#endif
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#if @GNULIB_POLL@
|
|
Packit |
8f70b4 |
# if @REPLACE_POLL@
|
|
Packit |
8f70b4 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
|
Packit |
8f70b4 |
# undef poll
|
|
Packit |
8f70b4 |
# define poll rpl_poll
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
_GL_FUNCDECL_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
|
|
Packit |
8f70b4 |
_GL_CXXALIAS_RPL (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
|
|
Packit |
8f70b4 |
# else
|
|
Packit |
8f70b4 |
# if !@HAVE_POLL@
|
|
Packit |
8f70b4 |
_GL_FUNCDECL_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
_GL_CXXALIAS_SYS (poll, int, (struct pollfd *pfd, nfds_t nfd, int timeout));
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
_GL_CXXALIASWARN (poll);
|
|
Packit |
8f70b4 |
#elif defined GNULIB_POSIXCHECK
|
|
Packit |
8f70b4 |
# undef poll
|
|
Packit |
8f70b4 |
# if HAVE_RAW_DECL_POLL
|
|
Packit |
8f70b4 |
_GL_WARN_ON_USE (poll, "poll is unportable - "
|
|
Packit |
8f70b4 |
"use gnulib module poll for portability");
|
|
Packit |
8f70b4 |
# endif
|
|
Packit |
8f70b4 |
#endif
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
|
|
Packit |
8f70b4 |
#endif /* _@GUARD_PREFIX@_POLL_H */
|
|
Packit |
8f70b4 |
#endif /* _@GUARD_PREFIX@_POLL_H */
|