added support for GNU/Hurd

This commit is contained in:
Samuel Thibault
2023-09-19 12:41:30 +02:00
parent ae9c330629
commit dcea7709f2
36 changed files with 626 additions and 35 deletions

View File

@@ -216,7 +216,8 @@ impl Thread {
target_os = "l4re",
target_os = "emscripten",
target_os = "redox",
target_os = "vxworks"
target_os = "vxworks",
target_os = "hurd",
))]
pub fn set_name(_name: &CStr) {
// Newlib, Emscripten, and VxWorks have no way to set a thread name.
@@ -309,6 +310,7 @@ pub fn available_parallelism() -> io::Result<NonZeroUsize> {
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "hurd",
target_os = "ios",
target_os = "tvos",
target_os = "linux",
@@ -690,6 +692,7 @@ mod cgroups {
#[cfg(all(
not(target_os = "linux"),
not(target_os = "freebsd"),
not(target_os = "hurd"),
not(target_os = "macos"),
not(target_os = "netbsd"),
not(target_os = "openbsd"),
@@ -710,6 +713,7 @@ pub mod guard {
#[cfg(any(
target_os = "linux",
target_os = "freebsd",
target_os = "hurd",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
@@ -766,6 +770,7 @@ pub mod guard {
#[cfg(any(
target_os = "android",
target_os = "freebsd",
target_os = "hurd",
target_os = "linux",
target_os = "netbsd",
target_os = "l4re"
@@ -903,6 +908,7 @@ pub mod guard {
#[cfg(any(
target_os = "android",
target_os = "freebsd",
target_os = "hurd",
target_os = "linux",
target_os = "netbsd",
target_os = "l4re"
@@ -934,7 +940,7 @@ pub mod guard {
assert_eq!(libc::pthread_attr_getstack(&attr, &mut stackptr, &mut size), 0);
let stackaddr = stackptr.addr();
ret = if cfg!(any(target_os = "freebsd", target_os = "netbsd")) {
ret = if cfg!(any(target_os = "freebsd", target_os = "netbsd", target_os = "hurd")) {
Some(stackaddr - guardsize..stackaddr)
} else if cfg!(all(target_os = "linux", target_env = "musl")) {
Some(stackaddr - guardsize..stackaddr)