From a8aaadfd77362fefa534c76d29a17f3cad5bddfa Mon Sep 17 00:00:00 2001 From: Rain Date: Tue, 3 Dec 2024 21:48:09 +0000 Subject: [PATCH] [solaris/illumos] add SIGRTMIN and SIGRTMAX Add these functions, similar to the Linux ones. Also add tests. For illumos, the source code is at [1] and documentation is at [2]. Blame suggests that Solaris also supports the same calls. [1]: https://github.com/illumos/illumos-gate/blame/27ecbff00d8c86a2647d6fe325cacb220d712115/usr/src/uts/common/sys/iso/signal_iso.h#L100-L101 [2]: https://illumos.org/man/3HEAD/signal.h --- libc-test/build.rs | 2 ++ libc-test/semver/solarish.txt | 2 ++ libc-test/test/sigrt.rs | 4 +++- src/unix/solarish/mod.rs | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 1173f665fb569..2927837976f96 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -42,6 +42,8 @@ fn do_cc() { || target.contains("l4re") || target.contains("android") || target.contains("emscripten") + || target.contains("solaris") + || target.contains("illumos") { cc::Build::new().file("src/sigrt.c").compile("sigrt"); } diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index 3e672ebfb3f11..5603201070f39 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -16,6 +16,8 @@ LIO_WAIT LIO_WRITE PIPE_BUF SIGEV_PORT +SIGRTMAX +SIGRTMIN _POSIX_VDISABLE _ST_FSTYPSZ aio_cancel diff --git a/libc-test/test/sigrt.rs b/libc-test/test/sigrt.rs index 25e6ca4457b1b..1f89ce042186b 100644 --- a/libc-test/test/sigrt.rs +++ b/libc-test/test/sigrt.rs @@ -4,7 +4,9 @@ target_os = "linux", target_os = "l4re", target_os = "android", - target_os = "emscripten" + target_os = "emscripten", + target_os = "solaris", + target_os = "illumos", ))] mod t { use libc; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 0b223cd982cfd..70e549a1b5d8c 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2542,6 +2542,14 @@ f! { } safe_f! { + pub fn SIGRTMAX() -> c_int { + unsafe { crate::sysconf(_SC_SIGRT_MAX) as c_int } + } + + pub fn SIGRTMIN() -> c_int { + unsafe { crate::sysconf(_SC_SIGRT_MIN) as c_int } + } + pub {const} fn WIFEXITED(status: c_int) -> bool { (status & 0xFF) == 0 }