From f967994052b23f81589069838a438fb9d32c785b Mon Sep 17 00:00:00 2001 From: Francis Nixon <13nixonf@gmail.com> Date: Sat, 13 Aug 2022 13:41:50 -0400 Subject: [PATCH] Add pthread_sigqueue. pthread_sigqueue is a gnu libc extension, however I have a use case for it, hence why I'm adding it. --- libc-test/build.rs | 6 ++++++ src/unix/linux_like/linux/gnu/mod.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 3cc2c135f78ca..70060f89b7bbc 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3270,6 +3270,12 @@ fn test_linux(target: &str) { // Needs musl 1.2.3 or later. "pthread_getname_np" if musl => true, + // pthread_sigqueue uses sigval, which was initially declared + // as a struct but should be defined as a union. However due + // to the issues described here: https://github.com/rust-lang/libc/issues/2816 + // it can't be changed from struct. + "pthread_sigqueue" => true, + _ => false, } }); diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 9e8a88a58c04a..88bc935f632b3 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1291,6 +1291,7 @@ extern "C" { attr: *mut ::pthread_rwlockattr_t, val: ::c_int, ) -> ::c_int; + pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int; pub fn mallinfo() -> ::mallinfo; pub fn mallinfo2() -> ::mallinfo2; pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;