]> git.llucax.com Git - software/druntime.git/blob - import/stdc/posix/poll.d
Fixed a few build script issues on posix, including a bug in looking for some of...
[software/druntime.git] / import / stdc / posix / poll.d
1 /**
2  * D header file for POSIX.
3  *
4  * Copyright: Public Domain
5  * License:   Public Domain
6  * Authors:   Sean Kelly
7  * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8  */
9 module stdc.posix.poll;
10
11 private import stdc.posix.config;
12
13 extern (C):
14
15 //
16 // XOpen (XSI)
17 //
18 /*
19 struct pollfd
20 {
21     int     fd;
22     short   events;
23     short   revents;
24 }
25
26 nfds_t
27
28 POLLIN
29 POLLRDNORM
30 POLLRDBAND
31 POLLPRI
32 POLLOUT
33 POLLWRNORM
34 POLLWRBAND
35 POLLERR
36 POLLHUP
37 POLLNVAL
38
39 int poll(pollfd[], nfds_t, int);
40 */
41
42 version( linux )
43 {
44     struct pollfd
45     {
46         int     fd;
47         short   events;
48         short   revents;
49     }
50
51     alias c_ulong nfds_t;
52
53     const POLLIN        = 0x001;
54     const POLLRDNORM    = 0x040;
55     const POLLRDBAND    = 0x080;
56     const POLLPRI       = 0x002;
57     const POLLOUT       = 0x004;
58     const POLLWRNORM    = 0x100;
59     const POLLWRBAND    = 0x200;
60     const POLLERR       = 0x008;
61     const POLLHUP       = 0x010;
62     const POLLNVAL      = 0x020;
63
64     int poll(pollfd*, nfds_t, int);
65 }
66 else version( darwin )
67 {
68     struct pollfd
69     {
70         int     fd;
71         short   events;
72         short   revents;
73     };
74
75     alias uint nfds_t;
76
77     enum
78     {
79         POLLIN      = 0x0001,
80         POLLPRI     = 0x0002,
81         POLLOUT     = 0x0004,
82         POLLRDNORM  = 0x0040,
83         POLLWRNORM  = POLLOUT,
84         POLLRDBAND  = 0x0080,
85         POLLWRBAND  = 0x0100,
86         POLLEXTEND  = 0x0200,
87         POLLATTRIB  = 0x0400,
88         POLLNLINK   = 0x0800,
89         POLLWRITE   = 0x1000,
90         POLLERR     = 0x0008,
91         POLLHUP     = 0x0010,
92         POLLNVAL    = 0x0020,
93
94         POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
95                         POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
96     }
97
98     int poll(pollfd*, nfds_t, int);
99 }
100 else version( freebsd )
101 {
102     struct pollfd
103     {
104         int     fd;
105         short   events;
106         short   revents;
107     };
108
109     alias uint nfds_t;
110
111     enum
112     {
113         POLLIN      = 0x0001,
114         POLLPRI     = 0x0002,
115         POLLOUT     = 0x0004,
116         POLLRDNORM  = 0x0040,
117         POLLWRNORM  = POLLOUT,
118         POLLRDBAND  = 0x0080,
119         POLLWRBAND  = 0x0100,
120         //POLLEXTEND  = 0x0200,
121         //POLLATTRIB  = 0x0400,
122         //POLLNLINK   = 0x0800,
123         //POLLWRITE   = 0x1000,
124         POLLERR     = 0x0008,
125         POLLHUP     = 0x0010,
126         POLLNVAL    = 0x0020,
127
128         POLLSTANDARD = (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|
129         POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
130     }
131
132     int poll(pollfd*, nfds_t, int);
133 }