Skip to content

Commit 4c1e521

Browse files
committed
---
yaml --- r: 227740 b: refs/heads/try c: a8dbb92 h: refs/heads/master v: v3
1 parent 3e6233c commit 4c1e521

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: cae005162d1d7aea6cffdc299fedf0d2bb2a4b28
4+
refs/heads/try: a8dbb92b471cae1d3f8225857f5553311dd8aeb3
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/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)