Skip to content

Commit 8f72f00

Browse files
Signal io impl for GLibc NaCl targets.
1 parent 13bfa8b commit 8f72f00

File tree

1 file changed

+33
-0
lines changed
  • src/libstd/sys/unix

1 file changed

+33
-0
lines changed

src/libstd/sys/unix/c.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,39 @@ mod signal {
167167
pub handler: extern fn(libc::c_int),
168168
}
169169
}
170+
#[cfg(all(target_os = "nacl", target_libc = "glibc"))]
171+
mod signal {
172+
use libc;
173+
174+
pub const SA_NOCLDSTOP: libc::c_ulong = 1;
175+
pub const SA_NOCLDWAIT: libc::c_ulong = 2;
176+
pub const SA_SIGINFO: libc::c_ulong = 4;
177+
178+
const __SI_MAX_SIZE: uint = 128;
179+
#[cfg(target_word_size = "64")]
180+
const __SI_PAD_SIZE: uint = (__SI_MAX_SIZE / 4) - 4;
181+
#[cfg(target_word_size = "32")]
182+
const __SI_PAD_SIZE: uint = (__SI_MAX_SIZE / 4) - 3;
183+
184+
#[repr(C)]
185+
pub struct siginfo {
186+
si_signo: libc::c_int,
187+
si_code: libc::c_int,
188+
si_errno: libc::c_int,
189+
190+
_pad: [libc::c_int, ..__SI_PAD_SIZE],
191+
}
192+
pub type sigset_t = libc::c_ulong;
193+
194+
#[repr(C)]
195+
pub struct sigaction {
196+
pub sa_handler: extern "C" fn(libc::c_int),
197+
pub sa_sigaction: extern "C" fn(libc::c_int, *mut siginfo, *mut libc::c_void),
198+
pub sa_mask: sigset_t,
199+
pub sa_flags: libc::c_int,
200+
pub sa_restorer: extern "C" fn(),
201+
}
202+
}
170203

171204
#[cfg(any(all(target_os = "linux",
172205
any(target_arch = "x86",

0 commit comments

Comments
 (0)