fix(os,termio): FreeBSD support, dev-profile resource precedence, docs

Final fix pass per the stopping criterion (docs/rewrite/PLAN.md),
resolving the remaining RV18 build/behaviour items (final-Z21.md):
- termio errno access uses the per-target libc accessor (__error on
  FreeBSD/DragonFly/Apple, __errno on OpenBSD/NetBSD/Android) instead of
  __errno_location everywhere, unblocking non-Linux BSD builds.
- FreeBSD resource discovery follows Zig (site-terminfo, local/share).
- Zig's Debug-only resource precedence (and the dev workspace-resources
  fallback) key off a ghostty_debug_build cfg set from PROFILE=="debug"
  instead of debug_assertions, so release builds with assertions honor
  GHOSTTY_RESOURCES_DIR first like Zig ReleaseSafe.
- KNOWN_DIFFERENCES.md lists the remaining P3 differences deliberately
  left unfixed (theme-preview editing details, a cleanup timeout edge
  case) and what cannot be verified on this machine.
- DEVIANT_FIXES.md registers the PTY-hangup output drain (35), the
  canvas BGRA conversion (36) and the dev resources fallback.

Test Plan:
- cargo test --workspace --no-fail-fast (exit 0)
- cargo check --target x86_64-unknown-freebsd -p ghostty-os
This commit is contained in:
ddidderr committed 2026-10-12 16:53:27 +02:00
1 parent c126ae873d
commit 4fa55855e8
6 files changed
+83 -7

No files matched your search

+20 -2
View File
@@ -546,20 +546,38 @@ fn execvpe(prep: &Prepared, argv: &[*const c_char], envp: &[*const c_char]) -> E
})
}
#[cfg(not(target_vendor = "apple"))]
#[cfg(not(any(
target_vendor = "apple",
target_os = "freebsd",
target_os = "dragonfly",
target_os = "openbsd",
target_os = "netbsd",
target_os = "android"
)))]
#[allow(unsafe_code)]
fn errno_now() -> i32 {
// SAFETY: __errno_location returns a valid thread-local pointer.
unsafe { *libc::__errno_location() }
}
#[cfg(target_vendor = "apple")]
#[cfg(any(
target_vendor = "apple",
target_os = "freebsd",
target_os = "dragonfly"
))]
#[allow(unsafe_code)]
fn errno_now() -> i32 {
// SAFETY: __error returns a valid thread-local pointer.
unsafe { *libc::__error() }
}
#[cfg(any(target_os = "openbsd", target_os = "netbsd", target_os = "android"))]
#[allow(unsafe_code)]
fn errno_now() -> i32 {
// SAFETY: __errno returns a valid thread-local pointer.
unsafe { *libc::__errno() }
}
fn write_stderr(msg: &[u8]) {
// Best effort, no allocation.
let _ = rustix::io::write(borrow_stderr(), msg);