illumos support (#2838)

* disable mimalloc on illumos, in part because it immediately segfaults,
  but also because we prefer libumem and link it into all Rust binaries

* switch from fs2 (unmaintained crate) to fs4 which provides the same
  interface and has wider platform support
This commit is contained in:
Joshua M. Clulow 2024-06-14 22:20:11 -07:00 committed by GitHub
parent 9c4e8bb90a
commit e591b5f2cc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 28 additions and 16 deletions

12
Cargo.lock generated
View file

@ -1169,7 +1169,7 @@ dependencies = [
"clap",
"clap_complete",
"dhat",
"fs2",
"fs4",
"futures",
"kanidm_build_profiles",
"kanidm_lib_file_permissions",
@ -1715,13 +1715,13 @@ dependencies = [
]
[[package]]
name = "fs2"
version = "0.4.3"
name = "fs4"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"
checksum = "f7e180ac76c23b45e767bd7ae9579bc0bb458618c4bc71835926e098e61d15f8"
dependencies = [
"libc",
"winapi",
"rustix",
"windows-sys 0.52.0",
]
[[package]]

View file

@ -173,7 +173,7 @@ dhat = "0.3.3"
dyn-clone = "^1.0.17"
fernet = "^0.2.1"
filetime = "^0.2.23"
fs2 = "^0.4.3"
fs4 = "^0.8.3"
futures = "^0.3.30"
futures-concurrency = "^3.1.0"
futures-util = { version = "^0.3.30", features = ["sink"] }

View file

@ -6,6 +6,9 @@ use std::os::linux::fs::MetadataExt;
#[cfg(target_os = "macos")]
use std::os::macos::fs::MetadataExt;
#[cfg(target_os = "illumos")]
use std::os::illumos::fs::MetadataExt;
use kanidm_utils_users::{get_current_gid, get_current_uid};
use std::fmt;

View file

@ -28,12 +28,11 @@ kanidm_proto = { workspace = true }
kanidmd_core = { workspace = true }
kanidm_lib_file_permissions = { workspace = true }
sketching = { workspace = true }
fs2 = { workspace = true }
fs4 = { workspace = true }
futures = { workspace = true }
dhat = { workspace = true, optional = true }
clap = { workspace = true, features = ["env"] }
mimalloc = { workspace = true }
reqwest = { workspace = true }
serde = { workspace = true, features = ["derive"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "signal"] }
@ -56,6 +55,9 @@ whoami = { workspace = true }
[target.'cfg(not(target_family = "windows"))'.dependencies]
kanidm_utils_users = { workspace = true }
[target.'cfg(not(target_os = "illumos"))'.dependencies]
mimalloc = { workspace = true }
[build-dependencies]
serde = { workspace = true, features = ["derive"] }
clap = { workspace = true, features = ["derive"] }

View file

@ -10,7 +10,7 @@
#![deny(clippy::needless_pass_by_value)]
#![deny(clippy::trivially_copy_pass_by_ref)]
#[cfg(not(feature = "dhat-heap"))]
#[cfg(not(any(feature = "dhat-heap", target_os = "illumos")))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
@ -20,7 +20,7 @@ static ALLOC: dhat::Alloc = dhat::Alloc;
use std::fs::{metadata, File};
// This works on both unix and windows.
use fs2::FileExt;
use fs4::FileExt;
use kanidm_proto::messages::ConsoleOutputMode;
use sketching::otel::TracingPipelineGuard;
use sketching::LogLevel;

View file

@ -109,9 +109,11 @@ compact_jwt = { workspace = true, features = ["openssl", "hsm-crypto", "unsafe_r
criterion = { workspace = true, features = ["html_reports"] }
futures = { workspace = true }
kanidmd_lib_macros = { workspace = true }
mimalloc = { workspace = true }
webauthn-authenticator-rs = { workspace = true }
[target.'cfg(not(target_os = "illumos"))'.dev-dependencies]
mimalloc = { workspace = true }
[build-dependencies]
hashbrown = { workspace = true }
kanidm_build_profiles = { workspace = true }

View file

@ -21,7 +21,7 @@
#![deny(clippy::manual_let_else)]
#![allow(clippy::unreachable)]
#[cfg(all(test, not(feature = "dhat-heap")))]
#[cfg(all(test, not(any(feature = "dhat-heap", target_os = "illumos"))))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

View file

@ -28,7 +28,6 @@ hashbrown = { workspace = true }
kanidm_client = { workspace = true }
kanidm_proto = { workspace = true }
mathru = { workspace = true }
mimalloc = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
serde = { workspace = true, features = ["derive"] }
@ -39,6 +38,9 @@ tracing = { workspace = true }
tracing-subscriber = { workspace = true }
uuid = { workspace = true, features = ["serde", "v4" ] }
[target.'cfg(not(any(target_family = "windows", target_os = "illumos")))'.dependencies]
mimalloc = { workspace = true }
[build-dependencies]
kanidm_build_profiles = { workspace = true }

View file

@ -6,7 +6,7 @@
#![deny(clippy::needless_pass_by_value)]
#![deny(clippy::trivially_copy_pass_by_ref)]
#[cfg(not(target_family = "windows"))]
#[cfg(not(any(target_family = "windows", target_os = "illumos")))]
#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;

View file

@ -67,7 +67,6 @@ kanidm_proto = { workspace = true }
kanidm-hsm-crypto = { workspace = true }
kanidm_lib_crypto = { workspace = true }
kanidm_lib_file_permissions = { workspace = true }
mimalloc = { workspace = true }
notify-debouncer-full = { workspace = true }
rpassword = { workspace = true }
rusqlite = { workspace = true }
@ -98,6 +97,9 @@ prctl.workspace = true
[target.'cfg(not(target_family = "windows"))'.dependencies]
kanidm_utils_users = { workspace = true }
[target.'cfg(not(target_os = "illumos"))'.dependencies]
mimalloc = { workspace = true }
[dev-dependencies]
kanidmd_core = { workspace = true }
kanidmd_testkit = { workspace = true }

View file

@ -53,6 +53,7 @@ use kanidm_hsm_crypto::{soft::SoftTpm, AuthValue, BoxedDynTpm, Tpm};
use notify_debouncer_full::{new_debouncer, notify::RecursiveMode, notify::Watcher};
#[cfg(not(target_os = "illumos"))]
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;