Home | History | Annotate | Download | only in sys
      1 /** @file
      2     Definitions in support of the poll() function.
      3 
      4  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Charles M. Hannum.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *  This product includes software developed by the NetBSD
     21  *  Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37 
     38     Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
     39     This program and the accompanying materials are licensed and made available under
     40     the terms and conditions of the BSD License that accompanies this distribution.
     41     The full text of the license may be found at
     42     http://opensource.org/licenses/bsd-license.php.
     43 
     44     THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     45     WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     46 
     47     NetBSD: poll.h,v 1.11 2005/12/11 12:25:20 christos Exp
     48 **/
     49 #ifndef _SYS_POLL_H_
     50 #define _SYS_POLL_H_
     51 
     52 #include <sys/featuretest.h>
     53 #include <sys/EfiCdefs.h>
     54 
     55 typedef unsigned int  nfds_t;
     56 
     57 struct pollfd {
     58   int   fd;       /* file descriptor */
     59   short events;   /* events to look for */
     60   short revents;  /* events returned */
     61 };
     62 
     63 /*
     64  * Testable events (may be specified in events field).
     65  */
     66 #define POLLIN      0x0001
     67 #define POLLPRI     0x0002
     68 #define POLLOUT     0x0004
     69 #define POLLRDNORM  0x0040
     70 #define POLLWRNORM  POLLOUT
     71 #define POLLRDBAND  0x0080
     72 #define POLLWRBAND  0x0100
     73 
     74 /*
     75  * Non-testable events (ignored in events field, valid in return only).
     76  */
     77 #define POLLERR     0x0008
     78 #define POLLHUP     0x0010
     79 #define POLLNVAL    0x0020    // Invalid parameter in POLL call
     80 #define POLL_RETONLY  (POLLERR | POLLHUP | POLLNVAL)
     81 
     82 /*
     83  * Infinite timeout value.
     84  */
     85 #define INFTIM    -1
     86 
     87 __BEGIN_DECLS
     88 int poll(struct pollfd *, nfds_t, int);
     89 __END_DECLS
     90 
     91 #endif /* !_SYS_POLL_H_ */
     92