File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
branches/stable/src/libstd/sys/unix Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
29
29
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
30
30
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
31
31
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32
- refs/heads/stable: cae005162d1d7aea6cffdc299fedf0d2bb2a4b28
32
+ refs/heads/stable: a8dbb92b471cae1d3f8225857f5553311dd8aeb3
33
33
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
34
34
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ extern {
135
135
pub fn sigaltstack ( ss : * const sigaltstack ,
136
136
oss : * mut sigaltstack ) -> libc:: c_int ;
137
137
138
+ #[ cfg( not( target_os = "android" ) ) ]
138
139
pub fn sigemptyset ( set : * mut sigset_t ) -> libc:: c_int ;
140
+
139
141
pub fn pthread_sigmask ( how : libc:: c_int , set : * const sigset_t ,
140
142
oldset : * mut sigset_t ) -> libc:: c_int ;
141
143
@@ -155,6 +157,14 @@ extern {
155
157
-> * mut libc:: c_char ;
156
158
}
157
159
160
+ // Ugh. This is only available as an inline until Android API 21.
161
+ #[ cfg( target_os = "android" ) ]
162
+ pub unsafe fn sigemptyset ( set : * mut sigset_t ) -> libc:: c_int {
163
+ use intrinsics;
164
+ intrinsics:: write_bytes ( set, 0 , 1 ) ;
165
+ return 0 ;
166
+ }
167
+
158
168
#[ cfg( any( target_os = "linux" ,
159
169
target_os = "android" ) ) ]
160
170
mod signal_os {
Original file line number Diff line number Diff line change @@ -446,12 +446,22 @@ mod tests {
446
446
use mem;
447
447
use ptr;
448
448
use libc;
449
+ use slice;
449
450
use sys:: { self , c, cvt, pipe} ;
450
451
452
+ #[ cfg( not( target_os = "android" ) ) ]
451
453
extern {
452
454
fn sigaddset ( set : * mut c:: sigset_t , signum : libc:: c_int ) -> libc:: c_int ;
453
455
}
454
456
457
+ #[ cfg( target_os = "android" ) ]
458
+ unsafe fn sigaddset ( set : * mut c:: sigset_t , signum : libc:: c_int ) -> libc:: c_int {
459
+ let raw = slice:: from_raw_parts_mut ( set as * mut u8 , mem:: size_of :: < c:: sigset_t > ( ) ) ;
460
+ let bit = ( signum - 1 ) as usize ;
461
+ raw[ bit / 8 ] |= 1 << ( bit % 8 ) ;
462
+ return 0 ;
463
+ }
464
+
455
465
#[ test]
456
466
fn test_process_mask ( ) {
457
467
unsafe {
You can’t perform that action at this time.
0 commit comments