From 019e667ff5881edead94e5fa074ca24dfb9358cb Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Fri, 15 May 2026 11:22:11 +0200 Subject: [PATCH] Add Haiku support --- serial-unix/README.md | 1 + serial-unix/src/error.rs | 6 ++++++ serial/README.md | 1 + 3 files changed, 8 insertions(+) diff --git a/serial-unix/README.md b/serial-unix/README.md index a83f302..fb62ced 100644 --- a/serial-unix/README.md +++ b/serial-unix/README.md @@ -13,6 +13,7 @@ API. The following platforms are confirmed to be compatible: * OS X (x86_64) * FreeBSD (amd64) * OpenBSD (amd64) +* Haiku (amd64) ## Usage diff --git a/serial-unix/src/error.rs b/serial-unix/src/error.rs index 293772d..faad939 100644 --- a/serial-unix/src/error.rs +++ b/serial-unix/src/error.rs @@ -70,6 +70,12 @@ pub fn errno() -> i32 { __errno() } + #[cfg(target_os = "haiku")] + unsafe fn errno_location() -> *const c_int { + extern { fn _errnop() -> *const c_int; } + _errnop() + } + #[cfg(any(target_os = "linux", target_os = "android"))] unsafe fn errno_location() -> *const c_int { extern { fn __errno_location() -> *const c_int; } diff --git a/serial/README.md b/serial/README.md index 6f638da..1effbbd 100644 --- a/serial/README.md +++ b/serial/README.md @@ -15,6 +15,7 @@ termios API. The following platforms are confirmed to be compatible: * FreeBSD (amd64) * OpenBSD (amd64) * Windows (x86_64) +* Haiku (x86_64) ## Usage Add `serial` as a dependency in `Cargo.toml`: