1d4af9e69SDag-Erling Smørgrav /* $OpenBSD: poll.h,v 1.11 2003/12/10 23:10:08 millert Exp $ */ 2d4af9e69SDag-Erling Smørgrav 3d4af9e69SDag-Erling Smørgrav /* 4d4af9e69SDag-Erling Smørgrav * Copyright (c) 1996 Theo de Raadt 5d4af9e69SDag-Erling Smørgrav * All rights reserved. 6d4af9e69SDag-Erling Smørgrav * 7d4af9e69SDag-Erling Smørgrav * Redistribution and use in source and binary forms, with or without 8d4af9e69SDag-Erling Smørgrav * modification, are permitted provided that the following conditions 9d4af9e69SDag-Erling Smørgrav * are met: 10d4af9e69SDag-Erling Smørgrav * 1. Redistributions of source code must retain the above copyright 11d4af9e69SDag-Erling Smørgrav * notice, this list of conditions and the following disclaimer. 12d4af9e69SDag-Erling Smørgrav * 2. Redistributions in binary form must reproduce the above copyright 13d4af9e69SDag-Erling Smørgrav * notice, this list of conditions and the following disclaimer in the 14d4af9e69SDag-Erling Smørgrav * documentation and/or other materials provided with the distribution. 15d4af9e69SDag-Erling Smørgrav * 16d4af9e69SDag-Erling Smørgrav * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17d4af9e69SDag-Erling Smørgrav * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18d4af9e69SDag-Erling Smørgrav * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19d4af9e69SDag-Erling Smørgrav * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20d4af9e69SDag-Erling Smørgrav * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21d4af9e69SDag-Erling Smørgrav * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22d4af9e69SDag-Erling Smørgrav * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23d4af9e69SDag-Erling Smørgrav * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24d4af9e69SDag-Erling Smørgrav * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25d4af9e69SDag-Erling Smørgrav * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26d4af9e69SDag-Erling Smørgrav */ 27d4af9e69SDag-Erling Smørgrav 28d4af9e69SDag-Erling Smørgrav /* OPENBSD ORIGINAL: sys/sys/poll.h */ 29d4af9e69SDag-Erling Smørgrav 30d4af9e69SDag-Erling Smørgrav #ifndef _COMPAT_POLL_H_ 31d4af9e69SDag-Erling Smørgrav #define _COMPAT_POLL_H_ 32d4af9e69SDag-Erling Smørgrav 331323ec57SEd Maste #include <sys/types.h> 341323ec57SEd Maste #ifdef HAVE_POLL_H 351323ec57SEd Maste # include <poll.h> 361323ec57SEd Maste #elif HAVE_SYS_POLL_H 371323ec57SEd Maste # include <sys/poll.h> 381323ec57SEd Maste #endif 391323ec57SEd Maste 401323ec57SEd Maste #ifndef HAVE_STRUCT_POLLFD_FD 41d4af9e69SDag-Erling Smørgrav typedef struct pollfd { 42d4af9e69SDag-Erling Smørgrav int fd; 43d4af9e69SDag-Erling Smørgrav short events; 44d4af9e69SDag-Erling Smørgrav short revents; 45d4af9e69SDag-Erling Smørgrav } pollfd_t; 46d4af9e69SDag-Erling Smørgrav 47*f374ba41SEd Maste #ifndef POLLIN 48d4af9e69SDag-Erling Smørgrav # define POLLIN 0x0001 49*f374ba41SEd Maste #endif 50*f374ba41SEd Maste #ifndef POLLPRI 511323ec57SEd Maste # define POLLPRI 0x0002 52*f374ba41SEd Maste #endif 53*f374ba41SEd Maste #ifndef POLLOUT 54d4af9e69SDag-Erling Smørgrav # define POLLOUT 0x0004 55*f374ba41SEd Maste #endif 56*f374ba41SEd Maste #ifndef POLLERR 57d4af9e69SDag-Erling Smørgrav # define POLLERR 0x0008 58*f374ba41SEd Maste #endif 59*f374ba41SEd Maste #ifndef POLLHUP 60acc1a9efSDag-Erling Smørgrav # define POLLHUP 0x0010 61*f374ba41SEd Maste #endif 62*f374ba41SEd Maste #ifndef POLLNVAL 63acc1a9efSDag-Erling Smørgrav # define POLLNVAL 0x0020 64*f374ba41SEd Maste #endif 65*f374ba41SEd Maste 66d4af9e69SDag-Erling Smørgrav #if 0 67d4af9e69SDag-Erling Smørgrav /* the following are currently not implemented */ 68d4af9e69SDag-Erling Smørgrav #define POLLRDNORM 0x0040 69d4af9e69SDag-Erling Smørgrav #define POLLNORM POLLRDNORM 70d4af9e69SDag-Erling Smørgrav #define POLLWRNORM POLLOUT 71d4af9e69SDag-Erling Smørgrav #define POLLRDBAND 0x0080 72d4af9e69SDag-Erling Smørgrav #define POLLWRBAND 0x0100 73d4af9e69SDag-Erling Smørgrav #endif 74d4af9e69SDag-Erling Smørgrav 75d4af9e69SDag-Erling Smørgrav #define INFTIM (-1) /* not standard */ 761323ec57SEd Maste #endif /* !HAVE_STRUCT_POLLFD_FD */ 77d4af9e69SDag-Erling Smørgrav 781323ec57SEd Maste #ifndef HAVE_NFDS_T 791323ec57SEd Maste typedef unsigned int nfds_t; 801323ec57SEd Maste #endif 811323ec57SEd Maste 821323ec57SEd Maste #ifndef HAVE_POLL 83d4af9e69SDag-Erling Smørgrav int poll(struct pollfd *, nfds_t, int); 841323ec57SEd Maste #endif 851323ec57SEd Maste 861323ec57SEd Maste #ifndef HAVE_PPOLL 871323ec57SEd Maste int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *); 881323ec57SEd Maste #endif 891323ec57SEd Maste 90d4af9e69SDag-Erling Smørgrav #endif /* !_COMPAT_POLL_H_ */ 91