@@ -51,6 +51,286 @@ pub type pthread_mutexattr_t = usize;
51
51
pub type pthread_rwlock_t = usize ;
52
52
pub type pthread_rwlockattr_t = usize ;
53
53
54
+ s_no_extra_traits ! {
55
+ pub struct dirent {
56
+ pub d_ino: :: c_long,
57
+ pub d_off: off_t,
58
+ pub d_reclen: u16 ,
59
+ pub d_name: [ :: c_char; 256 ] ,
60
+ }
61
+
62
+ // Dummy
63
+ pub struct sockaddr_un {
64
+ pub sun_family: sa_family_t,
65
+ pub sun_path: [ :: c_char; 108 ] ,
66
+ }
67
+
68
+ pub struct sockaddr {
69
+ pub sa_len: u8 ,
70
+ pub sa_family: sa_family_t,
71
+ pub sa_data: [ :: c_char; 14 ] ,
72
+ }
73
+
74
+ pub struct sockaddr_in {
75
+ pub sin_len: u8 ,
76
+ pub sin_family: sa_family_t,
77
+ pub sin_port: :: in_port_t,
78
+ pub sin_addr: :: in_addr,
79
+ pub sin_zero: [ :: c_char; 8 ] ,
80
+ }
81
+
82
+ pub struct fd_set {
83
+ fds_bits: [ :: c_ulong; FD_SETSIZE / ULONG_SIZE ] ,
84
+ }
85
+
86
+ pub struct sockaddr_storage {
87
+ pub s2_len: u8 ,
88
+ pub ss_family: sa_family_t,
89
+ pub s2_data1: [ :: c_char; 2 ] ,
90
+ pub s2_data2: [ u32 ; 3 ] ,
91
+ pub s2_data3: [ u32 ; 3 ] ,
92
+ }
93
+
94
+ pub struct stat {
95
+ pub st_dev: :: dev_t,
96
+ pub st_ino: :: ino_t,
97
+ pub st_mode: :: mode_t,
98
+ pub st_nlink: :: nlink_t,
99
+ pub st_uid: :: uid_t,
100
+ pub st_gid: :: gid_t,
101
+ pub st_rdev: dev_t,
102
+ pub st_size: off_t,
103
+ pub st_atime: time_t,
104
+ pub st_atime_nsec: :: c_long,
105
+ pub st_mtime: time_t,
106
+ pub st_mtime_nsec: :: c_long,
107
+ pub st_ctime: time_t,
108
+ pub st_ctime_nsec: :: c_long,
109
+ pub st_blksize: blksize_t,
110
+ pub st_blocks: blkcnt_t,
111
+ pub st_spare4: [ :: c_long; 2 ] ,
112
+ }
113
+ }
114
+
115
+ cfg_if ! {
116
+ if #[ cfg( feature = "extra_traits" ) ] {
117
+ impl PartialEq for dirent {
118
+ fn eq( & self , other: & dirent) -> bool {
119
+ self . d_ino == other. d_ino
120
+ && self . d_off == other. d_off
121
+ && self . d_reclen == other. d_reclen
122
+ && self
123
+ . d_name
124
+ . iter( )
125
+ . zip( other. d_name. iter( ) )
126
+ . all( |( a, b) | a == b)
127
+ }
128
+ }
129
+ impl Eq for dirent { }
130
+ impl :: fmt:: Debug for dirent {
131
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
132
+ f. debug_struct( "dirent" )
133
+ . field( "d_ino" , & self . d_ino)
134
+ . field( "d_off" , & self . d_off)
135
+ . field( "d_reclen" , & self . d_reclen)
136
+ // FIXME: .field("d_name", &self.d_name)
137
+ . finish( )
138
+ }
139
+ }
140
+ impl :: hash:: Hash for dirent {
141
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
142
+ self . d_ino. hash( state) ;
143
+ self . d_off. hash( state) ;
144
+ self . d_reclen. hash( state) ;
145
+ self . d_name. hash( state) ;
146
+ }
147
+ }
148
+
149
+ impl PartialEq for sockaddr_un {
150
+ fn eq( & self , other: & sockaddr_un) -> bool {
151
+ self . sun_family == other. sun_family
152
+ && self
153
+ . sun_path
154
+ . iter( )
155
+ . zip( other. sun_path. iter( ) )
156
+ . all( |( a, b) | a == b)
157
+ }
158
+ }
159
+ impl Eq for sockaddr_un { }
160
+ impl :: fmt:: Debug for sockaddr_un {
161
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
162
+ f. debug_struct( "sockaddr_un" )
163
+ . field( "sun_family" , & self . sun_family)
164
+ // FIXME: .field("sun_path", &self.sun_path)
165
+ . finish( )
166
+ }
167
+ }
168
+ impl :: hash:: Hash for sockaddr_un {
169
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
170
+ self . sun_family. hash( state) ;
171
+ self . sun_path. hash( state) ;
172
+ }
173
+ }
174
+
175
+ impl PartialEq for sockaddr {
176
+ fn eq( & self , other: & sockaddr) -> bool {
177
+ self . sa_len == other. sa_len
178
+ && self . sa_family == other. sa_family
179
+ && self
180
+ . sa_data
181
+ . iter( )
182
+ . zip( other. sa_data. iter( ) )
183
+ . all( |( a, b) | a == b)
184
+ }
185
+ }
186
+ impl Eq for sockaddr { }
187
+ impl :: fmt:: Debug for sockaddr {
188
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
189
+ f. debug_struct( "sockaddr" )
190
+ . field( "sa_len" , & self . sa_len)
191
+ . field( "sa_family" , & self . sa_family)
192
+ // FIXME: .field("sa_data", &self.sa_data)
193
+ . finish( )
194
+ }
195
+ }
196
+ impl :: hash:: Hash for sockaddr {
197
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
198
+ self . sa_len. hash( state) ;
199
+ self . sa_family. hash( state) ;
200
+ self . sa_data. hash( state) ;
201
+ }
202
+ }
203
+
204
+ impl PartialEq for sockaddr_in {
205
+ fn eq( & self , other: & sockaddr_in) -> bool {
206
+ self . sin_len == other. sin_len
207
+ && self . sin_family == other. sin_family
208
+ && self . sin_port == other. sin_port
209
+ && self . sin_addr == other. sin_addr
210
+ && self
211
+ . sin_zero
212
+ . iter( )
213
+ . zip( other. sin_zero. iter( ) )
214
+ . all( |( a, b) | a == b)
215
+ }
216
+ }
217
+ impl Eq for sockaddr_in { }
218
+ impl :: fmt:: Debug for sockaddr_in {
219
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
220
+ f. debug_struct( "sockaddr_in" )
221
+ . field( "sin_len" , & self . sin_len)
222
+ . field( "sin_family" , & self . sin_family)
223
+ . field( "sin_port" , & self . sin_port)
224
+ . field( "sin_addr" , & self . sin_addr)
225
+ // FIXME: .field("sin_zero", &self.sin_zero)
226
+ . finish( )
227
+ }
228
+ }
229
+ impl :: hash:: Hash for sockaddr_in {
230
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
231
+ self . sin_len. hash( state) ;
232
+ self . sin_family. hash( state) ;
233
+ self . sin_port. hash( state) ;
234
+ self . sin_addr. hash( state) ;
235
+ self . sin_zero. hash( state) ;
236
+ }
237
+ }
238
+
239
+ impl PartialEq for fd_set {
240
+ fn eq( & self , other: & fd_set) -> bool {
241
+ self . fds_bits
242
+ . iter( )
243
+ . zip( other. fds_bits. iter( ) )
244
+ . all( |( a, b) | a == b)
245
+ }
246
+ }
247
+ impl Eq for fd_set { }
248
+ impl :: fmt:: Debug for fd_set {
249
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
250
+ f. debug_struct( "fd_set" )
251
+ // FIXME: .field("fds_bits", &self.fds_bits)
252
+ . finish( )
253
+ }
254
+ }
255
+ impl :: hash:: Hash for fd_set {
256
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
257
+ self . fds_bits. hash( state) ;
258
+ }
259
+ }
260
+
261
+ impl PartialEq for stat {
262
+ fn eq( & self , other: & stat) -> bool {
263
+ self . st_dev == other. st_dev
264
+ && self . st_ino == other. st_ino
265
+ && self . st_mode == other. st_mode
266
+ && self . st_nlink == other. st_nlink
267
+ && self . st_uid == other. st_uid
268
+ && self . st_gid == other. st_gid
269
+ && self . st_rdev == other. st_rdev
270
+ && self . st_size == other. st_size
271
+ && self . st_atime == other. st_atime
272
+ && self . st_atime_nsec == other. st_atime_nsec
273
+ && self . st_mtime == other. st_mtime
274
+ && self . st_mtime_nsec == other. st_mtime_nsec
275
+ && self . st_ctime == other. st_ctime
276
+ && self . st_ctime_nsec == other. st_ctime_nsec
277
+ && self . st_blksize == other. st_blksize
278
+ && self . st_blocks == other. st_blocks
279
+ && self
280
+ . st_spare4
281
+ . iter( )
282
+ . zip( other. st_spare4. iter( ) )
283
+ . all( |( a, b) | a == b)
284
+ }
285
+ }
286
+ impl Eq for stat { }
287
+ impl :: fmt:: Debug for stat {
288
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
289
+ f. debug_struct( "stat" )
290
+ . field( "st_dev" , & self . st_dev)
291
+ . field( "st_ino" , & self . st_ino)
292
+ . field( "st_mode" , & self . st_mode)
293
+ . field( "st_nlink" , & self . st_nlink)
294
+ . field( "st_uid" , & self . st_uid)
295
+ . field( "st_gid" , & self . st_gid)
296
+ . field( "st_rdev" , & self . st_rdev)
297
+ . field( "st_size" , & self . st_size)
298
+ . field( "st_atime" , & self . st_atime)
299
+ . field( "st_atime_nsec" , & self . st_atime_nsec)
300
+ . field( "st_mtime" , & self . st_mtime)
301
+ . field( "st_mtime_nsec" , & self . st_mtime_nsec)
302
+ . field( "st_ctime" , & self . st_ctime)
303
+ . field( "st_ctime_nsec" , & self . st_ctime_nsec)
304
+ . field( "st_blksize" , & self . st_blksize)
305
+ . field( "st_blocks" , & self . st_blocks)
306
+ // FIXME: .field("st_spare4", &self.st_spare4)
307
+ . finish( )
308
+ }
309
+ }
310
+ impl :: hash:: Hash for stat {
311
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
312
+ self . st_dev. hash( state) ;
313
+ self . st_ino. hash( state) ;
314
+ self . st_mode. hash( state) ;
315
+ self . st_nlink. hash( state) ;
316
+ self . st_uid. hash( state) ;
317
+ self . st_gid. hash( state) ;
318
+ self . st_rdev. hash( state) ;
319
+ self . st_size. hash( state) ;
320
+ self . st_atime. hash( state) ;
321
+ self . st_atime_nsec. hash( state) ;
322
+ self . st_mtime. hash( state) ;
323
+ self . st_mtime_nsec. hash( state) ;
324
+ self . st_ctime. hash( state) ;
325
+ self . st_ctime_nsec. hash( state) ;
326
+ self . st_blksize. hash( state) ;
327
+ self . st_blocks. hash( state) ;
328
+ self . st_spare4. hash( state) ;
329
+ }
330
+ }
331
+ }
332
+ }
333
+
54
334
s ! {
55
335
pub struct in_addr {
56
336
pub s_addr: :: in_addr_t,
72
352
pub ai_next: * mut addrinfo,
73
353
}
74
354
75
- pub struct dirent {
76
- pub d_ino: :: c_long,
77
- pub d_off: off_t,
78
- pub d_reclen: u16 ,
79
- pub d_name: [ :: c_char; 256 ] ,
80
- }
81
-
82
355
pub struct Dl_info { }
83
356
84
- pub struct fd_set {
85
- fds_bits: [ :: c_ulong; FD_SETSIZE / ULONG_SIZE ] ,
86
- }
87
-
88
357
pub struct lconv {
89
358
pub decimal_point: * mut :: c_char,
90
359
pub thousands_sep: * mut :: c_char,
@@ -143,20 +412,6 @@ s! {
143
412
pub sa_handler: usize ,
144
413
}
145
414
146
- pub struct sockaddr {
147
- pub sa_len: u8 ,
148
- pub sa_family: sa_family_t,
149
- pub sa_data: [ :: c_char; 14 ] ,
150
- }
151
-
152
- pub struct sockaddr_in {
153
- pub sin_len: u8 ,
154
- pub sin_family: sa_family_t,
155
- pub sin_port: :: in_port_t,
156
- pub sin_addr: :: in_addr,
157
- pub sin_zero: [ :: c_char; 8 ] ,
158
- }
159
-
160
415
pub struct sockaddr_in6 {
161
416
pub sin6_len: u8 ,
162
417
pub sin6_family: sa_family_t,
@@ -166,40 +421,6 @@ s! {
166
421
pub sin6_scope_id: u32 ,
167
422
}
168
423
169
- pub struct sockaddr_storage {
170
- pub s2_len: u8 ,
171
- pub ss_family: sa_family_t,
172
- pub s2_data1: [ :: c_char; 2 ] ,
173
- pub s2_data2: [ u32 ; 3 ] ,
174
- pub s2_data3: [ u32 ; 3 ] ,
175
- }
176
-
177
- // Dummy
178
- pub struct sockaddr_un {
179
- pub sun_family: sa_family_t,
180
- pub sun_path: [ :: c_char; 108 ] ,
181
- }
182
-
183
- pub struct stat {
184
- pub st_dev: :: dev_t,
185
- pub st_ino: :: ino_t,
186
- pub st_mode: :: mode_t,
187
- pub st_nlink: :: nlink_t,
188
- pub st_uid: :: uid_t,
189
- pub st_gid: :: gid_t,
190
- pub st_rdev: dev_t,
191
- pub st_size: off_t,
192
- pub st_atime: time_t,
193
- pub st_atime_nsec: :: c_long,
194
- pub st_mtime: time_t,
195
- pub st_mtime_nsec: :: c_long,
196
- pub st_ctime: time_t,
197
- pub st_ctime_nsec: :: c_long,
198
- pub st_blksize: blksize_t,
199
- pub st_blocks: blkcnt_t,
200
- pub st_spare4: [ :: c_long; 2 ] ,
201
- }
202
-
203
424
pub struct statvfs { }
204
425
205
426
pub struct tm {
0 commit comments