diff options
author | Philipp Keller <philipp.keller@gmail.com> | 2016-09-16 07:14:29 +0200 |
---|---|---|
committer | Philipp Keller <philipp.keller@gmail.com> | 2016-09-16 07:14:29 +0200 |
commit | 631a27a545906f739e50393509e71fb847740c3a (patch) | |
tree | 1d3279093084c3f2b650bb3ff8b88c2df9c2d69c /src/ucontext.rs | |
parent | 23a7ea64938cc73d476e42b80a243fefbe7111b2 (diff) | |
parent | 7c0570d3ad3c8e5fdd45c7de745771a6be054c3c (diff) | |
download | nix-631a27a545906f739e50393509e71fb847740c3a.zip |
made it running with rust 1.2, added documentation to mkstemp
Diffstat (limited to 'src/ucontext.rs')
-rw-r--r-- | src/ucontext.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ucontext.rs b/src/ucontext.rs index f77b4815..6886dd41 100644 --- a/src/ucontext.rs +++ b/src/ucontext.rs @@ -1,6 +1,8 @@ use libc; +#[cfg(not(target_env = "musl"))] use {Errno, Result}; use std::mem; +use sys::signal::SigSet; #[derive(Clone, Copy)] pub struct UContext { @@ -8,6 +10,7 @@ pub struct UContext { } impl UContext { + #[cfg(not(target_env = "musl"))] pub fn get() -> Result<UContext> { let mut context: libc::ucontext_t = unsafe { mem::uninitialized() }; let res = unsafe { @@ -16,10 +19,19 @@ impl UContext { Errno::result(res).map(|_| UContext { context: context }) } + #[cfg(not(target_env = "musl"))] pub fn set(&self) -> Result<()> { let res = unsafe { libc::setcontext(&self.context as *const libc::ucontext_t) }; Errno::result(res).map(drop) } + + pub fn sigmask_mut(&mut self) -> &mut SigSet { + unsafe { mem::transmute(&mut self.context.uc_sigmask) } + } + + pub fn sigmask(&self) -> &SigSet { + unsafe { mem::transmute(&self.context.uc_sigmask) } + } } |