/usr/include/asterisk/poll-compat.h is in asterisk-dev 1:1.8.10.1~dfsg-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | /*
* Asterisk -- An open source telephony toolkit.
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*/
/*---------------------------------------------------------------------------*\
$Id: poll-compat.h 284597 2010-09-02 05:00:34Z tilghman $
NAME
poll - select(2)-based poll() emulation function for BSD systems.
SYNOPSIS
#include "poll.h"
struct pollfd
{
int fd;
short events;
short revents;
}
int poll (struct pollfd *pArray, unsigned long n_fds, int timeout)
DESCRIPTION
This file, and the accompanying "poll.c", implement the System V
poll(2) system call for BSD systems (which typically do not provide
poll()). Poll() provides a method for multiplexing input and output
on multiple open file descriptors; in traditional BSD systems, that
capability is provided by select(). While the semantics of select()
differ from those of poll(), poll() can be readily emulated in terms
of select() -- which is how this function is implemented.
REFERENCES
Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990.
NOTES
1. This software requires an ANSI C compiler.
LICENSE
This software is released under the following license:
Copyright (c) 1995-2002 Brian M. Clapper
All rights reserved.
Redistribution and use in source and binary forms are
permitted provided that: (1) source distributions retain
this entire copyright notice and comment; (2) modifications
made to the software are prominently mentioned, and a copy
of the original software (or a pointer to its location) are
included; and (3) distributions including binaries display
the following acknowledgement: "This product includes
software developed by Brian M. Clapper <bmc@clapper.org>"
in the documentation or other materials provided with the
distribution. The name of the author may not be used to
endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
Effectively, this means you can do what you want with the software
except remove this notice or take advantage of the author's name.
If you modify the software and redistribute your modified version,
you must indicate that your version is a modification of the
original, and you must provide either a pointer to or a copy of the
original.
\*---------------------------------------------------------------------------*/
#ifndef __AST_POLL_COMPAT_H
#define __AST_POLL_COMPAT_H
#include "asterisk/select.h"
#ifndef AST_POLL_COMPAT
#include <sys/poll.h>
#define ast_poll(a, b, c) poll(a, b, c)
#else /* AST_POLL_COMPAT */
#define POLLIN 0x01
#define POLLPRI 0x02
#define POLLOUT 0x04
#define POLLERR 0x08
#define POLLHUP 0x10
#define POLLNVAL 0x20
struct pollfd {
int fd;
short events;
short revents;
};
#ifdef __cplusplus
extern "C" {
#endif
#define ast_poll(a, b, c) ast_internal_poll(a, b, c)
int ast_internal_poll(struct pollfd *pArray, unsigned long n_fds, int timeout);
#ifdef __cplusplus
}
#endif
#endif /* AST_POLL_COMPAT */
/*!
* \brief Same as poll(2), except the time is specified in microseconds and
* the tv argument is modified to indicate the time remaining.
*/
int ast_poll2(struct pollfd *pArray, unsigned long n_fds, struct timeval *tv);
/*!
* \brief Shortcut for conversion of FD_ISSET to poll(2)-based
*/
static inline int ast_poll_fd_index(struct pollfd *haystack, int nfds, int needle)
{
int i;
for (i = 0; i < nfds; i++) {
if (haystack[i].fd == needle) {
return i;
}
}
return -1;
}
#endif /* __AST_POLL_COMPAT_H */
|