Home | History | Annotate | Download | only in nacl_io
      1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file. */
      4 
      5 #ifndef LIBRARIES_NACL_IO_POLL_H_
      6 #define LIBRARIES_NACL_IO_POLL_H_
      7 
      8 #include <stdint.h>
      9 
     10 #include "sdk_util/macros.h"
     11 
     12 EXTERN_C_BEGIN
     13 
     14 /* This header adds definitions of flags and structures for use with poll on
     15  * toolchains with 'C' libraries which do not normally supply poll. */
     16 
     17 /* Node state flags */
     18 #define POLLIN   0x0001   /* Will not block READ select/poll. */
     19 #define POLLOUT  0x0002   /* Will not block WRITE select/poll. */
     20 #define POLLERR  0x0008   /* Will not block EXECPT select/poll. */
     21 #define POLLHUP  0x0010   /* Connection closed on far side. */
     22 #define POLLNVAL 0x0020   /* Invalid FD. */
     23 
     24 /* Number of file descriptors. */
     25 typedef int nfds_t;
     26 
     27 struct pollfd {
     28   int fd;
     29   uint16_t events;
     30   uint16_t revents;
     31 };
     32 
     33 int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout);
     34 
     35 EXTERN_C_END
     36 
     37 #endif  /* LIBRARIES_NACL_IO_POLL_H_ */
     38 
     39