From e3e92d74fb62204436f9d02b2c41619393debf0d Mon Sep 17 00:00:00 2001 From: Justin Latimer Date: Wed, 18 May 2016 05:18:30 +0000 Subject: Exclude UContext::get(),set() on musl, not available from libc. --- src/ucontext.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ucontext.rs') diff --git a/src/ucontext.rs b/src/ucontext.rs index f77b4815..ce4e489f 100644 --- a/src/ucontext.rs +++ b/src/ucontext.rs @@ -1,5 +1,7 @@ use libc; +#[cfg(not(target_env = "musl"))] use {Errno, Result}; +#[cfg(not(target_env = "musl"))] use std::mem; #[derive(Clone, Copy)] @@ -8,6 +10,7 @@ pub struct UContext { } impl UContext { + #[cfg(not(target_env = "musl"))] pub fn get() -> Result { let mut context: libc::ucontext_t = unsafe { mem::uninitialized() }; let res = unsafe { @@ -16,6 +19,7 @@ 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) -- cgit v1.2.3 From dbcf7923b770394fdec8d9bb4bc8e3daef65e5ba Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Thu, 5 May 2016 18:44:38 +0200 Subject: Provide accessors to sigmask of UContext. --- src/ucontext.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ucontext.rs') diff --git a/src/ucontext.rs b/src/ucontext.rs index ce4e489f..89c8cae2 100644 --- a/src/ucontext.rs +++ b/src/ucontext.rs @@ -3,6 +3,7 @@ use libc; use {Errno, Result}; #[cfg(not(target_env = "musl"))] use std::mem; +use sys::signal::SigSet; #[derive(Clone, Copy)] pub struct UContext { @@ -26,4 +27,12 @@ impl UContext { }; 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) } + } } -- cgit v1.2.3 From 19811a5832c4c0c4afc8c431d8671899b724fd8b Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Wed, 29 Jun 2016 21:08:29 +0200 Subject: musl target needs std::mem now --- src/ucontext.rs | 1 - 1 file changed, 1 deletion(-) (limited to 'src/ucontext.rs') diff --git a/src/ucontext.rs b/src/ucontext.rs index 89c8cae2..6886dd41 100644 --- a/src/ucontext.rs +++ b/src/ucontext.rs @@ -1,7 +1,6 @@ use libc; #[cfg(not(target_env = "musl"))] use {Errno, Result}; -#[cfg(not(target_env = "musl"))] use std::mem; use sys::signal::SigSet; -- cgit v1.2.3