Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3227,8 +3227,6 @@ fn test_freebsd(target: &str) {

fn test_emscripten(target: &str) {
assert!(target.contains("emscripten"));
#[expect(unused_variables)] // remove once we need a version check
let emscripten = VERSIONS.emscripten.unwrap();

let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None); // FIXME(emscripten): ??
Expand Down Expand Up @@ -3395,6 +3393,9 @@ fn test_emscripten(target: &str) {
// https://github.com/emscripten-core/emscripten/blob/3.1.68/tools/system_libs.py#L1100
"execv" | "execve" | "execvp" | "execvpe" | "fexecve" | "wait4" => true,

// Emscripten's `pthread_kill` used to only be linkable when building with `-pthread`
"pthread_kill" if matches!(VERSIONS.emscripten, Some(v) if v < (6, 0)) => true,

Comment thread
guybedford marked this conversation as resolved.
_ => false,
}
});
Expand Down
14 changes: 12 additions & 2 deletions src/new/common/posix/pthread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ extern "C" {

// FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required
// in pthread.
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux"
))]
pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;

#[cfg(all(target_os = "linux", not(target_env = "ohos")))]
Expand Down Expand Up @@ -298,7 +303,12 @@ extern "C" {

// FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required
// in pthread.
#[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
#[cfg(any(
target_os = "android",
target_os = "emscripten",
target_os = "l4re",
target_os = "linux"
))]
pub fn pthread_sigmask(
how: c_int,
set: *const crate::sigset_t,
Expand Down
2 changes: 2 additions & 0 deletions src/new/emscripten/pthread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ pub use crate::new::common::posix::pthread::{
pthread_condattr_setclock,
pthread_condattr_setpshared,
pthread_create,
pthread_kill,
pthread_mutexattr_setpshared,
pthread_rwlockattr_getpshared,
pthread_rwlockattr_setpshared,
pthread_sigmask,
};
8 changes: 8 additions & 0 deletions src/unix/linux_like/emscripten/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,6 +1458,14 @@ extern "C" {
buflen: size_t,
result: *mut *mut crate::group,
) -> c_int;
pub fn sigwait(set: *const crate::sigset_t, sig: *mut c_int) -> c_int;
pub fn sigwaitinfo(set: *const crate::sigset_t, info: *mut crate::siginfo_t) -> c_int;
pub fn sigtimedwait(
set: *const crate::sigset_t,
info: *mut crate::siginfo_t,
timeout: *const crate::timespec,
) -> c_int;
pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
}

// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
Expand Down