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