Skip to content

Commit 2a766ab

Browse files
committed
Auto merge of #371 - justinlatimer:musl, r=kamalmarhubi
Exclude UContext::get(),set() on musl, not available from libc. It looks like ``libc`` doesn't provide ``libc::getcontext`` or ``libc::setcontext`` when targeting musl, so I've excluded the ``ucontext`` module from being built when targeting musl which allows the module to be built successfully. Thanks!
2 parents a6337fe + e3e92d7 commit 2a766ab

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ucontext.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use libc;
2+
#[cfg(not(target_env = "musl"))]
23
use {Errno, Result};
4+
#[cfg(not(target_env = "musl"))]
35
use std::mem;
46

57
#[derive(Clone, Copy)]
@@ -8,6 +10,7 @@ pub struct UContext {
810
}
911

1012
impl UContext {
13+
#[cfg(not(target_env = "musl"))]
1114
pub fn get() -> Result<UContext> {
1215
let mut context: libc::ucontext_t = unsafe { mem::uninitialized() };
1316
let res = unsafe {
@@ -16,6 +19,7 @@ impl UContext {
1619
Errno::result(res).map(|_| UContext { context: context })
1720
}
1821

22+
#[cfg(not(target_env = "musl"))]
1923
pub fn set(&self) -> Result<()> {
2024
let res = unsafe {
2125
libc::setcontext(&self.context as *const libc::ucontext_t)

0 commit comments

Comments
 (0)