mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
openbsd: fix build
This commit is contained in:
parent
ac7718c226
commit
3849ee5d4c
5 changed files with 29 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ default-members = [ "yazi-fm", "yazi-cli" ]
|
|||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = true
|
||||
lto = false
|
||||
panic = "abort"
|
||||
strip = true
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ signal-hook-tokio = { version = "0.3.1", features = [ "futures-v0_3" ] }
|
|||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
crossterm = { workspace = true, features = [ "use-dev-tty", "libc" ] }
|
||||
|
||||
[target.'cfg(all(not(target_os = "macos"), not(target_os = "windows")))'.dependencies]
|
||||
[target.'cfg(all(not(target_os = "macos"), not(target_os = "windows"), not(target_os = "openbsd")))'.dependencies]
|
||||
tikv-jemallocator = "0.6.1"
|
||||
|
||||
[[bin]]
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#[cfg(all(not(target_os = "macos"), not(target_os = "windows")))]
|
||||
#[cfg(all(not(target_os = "macos"), not(target_os = "windows"), not(target_os = "openbsd")))]
|
||||
#[global_allocator]
|
||||
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,6 @@ fn casefold_impl(path: PathBuf) -> io::Result<PathBuf> {
|
|||
#[cfg(any(
|
||||
target_os = "macos",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "freebsd"
|
||||
))]
|
||||
fn final_path(path: &Path) -> io::Result<PathBuf> {
|
||||
|
|
@ -123,6 +122,11 @@ fn final_path(path: &Path) -> io::Result<PathBuf> {
|
|||
Ok(OsString::from_vec(cstr.to_bytes().to_vec()).into())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
fn final_path(path: &Path) -> io::Result<PathBuf> {
|
||||
std::fs::canonicalize(path)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
fn final_path(path: &Path) -> io::Result<PathBuf> {
|
||||
use std::{ffi::OsString, fs::File, os::windows::{ffi::OsStringExt, fs::OpenOptionsExt, io::AsRawHandle}};
|
||||
|
|
|
|||
|
|
@ -38,7 +38,12 @@ impl Command {
|
|||
lua.globals().raw_set("Command", command)
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(any(
|
||||
target_os = "macos",
|
||||
target_os = "netbsd",
|
||||
target_os = "linux",
|
||||
target_os = "freebsd"
|
||||
))]
|
||||
fn spawn(&mut self) -> io::Result<Child> {
|
||||
if let Some(max) = self.memory {
|
||||
unsafe {
|
||||
|
|
@ -51,6 +56,21 @@ impl Command {
|
|||
}
|
||||
self.inner.spawn().map(Child::new)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "openbsd")]
|
||||
fn spawn(&mut self) -> io::Result<Child> {
|
||||
if let Some(max) = self.memory {
|
||||
unsafe {
|
||||
self.inner.pre_exec(move || {
|
||||
let rlp = libc::rlimit { rlim_cur: max as _, rlim_max: max as _ };
|
||||
#[cfg(target_os = "openbsd")]
|
||||
libc::setrlimit(libc::RLIMIT_DATA, &rlp);
|
||||
Ok(())
|
||||
});
|
||||
}
|
||||
}
|
||||
self.inner.spawn().map(Child::new)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn spawn(&mut self) -> io::Result<Child> {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue