PageRenderTime 36ms CodeModel.GetById 1ms app.highlight 28ms RepoModel.GetById 2ms app.codeStats 0ms

/src/core/sys/posix/poll.d

http://github.com/AlexeyProkhin/druntime
D | 143 lines | 84 code | 16 blank | 43 comment | 2 complexity | 1e1a31737d1c115c08d1941927cb9586 MD5 | raw file
  1/**
  2 * D header file for POSIX.
  3 *
  4 * Copyright: Copyright Sean Kelly 2005 - 2009.
  5 * License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
  6 * Authors:   Sean Kelly
  7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
  8 */
  9
 10/*          Copyright Sean Kelly 2005 - 2009.
 11 * Distributed under the Boost Software License, Version 1.0.
 12 *    (See accompanying file LICENSE or copy at
 13 *          http://www.boost.org/LICENSE_1_0.txt)
 14 */
 15module core.sys.posix.poll;
 16
 17private import core.sys.posix.config;
 18
 19version (Posix):
 20extern (C):
 21
 22//
 23// XOpen (XSI)
 24//
 25/*
 26struct pollfd
 27{
 28    int     fd;
 29    short   events;
 30    short   revents;
 31}
 32
 33nfds_t
 34
 35POLLIN
 36POLLRDNORM
 37POLLRDBAND
 38POLLPRI
 39POLLOUT
 40POLLWRNORM
 41POLLWRBAND
 42POLLERR
 43POLLHUP
 44POLLNVAL
 45
 46int poll(pollfd[], nfds_t, int);
 47*/
 48
 49version( linux )
 50{
 51    struct pollfd
 52    {
 53        int     fd;
 54        short   events;
 55        short   revents;
 56    }
 57
 58    alias c_ulong nfds_t;
 59
 60    enum
 61    {
 62        POLLIN      = 0x001,
 63        POLLRDNORM  = 0x040,
 64        POLLRDBAND  = 0x080,
 65        POLLPRI     = 0x002,
 66        POLLOUT     = 0x004,
 67        POLLWRNORM  = 0x100,
 68        POLLWRBAND  = 0x200,
 69        POLLERR     = 0x008,
 70        POLLHUP     = 0x010,
 71        POLLNVAL    = 0x020,
 72    }
 73
 74    int poll(pollfd*, nfds_t, int);
 75}
 76else version( OSX )
 77{
 78    struct pollfd
 79    {
 80        int     fd;
 81        short   events;
 82        short   revents;
 83    };
 84
 85    alias uint nfds_t;
 86
 87    enum
 88    {
 89        POLLIN      = 0x0001,
 90        POLLPRI     = 0x0002,
 91        POLLOUT     = 0x0004,
 92        POLLRDNORM  = 0x0040,
 93        POLLWRNORM  = POLLOUT,
 94        POLLRDBAND  = 0x0080,
 95        POLLWRBAND  = 0x0100,
 96        POLLEXTEND  = 0x0200,
 97        POLLATTRIB  = 0x0400,
 98        POLLNLINK   = 0x0800,
 99        POLLWRITE   = 0x1000,
100        POLLERR     = 0x0008,
101        POLLHUP     = 0x0010,
102        POLLNVAL    = 0x0020,
103
104        POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
105                        POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
106    }
107
108    int poll(pollfd*, nfds_t, int);
109}
110else version( FreeBSD )
111{
112    alias uint nfds_t;
113
114    struct pollfd
115    {
116        int     fd;
117        short   events;
118        short   revents;
119    };
120
121    enum
122    {
123        POLLIN      = 0x0001,
124        POLLPRI     = 0x0002,
125        POLLOUT     = 0x0004,
126        POLLRDNORM  = 0x0040,
127        POLLWRNORM  = POLLOUT,
128        POLLRDBAND  = 0x0080,
129        POLLWRBAND  = 0x0100,
130        //POLLEXTEND  = 0x0200,
131        //POLLATTRIB  = 0x0400,
132        //POLLNLINK   = 0x0800,
133        //POLLWRITE   = 0x1000,
134        POLLERR     = 0x0008,
135        POLLHUP     = 0x0010,
136        POLLNVAL    = 0x0020,
137
138        POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
139        POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
140    }
141
142    int poll(pollfd*, nfds_t, int);
143}