@@ -8,20 +8,17 @@ use std::ptr;
8
8
use { Error , Result } ;
9
9
10
10
pub use libc:: {
11
- SIGHUP , // 1
12
- SIGINT , // 2
13
- SIGQUIT , // 3
14
- SIGILL , // 4
15
- SIGABRT , // 6
16
- SIGFPE , // 8
17
- SIGKILL , // 9
18
- SIGSEGV , // 11
19
- SIGPIPE , // 13
20
- SIGALRM , // 14
21
- SIGTERM , // 15
22
- } ;
23
-
24
- pub use self :: signal:: {
11
+ SIGHUP ,
12
+ SIGINT ,
13
+ SIGQUIT ,
14
+ SIGILL ,
15
+ SIGABRT ,
16
+ SIGFPE ,
17
+ SIGKILL ,
18
+ SIGSEGV ,
19
+ SIGPIPE ,
20
+ SIGALRM ,
21
+ SIGTERM ,
25
22
SIGTRAP ,
26
23
SIGIOT ,
27
24
SIGBUS ,
@@ -41,10 +38,13 @@ pub use self::signal::{
41
38
SIGWINCH ,
42
39
SIGUSR1 ,
43
40
SIGUSR2 ,
44
-
45
- NSIG ,
46
41
} ;
47
42
43
+ // This doesn't always exist, but when it does, it's 7
44
+ pub const SIGEMT : libc:: c_int = 7 ;
45
+
46
+ pub const NSIG : libc:: c_int = 32 ;
47
+
48
48
pub use self :: signal:: {
49
49
SockFlag ,
50
50
@@ -60,9 +60,6 @@ pub use self::signal::{
60
60
pub use self :: signal:: { HowFlag , SIG_BLOCK , SIG_UNBLOCK , SIG_SETMASK } ;
61
61
pub use self :: signal:: sigset_t;
62
62
63
- // This doesn't always exist, but when it does, it's 7
64
- pub const SIGEMT : libc:: c_int = 7 ;
65
-
66
63
#[ cfg( any( all( target_os = "linux" ,
67
64
any( target_arch = "x86" ,
68
65
target_arch = "x86_64" ,
@@ -92,32 +89,6 @@ pub mod signal {
92
89
}
93
90
}
94
91
95
- pub const SIGTRAP : libc:: c_int = 5 ;
96
- pub const SIGIOT : libc:: c_int = 6 ;
97
- pub const SIGBUS : libc:: c_int = 7 ;
98
- pub const SIGUSR1 : libc:: c_int = 10 ;
99
- pub const SIGUSR2 : libc:: c_int = 12 ;
100
- pub const SIGSTKFLT : libc:: c_int = 16 ;
101
- pub const SIGCHLD : libc:: c_int = 17 ;
102
- pub const SIGCONT : libc:: c_int = 18 ;
103
- pub const SIGSTOP : libc:: c_int = 19 ;
104
- pub const SIGTSTP : libc:: c_int = 20 ;
105
- pub const SIGTTIN : libc:: c_int = 21 ;
106
- pub const SIGTTOU : libc:: c_int = 22 ;
107
- pub const SIGURG : libc:: c_int = 23 ;
108
- pub const SIGXCPU : libc:: c_int = 24 ;
109
- pub const SIGXFSZ : libc:: c_int = 25 ;
110
- pub const SIGVTALRM : libc:: c_int = 26 ;
111
- pub const SIGPROF : libc:: c_int = 27 ;
112
- pub const SIGWINCH : libc:: c_int = 28 ;
113
- pub const SIGIO : libc:: c_int = 29 ;
114
- pub const SIGPOLL : libc:: c_int = 29 ;
115
- pub const SIGPWR : libc:: c_int = 30 ;
116
- pub const SIGSYS : libc:: c_int = 31 ;
117
- pub const SIGUNUSED : libc:: c_int = 31 ;
118
-
119
- pub const NSIG : libc:: c_int = 32 ;
120
-
121
92
// This definition is not as accurate as it could be, {pid, uid, status} is
122
93
// actually a giant union. Currently we're only interested in these fields,
123
94
// however.
@@ -181,31 +152,6 @@ pub mod signal {
181
152
}
182
153
}
183
154
184
- pub const SIGTRAP : libc:: c_int = 5 ;
185
- pub const SIGIOT : libc:: c_int = 6 ;
186
- pub const SIGBUS : libc:: c_int = 10 ;
187
- pub const SIGSYS : libc:: c_int = 12 ;
188
- pub const SIGUSR1 : libc:: c_int = 16 ;
189
- pub const SIGUSR2 : libc:: c_int = 17 ;
190
- pub const SIGCHLD : libc:: c_int = 18 ;
191
- pub const SIGCLD : libc:: c_int = 18 ;
192
- pub const SIGPWR : libc:: c_int = 19 ;
193
- pub const SIGWINCH : libc:: c_int = 20 ;
194
- pub const SIGURG : libc:: c_int = 21 ;
195
- pub const SIGIO : libc:: c_int = 22 ;
196
- pub const SIGPOLL : libc:: c_int = 22 ;
197
- pub const SIGSTOP : libc:: c_int = 23 ;
198
- pub const SIGTSTP : libc:: c_int = 24 ;
199
- pub const SIGCONT : libc:: c_int = 25 ;
200
- pub const SIGTTIN : libc:: c_int = 26 ;
201
- pub const SIGTTOU : libc:: c_int = 27 ;
202
- pub const SIGVTALRM : libc:: c_int = 28 ;
203
- pub const SIGPROF : libc:: c_int = 29 ;
204
- pub const SIGXCPU : libc:: c_int = 30 ;
205
- pub const SIGFSZ : libc:: c_int = 31 ;
206
-
207
- pub const NSIG : libc:: c_int = 32 ;
208
-
209
155
// This definition is not as accurate as it could be, {pid, uid, status} is
210
156
// actually a giant union. Currently we're only interested in these fields,
211
157
// however.
@@ -263,29 +209,6 @@ pub mod signal {
263
209
}
264
210
}
265
211
266
- pub const SIGTRAP : libc:: c_int = 5 ;
267
- pub const SIGIOT : libc:: c_int = 6 ;
268
- pub const SIGBUS : libc:: c_int = 10 ;
269
- pub const SIGSYS : libc:: c_int = 12 ;
270
- pub const SIGURG : libc:: c_int = 16 ;
271
- pub const SIGSTOP : libc:: c_int = 17 ;
272
- pub const SIGTSTP : libc:: c_int = 18 ;
273
- pub const SIGCONT : libc:: c_int = 19 ;
274
- pub const SIGCHLD : libc:: c_int = 20 ;
275
- pub const SIGTTIN : libc:: c_int = 21 ;
276
- pub const SIGTTOU : libc:: c_int = 22 ;
277
- pub const SIGIO : libc:: c_int = 23 ;
278
- pub const SIGXCPU : libc:: c_int = 24 ;
279
- pub const SIGXFSZ : libc:: c_int = 25 ;
280
- pub const SIGVTALRM : libc:: c_int = 26 ;
281
- pub const SIGPROF : libc:: c_int = 27 ;
282
- pub const SIGWINCH : libc:: c_int = 28 ;
283
- pub const SIGINFO : libc:: c_int = 29 ;
284
- pub const SIGUSR1 : libc:: c_int = 30 ;
285
- pub const SIGUSR2 : libc:: c_int = 31 ;
286
-
287
- pub const NSIG : libc:: c_int = 32 ;
288
-
289
212
#[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "openbsd" ) ) ]
290
213
pub type sigset_t = u32 ;
291
214
#[ cfg( target_os = "freebsd" ) ]
@@ -559,38 +482,38 @@ mod tests {
559
482
#[ test]
560
483
fn test_contains ( ) {
561
484
let mut mask = SigSet :: empty ( ) ;
562
- mask. add ( signal :: SIGUSR1 ) . unwrap ( ) ;
485
+ mask. add ( SIGUSR1 ) . unwrap ( ) ;
563
486
564
- assert_eq ! ( mask. contains( signal :: SIGUSR1 ) , Ok ( true ) ) ;
565
- assert_eq ! ( mask. contains( signal :: SIGUSR2 ) , Ok ( false ) ) ;
487
+ assert_eq ! ( mask. contains( SIGUSR1 ) , Ok ( true ) ) ;
488
+ assert_eq ! ( mask. contains( SIGUSR2 ) , Ok ( false ) ) ;
566
489
567
490
let all = SigSet :: all ( ) ;
568
- assert_eq ! ( all. contains( signal :: SIGUSR1 ) , Ok ( true ) ) ;
569
- assert_eq ! ( all. contains( signal :: SIGUSR2 ) , Ok ( true ) ) ;
491
+ assert_eq ! ( all. contains( SIGUSR1 ) , Ok ( true ) ) ;
492
+ assert_eq ! ( all. contains( SIGUSR2 ) , Ok ( true ) ) ;
570
493
}
571
494
572
495
#[ test]
573
496
fn test_thread_signal_block ( ) {
574
497
let mut mask = SigSet :: empty ( ) ;
575
- mask. add ( signal :: SIGUSR1 ) . unwrap ( ) ;
498
+ mask. add ( SIGUSR1 ) . unwrap ( ) ;
576
499
577
500
assert ! ( mask. thread_block( ) . is_ok( ) ) ;
578
501
}
579
502
580
503
#[ test]
581
504
fn test_thread_signal_swap ( ) {
582
505
let mut mask = SigSet :: empty ( ) ;
583
- mask. add ( signal :: SIGUSR1 ) . unwrap ( ) ;
506
+ mask. add ( SIGUSR1 ) . unwrap ( ) ;
584
507
mask. thread_block ( ) . unwrap ( ) ;
585
508
586
509
assert ! ( SigSet :: thread_get_mask( ) . unwrap( ) . contains( SIGUSR1 ) . unwrap( ) ) ;
587
510
588
511
let mask2 = SigSet :: empty ( ) ;
589
- mask. add ( signal :: SIGUSR2 ) . unwrap ( ) ;
512
+ mask. add ( SIGUSR2 ) . unwrap ( ) ;
590
513
591
514
let oldmask = mask2. thread_swap_mask ( signal:: SIG_SETMASK ) . unwrap ( ) ;
592
515
593
- assert ! ( oldmask. contains( signal :: SIGUSR1 ) . unwrap( ) ) ;
594
- assert ! ( !oldmask. contains( signal :: SIGUSR2 ) . unwrap( ) ) ;
516
+ assert ! ( oldmask. contains( SIGUSR1 ) . unwrap( ) ) ;
517
+ assert ! ( !oldmask. contains( SIGUSR2 ) . unwrap( ) ) ;
595
518
}
596
519
}
0 commit comments