feat(runtime): sys_info.rs - Use KERN_OSRELEASE on {Free,Open}BSD (#19849)

os_release() can use the same API as apple on FreeBSD and OpenBSD. Ports
for both systems contain a patch to that effect.

See:

https://github.com/freebsd/freebsd-ports/blob/main/www/deno/files/patch-runtime_ops_os_sys__info.rs

https://cvsweb.openbsd.org/ports/lang/deno/patches/patch-runtime_ops_os_sys_info_rs?rev=1.2
This commit is contained in:
VlkrS 2023-07-22 05:50:57 +02:00 committed by GitHub
parent 5a3dbe1a62
commit 60d3c4c1ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,7 +57,11 @@ pub fn os_release() -> String {
_ => String::from(""),
}
}
#[cfg(target_vendor = "apple")]
#[cfg(any(
target_vendor = "apple",
target_os = "freebsd",
target_os = "openbsd"
))]
{
let mut s = [0u8; 256];
let mut mib = [libc::CTL_KERN, libc::KERN_OSRELEASE];