13
13
#![ allow( dead_code) ]
14
14
#![ allow( non_camel_case_types) ]
15
15
16
- pub use self :: select:: fd_set;
17
16
pub use self :: signal:: { sigaction, siginfo, sigset_t} ;
18
17
pub use self :: signal:: { SA_ONSTACK , SA_RESTART , SA_RESETHAND , SA_NOCLDSTOP } ;
19
18
pub use self :: signal:: { SA_NODEFER , SA_NOCLDWAIT , SA_SIGINFO , SIGCHLD } ;
@@ -26,45 +25,21 @@ use libc;
26
25
target_os = "dragonfly" ,
27
26
target_os = "bitrig" ,
28
27
target_os = "openbsd" ) ) ]
29
- mod consts {
30
- use libc;
31
- pub const FIONBIO : libc:: c_ulong = 0x8004667e ;
32
- pub const FIOCLEX : libc:: c_ulong = 0x20006601 ;
33
- pub const FIONCLEX : libc:: c_ulong = 0x20006602 ;
34
- }
28
+ pub const FIOCLEX : libc:: c_ulong = 0x20006601 ;
29
+
35
30
#[ cfg( any( all( target_os = "linux" ,
36
31
any( target_arch = "x86" ,
37
32
target_arch = "x86_64" ,
38
33
target_arch = "arm" ,
39
34
target_arch = "aarch64" ) ) ,
40
35
target_os = "android" ) ) ]
41
- mod consts {
42
- use libc;
43
- pub const FIONBIO : libc:: c_ulong = 0x5421 ;
44
- pub const FIOCLEX : libc:: c_ulong = 0x5451 ;
45
- pub const FIONCLEX : libc:: c_ulong = 0x5450 ;
46
- }
36
+ pub const FIOCLEX : libc:: c_ulong = 0x5451 ;
37
+
47
38
#[ cfg( all( target_os = "linux" ,
48
39
any( target_arch = "mips" ,
49
40
target_arch = "mipsel" ,
50
41
target_arch = "powerpc" ) ) ) ]
51
- mod consts {
52
- use libc;
53
- pub const FIONBIO : libc:: c_ulong = 0x667e ;
54
- pub const FIOCLEX : libc:: c_ulong = 0x6601 ;
55
- pub const FIONCLEX : libc:: c_ulong = 0x6600 ;
56
- }
57
- pub use self :: consts:: * ;
58
-
59
- #[ cfg( any( target_os = "macos" ,
60
- target_os = "ios" ,
61
- target_os = "freebsd" ,
62
- target_os = "dragonfly" ,
63
- target_os = "bitrig" ,
64
- target_os = "openbsd" ) ) ]
65
- pub const MSG_DONTWAIT : libc:: c_int = 0x80 ;
66
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
67
- pub const MSG_DONTWAIT : libc:: c_int = 0x40 ;
42
+ pub const FIOCLEX : libc:: c_ulong = 0x6601 ;
68
43
69
44
pub const WNOHANG : libc:: c_int = 1 ;
70
45
@@ -123,13 +98,6 @@ pub struct passwd {
123
98
}
124
99
125
100
extern {
126
- pub fn gettimeofday ( timeval : * mut libc:: timeval ,
127
- tzp : * mut libc:: c_void ) -> libc:: c_int ;
128
- pub fn select ( nfds : libc:: c_int ,
129
- readfds : * mut fd_set ,
130
- writefds : * mut fd_set ,
131
- errorfds : * mut fd_set ,
132
- timeout : * mut libc:: timeval ) -> libc:: c_int ;
133
101
pub fn getsockopt ( sockfd : libc:: c_int ,
134
102
level : libc:: c_int ,
135
103
optname : libc:: c_int ,
@@ -165,44 +133,6 @@ extern {
165
133
-> * mut libc:: c_char ;
166
134
}
167
135
168
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
169
- mod select {
170
- pub const FD_SETSIZE : usize = 1024 ;
171
-
172
- #[ repr( C ) ]
173
- pub struct fd_set {
174
- fds_bits : [ i32 ; ( FD_SETSIZE / 32 ) ]
175
- }
176
-
177
- pub fn fd_set ( set : & mut fd_set , fd : i32 ) {
178
- set. fds_bits [ ( fd / 32 ) as usize ] |= 1 << ( ( fd % 32 ) as usize ) ;
179
- }
180
- }
181
-
182
- #[ cfg( any( target_os = "android" ,
183
- target_os = "freebsd" ,
184
- target_os = "dragonfly" ,
185
- target_os = "bitrig" ,
186
- target_os = "openbsd" ,
187
- target_os = "linux" ) ) ]
188
- mod select {
189
- use usize;
190
- use libc;
191
-
192
- pub const FD_SETSIZE : usize = 1024 ;
193
-
194
- #[ repr( C ) ]
195
- pub struct fd_set {
196
- // FIXME: shouldn't this be a c_ulong?
197
- fds_bits : [ libc:: uintptr_t ; ( FD_SETSIZE / usize:: BITS ) ]
198
- }
199
-
200
- pub fn fd_set ( set : & mut fd_set , fd : i32 ) {
201
- let fd = fd as usize ;
202
- set. fds_bits [ fd / usize:: BITS ] |= 1 << ( fd % usize:: BITS ) ;
203
- }
204
- }
205
-
206
136
#[ cfg( any( all( target_os = "linux" ,
207
137
any( target_arch = "x86" ,
208
138
target_arch = "x86_64" ,
0 commit comments