00001 /* 00002 * Asterisk -- An open source telephony toolkit. 00003 * 00004 * See http://www.asterisk.org for more information about 00005 * the Asterisk project. Please do not directly contact 00006 * any of the maintainers of this project for assistance; 00007 * the project provides a web site, mailing lists and IRC 00008 * channels for your use. 00009 */ 00010 00011 /*---------------------------------------------------------------------------*\ 00012 $Id: poll-compat.h 182945 2009-03-18 14:24:27Z russell $ 00013 00014 NAME 00015 00016 poll - select(2)-based poll() emulation function for BSD systems. 00017 00018 SYNOPSIS 00019 #include "poll.h" 00020 00021 struct pollfd 00022 { 00023 int fd; 00024 short events; 00025 short revents; 00026 } 00027 00028 int poll (struct pollfd *pArray, unsigned long n_fds, int timeout) 00029 00030 DESCRIPTION 00031 00032 This file, and the accompanying "poll.c", implement the System V 00033 poll(2) system call for BSD systems (which typically do not provide 00034 poll()). Poll() provides a method for multiplexing input and output 00035 on multiple open file descriptors; in traditional BSD systems, that 00036 capability is provided by select(). While the semantics of select() 00037 differ from those of poll(), poll() can be readily emulated in terms 00038 of select() -- which is how this function is implemented. 00039 00040 REFERENCES 00041 Stevens, W. Richard. Unix Network Programming. Prentice-Hall, 1990. 00042 00043 NOTES 00044 1. This software requires an ANSI C compiler. 00045 00046 LICENSE 00047 00048 This software is released under the following license: 00049 00050 Copyright (c) 1995-2002 Brian M. Clapper 00051 All rights reserved. 00052 00053 Redistribution and use in source and binary forms are 00054 permitted provided that: (1) source distributions retain 00055 this entire copyright notice and comment; (2) modifications 00056 made to the software are prominently mentioned, and a copy 00057 of the original software (or a pointer to its location) are 00058 included; and (3) distributions including binaries display 00059 the following acknowledgement: "This product includes 00060 software developed by Brian M. Clapper <bmc@clapper.org>" 00061 in the documentation or other materials provided with the 00062 distribution. The name of the author may not be used to 00063 endorse or promote products derived from this software 00064 without specific prior written permission. 00065 00066 THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS 00067 OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE 00068 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00069 PARTICULAR PURPOSE. 00070 00071 Effectively, this means you can do what you want with the software 00072 except remove this notice or take advantage of the author's name. 00073 If you modify the software and redistribute your modified version, 00074 you must indicate that your version is a modification of the 00075 original, and you must provide either a pointer to or a copy of the 00076 original. 00077 \*---------------------------------------------------------------------------*/ 00078 00079 #ifndef __AST_POLL_COMPAT_H 00080 #define __AST_POLL_COMPAT_H 00081 00082 #ifndef AST_POLL_COMPAT 00083 00084 #include <sys/poll.h> 00085 00086 #define ast_poll(a, b, c) poll(a, b, c) 00087 00088 #else /* AST_POLL_COMPAT */ 00089 00090 #define POLLIN 0x01 00091 #define POLLPRI 0x02 00092 #define POLLOUT 0x04 00093 #define POLLERR 0x08 00094 #define POLLHUP 0x10 00095 #define POLLNVAL 0x20 00096 00097 struct pollfd { 00098 int fd; 00099 short events; 00100 short revents; 00101 }; 00102 00103 #ifdef __cplusplus 00104 extern "C" { 00105 #endif 00106 00107 #define ast_poll(a, b, c) ast_internal_poll(a, b, c) 00108 00109 int ast_internal_poll(struct pollfd *pArray, unsigned long n_fds, int timeout); 00110 00111 #ifdef __cplusplus 00112 } 00113 #endif 00114 00115 #endif /* AST_POLL_COMPAT */ 00116 00117 #endif /* __AST_POLL_COMPAT_H */