comparison druntime/import/core/sys/posix/poll.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
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 * Copyright Sean Kelly 2005 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module core.sys.posix.poll;
15
16 private import core.sys.posix.config;
17
18 extern (C):
19
20 //
21 // XOpen (XSI)
22 //
23 /*
24 struct pollfd
25 {
26 int fd;
27 short events;
28 short revents;
29 }
30
31 nfds_t
32
33 POLLIN
34 POLLRDNORM
35 POLLRDBAND
36 POLLPRI
37 POLLOUT
38 POLLWRNORM
39 POLLWRBAND
40 POLLERR
41 POLLHUP
42 POLLNVAL
43
44 int poll(pollfd[], nfds_t, int);
45 */
46
47 version( linux )
48 {
49 struct pollfd
50 {
51 int fd;
52 short events;
53 short revents;
54 }
55
56 alias c_ulong nfds_t;
57
58 enum
59 {
60 POLLIN = 0x001,
61 POLLRDNORM = 0x040,
62 POLLRDBAND = 0x080,
63 POLLPRI = 0x002,
64 POLLOUT = 0x004,
65 POLLWRNORM = 0x100,
66 POLLWRBAND = 0x200,
67 POLLERR = 0x008,
68 POLLHUP = 0x010,
69 POLLNVAL = 0x020,
70 }
71
72 int poll(pollfd*, nfds_t, int);
73 }
74 else version( OSX )
75 {
76 struct pollfd
77 {
78 int fd;
79 short events;
80 short revents;
81 };
82
83 alias uint nfds_t;
84
85 enum
86 {
87 POLLIN = 0x0001,
88 POLLPRI = 0x0002,
89 POLLOUT = 0x0004,
90 POLLRDNORM = 0x0040,
91 POLLWRNORM = POLLOUT,
92 POLLRDBAND = 0x0080,
93 POLLWRBAND = 0x0100,
94 POLLEXTEND = 0x0200,
95 POLLATTRIB = 0x0400,
96 POLLNLINK = 0x0800,
97 POLLWRITE = 0x1000,
98 POLLERR = 0x0008,
99 POLLHUP = 0x0010,
100 POLLNVAL = 0x0020,
101
102 POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
103 POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
104 }
105
106 int poll(pollfd*, nfds_t, int);
107 }
108 else version( freebsd )
109 {
110 struct pollfd
111 {
112 int fd;
113 short events;
114 short revents;
115 };
116
117 alias uint nfds_t;
118
119 enum
120 {
121 POLLIN = 0x0001,
122 POLLPRI = 0x0002,
123 POLLOUT = 0x0004,
124 POLLRDNORM = 0x0040,
125 POLLWRNORM = POLLOUT,
126 POLLRDBAND = 0x0080,
127 POLLWRBAND = 0x0100,
128 //POLLEXTEND = 0x0200,
129 //POLLATTRIB = 0x0400,
130 //POLLNLINK = 0x0800,
131 //POLLWRITE = 0x1000,
132 POLLERR = 0x0008,
133 POLLHUP = 0x0010,
134 POLLNVAL = 0x0020,
135
136 POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
137 POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
138 }
139
140 int poll(pollfd*, nfds_t, int);
141 }