1
- pub const PATH_MAX : :: c_int = 4096 ;
2
-
3
- pub const F_GETLK : :: c_int = 5 ;
4
- pub const F_SETLK : :: c_int = 6 ;
5
- pub const F_SETLKW : :: c_int = 7 ;
6
-
7
1
pub type c_char = i8 ;
8
2
pub type c_long = i64 ;
9
3
pub type c_ulong = u64 ;
@@ -49,8 +43,6 @@ impl ::Clone for timezone {
49
43
fn clone ( & self ) -> timezone { * self }
50
44
}
51
45
52
- pub const UTSLENGTH : usize = 65 ;
53
-
54
46
s_no_extra_traits ! {
55
47
#[ repr( C ) ]
56
48
pub struct utsname {
@@ -243,6 +235,27 @@ s! {
243
235
}
244
236
}
245
237
238
+ pub const UTSLENGTH : usize = 65 ;
239
+
240
+ // intentionally not public, only used for fd_set
241
+ cfg_if ! {
242
+ if #[ cfg( target_pointer_width = "32" ) ] {
243
+ const ULONG_SIZE : usize = 32 ;
244
+ } else if #[ cfg( target_pointer_width = "64" ) ] {
245
+ const ULONG_SIZE : usize = 64 ;
246
+ } else {
247
+ // Unknown target_pointer_width
248
+ }
249
+ }
250
+
251
+ // limits.h
252
+ pub const PATH_MAX : :: c_int = 4096 ;
253
+
254
+ // fcntl.h
255
+ pub const F_GETLK : :: c_int = 5 ;
256
+ pub const F_SETLK : :: c_int = 6 ;
257
+ pub const F_SETLKW : :: c_int = 7 ;
258
+
246
259
// TODO: relibc {
247
260
pub const RTLD_DEFAULT : * mut :: c_void = 0i64 as * mut :: c_void ;
248
261
// }
@@ -335,10 +348,12 @@ pub const EREMCHG: ::c_int = 78; /* Remote address changed */
335
348
pub const ELIBACC : :: c_int = 79 ; /* Can not access a needed shared library */
336
349
pub const ELIBBAD : :: c_int = 80 ; /* Accessing a corrupted shared library */
337
350
pub const ELIBSCN : :: c_int = 81 ; /* .lib section in a.out corrupted */
338
- pub const ELIBMAX : :: c_int = 82 ; /* Attempting to link in too many shared libraries */
351
+ /* Attempting to link in too many shared libraries */
352
+ pub const ELIBMAX : :: c_int = 82 ;
339
353
pub const ELIBEXEC : :: c_int = 83 ; /* Cannot exec a shared library directly */
340
354
pub const EILSEQ : :: c_int = 84 ; /* Illegal byte sequence */
341
- pub const ERESTART : :: c_int = 85 ; /* Interrupted system call should be restarted */
355
+ /* Interrupted system call should be restarted */
356
+ pub const ERESTART : :: c_int = 85 ;
342
357
pub const ESTRPIPE : :: c_int = 86 ; /* Streams pipe error */
343
358
pub const EUSERS : :: c_int = 87 ; /* Too many users */
344
359
pub const ENOTSOCK : :: c_int = 88 ; /* Socket operation on non-socket */
@@ -348,20 +363,24 @@ pub const EPROTOTYPE: ::c_int = 91; /* Protocol wrong type for socket */
348
363
pub const ENOPROTOOPT : :: c_int = 92 ; /* Protocol not available */
349
364
pub const EPROTONOSUPPORT : :: c_int = 93 ; /* Protocol not supported */
350
365
pub const ESOCKTNOSUPPORT : :: c_int = 94 ; /* Socket type not supported */
351
- pub const EOPNOTSUPP : :: c_int = 95 ; /* Operation not supported on transport endpoint */
366
+ /* Operation not supported on transport endpoint */
367
+ pub const EOPNOTSUPP : :: c_int = 95 ;
352
368
pub const EPFNOSUPPORT : :: c_int = 96 ; /* Protocol family not supported */
353
- pub const EAFNOSUPPORT : :: c_int = 97 ; /* Address family not supported by protocol */
369
+ /* Address family not supported by protocol */
370
+ pub const EAFNOSUPPORT : :: c_int = 97 ;
354
371
pub const EADDRINUSE : :: c_int = 98 ; /* Address already in use */
355
372
pub const EADDRNOTAVAIL : :: c_int = 99 ; /* Cannot assign requested address */
356
373
pub const ENETDOWN : :: c_int = 100 ; /* Network is down */
357
374
pub const ENETUNREACH : :: c_int = 101 ; /* Network is unreachable */
358
- pub const ENETRESET : :: c_int = 102 ; /* Network dropped connection because of reset */
375
+ /* Network dropped connection because of reset */
376
+ pub const ENETRESET : :: c_int = 102 ;
359
377
pub const ECONNABORTED : :: c_int = 103 ; /* Software caused connection abort */
360
378
pub const ECONNRESET : :: c_int = 104 ; /* Connection reset by peer */
361
379
pub const ENOBUFS : :: c_int = 105 ; /* No buffer space available */
362
380
pub const EISCONN : :: c_int = 106 ; /* Transport endpoint is already connected */
363
381
pub const ENOTCONN : :: c_int = 107 ; /* Transport endpoint is not connected */
364
- pub const ESHUTDOWN : :: c_int = 108 ; /* Cannot send after transport endpoint shutdown */
382
+ /* Cannot send after transport endpoint shutdown */
383
+ pub const ESHUTDOWN : :: c_int = 108 ;
365
384
pub const ETOOMANYREFS : :: c_int = 109 ; /* Too many references: cannot splice */
366
385
pub const ETIMEDOUT : :: c_int = 110 ; /* Connection timed out */
367
386
pub const ECONNREFUSED : :: c_int = 111 ; /* Connection refused */
@@ -705,18 +724,7 @@ f! {
705
724
}
706
725
}
707
726
708
- // intentionally not public, only used for fd_set
709
- cfg_if ! {
710
- if #[ cfg( target_pointer_width = "32" ) ] {
711
- const ULONG_SIZE : usize = 32 ;
712
- } else if #[ cfg( target_pointer_width = "64" ) ] {
713
- const ULONG_SIZE : usize = 64 ;
714
- } else {
715
- // Unknown target_pointer_width
716
- }
717
- }
718
-
719
- extern "C" {
727
+ extern {
720
728
// errno.h
721
729
pub fn __errno_location ( ) -> * mut :: c_int ;
722
730
@@ -728,14 +736,14 @@ extern "C" {
728
736
729
737
// pthread.h
730
738
pub fn pthread_atfork (
731
- prepare : :: Option < unsafe extern "C" fn ( ) > ,
732
- parent : :: Option < unsafe extern "C" fn ( ) > ,
733
- child : :: Option < unsafe extern "C" fn ( ) > ,
739
+ prepare : :: Option < unsafe extern fn ( ) > ,
740
+ parent : :: Option < unsafe extern fn ( ) > ,
741
+ child : :: Option < unsafe extern fn ( ) > ,
734
742
) -> :: c_int ;
735
743
pub fn pthread_create (
736
744
tid : * mut :: pthread_t ,
737
745
attr : * const :: pthread_attr_t ,
738
- start : extern "C" fn ( * mut :: c_void ) -> * mut :: c_void ,
746
+ start : extern fn ( * mut :: c_void ) -> * mut :: c_void ,
739
747
arg : * mut :: c_void ,
740
748
) -> :: c_int ;
741
749
pub fn pthread_condattr_setclock (
0 commit comments