From c1982a4c539a08afae9c770e67eb61f8041ad707 Mon Sep 17 00:00:00 2001 From: Philipp Matthias Schaefer Date: Sun, 28 Feb 2016 16:06:45 +0100 Subject: [PATCH] Add sigwait/sigwaitinfo/sigtimedwait. --- src/unix/bsd/freebsdlike/mod.rs | 5 +++++ src/unix/bsd/openbsdlike/netbsd.rs | 6 ++++++ src/unix/mod.rs | 4 ++++ src/unix/notbsd/linux/mod.rs | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index ac4cda7e..dfa33cf1 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -588,6 +588,11 @@ extern { hdtr: *mut ::sf_hdtr, sbytes: *mut ::off_t, flags: ::c_int) -> ::c_int; + pub fn sigtimedwait(set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, + info: *mut siginfo_t) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/openbsdlike/netbsd.rs b/src/unix/bsd/openbsdlike/netbsd.rs index b350f1d7..3640d2ec 100644 --- a/src/unix/bsd/openbsdlike/netbsd.rs +++ b/src/unix/bsd/openbsdlike/netbsd.rs @@ -378,4 +378,10 @@ extern { pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t, stackaddr: *mut *mut ::c_void, stacksize: *mut ::size_t) -> ::c_int; + #[link_name = "__sigtimedwait50"] + pub fn sigtimedwait(set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, + info: *mut siginfo_t) -> ::c_int; } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index dd8351d2..f65efd63 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -509,6 +509,10 @@ extern { #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; + #[cfg_attr(all(target_os = "macos", target_arch ="x86"), + link_name = "sigwait$UNIX2003")] + pub fn sigwait(set: *const sigset_t, + sig: *mut ::c_int) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__utimes50")] pub fn utimes(filename: *const ::c_char, diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 510a33d0..ba7f883a 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -542,6 +542,11 @@ extern { pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int; pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; + pub fn sigtimedwait(set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, + info: *mut siginfo_t) -> ::c_int; } cfg_if! {