Skip to content

Commit 0af8f18

Browse files
committed
Style
1 parent e6671e3 commit 0af8f18

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

src/unix/redox/mod.rs

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
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-
71
pub type c_char = i8;
82
pub type c_long = i64;
93
pub type c_ulong = u64;
@@ -49,8 +43,6 @@ impl ::Clone for timezone {
4943
fn clone(&self) -> timezone { *self }
5044
}
5145

52-
pub const UTSLENGTH: usize = 65;
53-
5446
s_no_extra_traits! {
5547
#[repr(C)]
5648
pub struct utsname {
@@ -243,6 +235,27 @@ s! {
243235
}
244236
}
245237

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+
246259
// TODO: relibc {
247260
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
248261
// }
@@ -335,10 +348,12 @@ pub const EREMCHG: ::c_int = 78; /* Remote address changed */
335348
pub const ELIBACC: ::c_int = 79; /* Can not access a needed shared library */
336349
pub const ELIBBAD: ::c_int = 80; /* Accessing a corrupted shared library */
337350
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;
339353
pub const ELIBEXEC: ::c_int = 83; /* Cannot exec a shared library directly */
340354
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;
342357
pub const ESTRPIPE: ::c_int = 86; /* Streams pipe error */
343358
pub const EUSERS: ::c_int = 87; /* Too many users */
344359
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 */
348363
pub const ENOPROTOOPT: ::c_int = 92; /* Protocol not available */
349364
pub const EPROTONOSUPPORT: ::c_int = 93; /* Protocol not supported */
350365
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;
352368
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;
354371
pub const EADDRINUSE: ::c_int = 98; /* Address already in use */
355372
pub const EADDRNOTAVAIL: ::c_int = 99; /* Cannot assign requested address */
356373
pub const ENETDOWN: ::c_int = 100; /* Network is down */
357374
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;
359377
pub const ECONNABORTED: ::c_int = 103; /* Software caused connection abort */
360378
pub const ECONNRESET: ::c_int = 104; /* Connection reset by peer */
361379
pub const ENOBUFS: ::c_int = 105; /* No buffer space available */
362380
pub const EISCONN: ::c_int = 106; /* Transport endpoint is already connected */
363381
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;
365384
pub const ETOOMANYREFS: ::c_int = 109; /* Too many references: cannot splice */
366385
pub const ETIMEDOUT: ::c_int = 110; /* Connection timed out */
367386
pub const ECONNREFUSED: ::c_int = 111; /* Connection refused */
@@ -705,18 +724,7 @@ f! {
705724
}
706725
}
707726

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 {
720728
// errno.h
721729
pub fn __errno_location() -> *mut ::c_int;
722730
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
@@ -730,14 +738,14 @@ extern "C" {
730738

731739
// pthread.h
732740
pub fn pthread_atfork(
733-
prepare: ::Option<unsafe extern "C" fn()>,
734-
parent: ::Option<unsafe extern "C" fn()>,
735-
child: ::Option<unsafe extern "C" fn()>,
741+
prepare: ::Option<unsafe extern fn()>,
742+
parent: ::Option<unsafe extern fn()>,
743+
child: ::Option<unsafe extern fn()>,
736744
) -> ::c_int;
737745
pub fn pthread_create(
738746
tid: *mut ::pthread_t,
739747
attr: *const ::pthread_attr_t,
740-
start: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
748+
start: extern fn(*mut ::c_void) -> *mut ::c_void,
741749
arg: *mut ::c_void,
742750
) -> ::c_int;
743751
pub fn pthread_condattr_setclock(

0 commit comments

Comments
 (0)