@@ -11,50 +11,52 @@ use std::ptr;
1111#[ cfg( not( target_os = "openbsd" ) ) ]
1212pub use self :: sigevent:: * ;
1313
14- // Currently there is only one definition of c_int in libc, as well as only one
15- // type for signal constants.
16- // We would prefer to use the libc::c_int alias in the repr attribute. Unfortunately
17- // this is not (yet) possible.
18- #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
19- #[ repr( i32 ) ]
20- pub enum Signal {
21- SIGHUP = libc:: SIGHUP ,
22- SIGINT = libc:: SIGINT ,
23- SIGQUIT = libc:: SIGQUIT ,
24- SIGILL = libc:: SIGILL ,
25- SIGTRAP = libc:: SIGTRAP ,
26- SIGABRT = libc:: SIGABRT ,
27- SIGBUS = libc:: SIGBUS ,
28- SIGFPE = libc:: SIGFPE ,
29- SIGKILL = libc:: SIGKILL ,
30- SIGUSR1 = libc:: SIGUSR1 ,
31- SIGSEGV = libc:: SIGSEGV ,
32- SIGUSR2 = libc:: SIGUSR2 ,
33- SIGPIPE = libc:: SIGPIPE ,
34- SIGALRM = libc:: SIGALRM ,
35- SIGTERM = libc:: SIGTERM ,
36- #[ cfg( all( any( target_os = "linux" , target_os = "android" , target_os = "emscripten" ) , not( any( target_arch = "mips" , target_arch = "mips64" ) ) ) ) ]
37- SIGSTKFLT = libc:: SIGSTKFLT ,
38- SIGCHLD = libc:: SIGCHLD ,
39- SIGCONT = libc:: SIGCONT ,
40- SIGSTOP = libc:: SIGSTOP ,
41- SIGTSTP = libc:: SIGTSTP ,
42- SIGTTIN = libc:: SIGTTIN ,
43- SIGTTOU = libc:: SIGTTOU ,
44- SIGURG = libc:: SIGURG ,
45- SIGXCPU = libc:: SIGXCPU ,
46- SIGXFSZ = libc:: SIGXFSZ ,
47- SIGVTALRM = libc:: SIGVTALRM ,
48- SIGPROF = libc:: SIGPROF ,
49- SIGWINCH = libc:: SIGWINCH ,
50- SIGIO = libc:: SIGIO ,
51- #[ cfg( any( target_os = "linux" , target_os = "android" , target_os = "emscripten" ) ) ]
52- SIGPWR = libc:: SIGPWR ,
53- SIGSYS = libc:: SIGSYS ,
54- #[ cfg( not( any( target_os = "linux" , target_os = "android" , target_os = "emscripten" ) ) ) ]
55- SIGEMT = libc:: SIGEMT ,
56- #[ cfg( not( any( target_os = "linux" , target_os = "android" , target_os = "emscripten" ) ) ) ]
57- SIGINFO = libc:: SIGINFO ,
14+ libc_enum ! {
15+ // Currently there is only one definition of c_int in libc, as well as only one
16+ // type for signal constants.
17+ // We would prefer to use the libc::c_int alias in the repr attribute. Unfortunately
18+ // this is not (yet) possible.
19+ #[ repr( i32 ) ]
20+ pub enum Signal {
21+ SIGHUP ,
22+ SIGINT ,
23+ SIGQUIT ,
24+ SIGILL ,
25+ SIGTRAP ,
26+ SIGABRT ,
27+ SIGBUS ,
28+ SIGFPE ,
29+ SIGKILL ,
30+ SIGUSR1 ,
31+ SIGSEGV ,
32+ SIGUSR2 ,
33+ SIGPIPE ,
34+ SIGALRM ,
35+ SIGTERM ,
36+ #[ cfg( all( any( target_os = "android" , target_os = "emscripten" , target_os = "linux" ) ,
37+ not( any( target_arch = "mips" , target_arch = "mips64" ) ) ) ) ]
38+ SIGSTKFLT ,
39+ SIGCHLD ,
40+ SIGCONT ,
41+ SIGSTOP ,
42+ SIGTSTP ,
43+ SIGTTIN ,
44+ SIGTTOU ,
45+ SIGURG ,
46+ SIGXCPU ,
47+ SIGXFSZ ,
48+ SIGVTALRM ,
49+ SIGPROF ,
50+ SIGWINCH ,
51+ SIGIO ,
52+ #[ cfg( any( target_os = "android" , target_os = "emscripten" , target_os = "linux" ) ) ]
53+ SIGPWR ,
54+ SIGSYS ,
55+ #[ cfg( not( any( target_os = "android" , target_os = "emscripten" , target_os = "linux" ) ) ) ]
56+ SIGEMT ,
57+ #[ cfg( not( any( target_os = "android" , target_os = "emscripten" , target_os = "linux" ) ) ) ]
58+ SIGINFO ,
59+ }
5860}
5961
6062pub use self :: Signal :: * ;
@@ -241,12 +243,13 @@ libc_bitflags!{
241243 }
242244}
243245
244- #[ repr( i32 ) ]
245- #[ derive( Clone , Copy , PartialEq ) ]
246- pub enum SigmaskHow {
247- SIG_BLOCK = libc:: SIG_BLOCK ,
248- SIG_UNBLOCK = libc:: SIG_UNBLOCK ,
249- SIG_SETMASK = libc:: SIG_SETMASK ,
246+ libc_enum ! {
247+ #[ repr( i32 ) ]
248+ pub enum SigmaskHow {
249+ SIG_BLOCK ,
250+ SIG_UNBLOCK ,
251+ SIG_SETMASK ,
252+ }
250253}
251254
252255#[ derive( Clone , Copy ) ]
0 commit comments