Skip to content

Commit cea22b6

Browse files
committed
---
yaml --- r: 226078 b: refs/heads/stable c: a8dbb92 h: refs/heads/master v: v3
1 parent 4e46369 commit cea22b6

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: cae005162d1d7aea6cffdc299fedf0d2bb2a4b28
32+
refs/heads/stable: a8dbb92b471cae1d3f8225857f5553311dd8aeb3
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/src/libstd/sys/unix/c.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ extern {
135135
pub fn sigaltstack(ss: *const sigaltstack,
136136
oss: *mut sigaltstack) -> libc::c_int;
137137

138+
#[cfg(not(target_os = "android"))]
138139
pub fn sigemptyset(set: *mut sigset_t) -> libc::c_int;
140+
139141
pub fn pthread_sigmask(how: libc::c_int, set: *const sigset_t,
140142
oldset: *mut sigset_t) -> libc::c_int;
141143

@@ -155,6 +157,14 @@ extern {
155157
-> *mut libc::c_char;
156158
}
157159

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+
158168
#[cfg(any(target_os = "linux",
159169
target_os = "android"))]
160170
mod signal_os {

branches/stable/src/libstd/sys/unix/process.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,22 @@ mod tests {
446446
use mem;
447447
use ptr;
448448
use libc;
449+
use slice;
449450
use sys::{self, c, cvt, pipe};
450451

452+
#[cfg(not(target_os = "android"))]
451453
extern {
452454
fn sigaddset(set: *mut c::sigset_t, signum: libc::c_int) -> libc::c_int;
453455
}
454456

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+
455465
#[test]
456466
fn test_process_mask() {
457467
unsafe {

0 commit comments

Comments
 (0)