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 7221 2005-11-29 18:24:39Z kpfleming $ 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 _POLL_EMUL_H_ 00080 #define _POLL_EMUL_H_ 00081 00082 #define POLLIN 0x01 00083 #define POLLPRI 0x02 00084 #define POLLOUT 0x04 00085 #define POLLERR 0x08 00086 #define POLLHUP 0x10 00087 #define POLLNVAL 0x20 00088 00089 struct pollfd 00090 { 00091 int fd; 00092 short events; 00093 short revents; 00094 }; 00095 00096 #ifdef __cplusplus 00097 extern "C" 00098 { 00099 #endif 00100 00101 #if (__STDC__ > 0) || defined(__cplusplus) 00102 extern int poll (struct pollfd *pArray, unsigned long n_fds, int timeout); 00103 #else 00104 extern int poll(); 00105 #endif 00106 00107 #ifdef __cplusplus 00108 } 00109 #endif 00110 00111 #endif /* _POLL_EMUL_H_ */