Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions litebox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ringbuf = { version = "0.4.8", default-features = false, features = ["alloc"] }
buddy_system_allocator = { version = "0.11.0", default-features = false, features = ["use_spin"] }
# Depend on (currently unreleased) slabmalloc `main`, which contains some fixes on top of `0.11.0`
slabmalloc = { git = "https://github.com/gz/rust-slabmalloc.git", rev = "19480b2e82704210abafe575fb9699184c1be110" }
litebox_util_log = { version = "0.1.0", path = "../litebox_util_log" }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.60.2", features = [
Expand Down
6 changes: 5 additions & 1 deletion litebox/src/litebox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ impl<Platform: RawSyncPrimitivesProvider> LiteBox<Platform> {
#[cfg(feature = "lock_tracing")]
crate::sync::lock_tracing::LockTracker::init(platform);

let descriptors = RwLock::new(Descriptors::new_from_litebox_creation());

litebox_util_log::trace!("LiteBox instance initialized");

Self {
x: Arc::new(LiteBoxX {
platform,
descriptors: RwLock::new(Descriptors::new_from_litebox_creation()),
descriptors,
}),
}
}
Expand Down
2 changes: 2 additions & 0 deletions litebox_runner_linux_userland/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ litebox_platform_multiplex = { version = "0.1.0", path = "../litebox_platform_mu
litebox_shim_linux = { version = "0.1.0", path = "../litebox_shim_linux" }
litebox_syscall_rewriter = { version = "0.1.0", path = "../litebox_syscall_rewriter" }
memmap2 = "0.9.8"
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
litebox_util_log = { version = "0.1.0", path = "../litebox_util_log", features = ["backend_tracing"] }

[dev-dependencies]
sha2 = "0.10"
Expand Down
14 changes: 14 additions & 0 deletions litebox_runner_linux_userland/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ use std::path::{Path, PathBuf};
extern crate alloc;

/// Run Linux programs with LiteBox on unmodified Linux
///
/// Detailed logging can be controlled via the `LITEBOX_LOG` environment variable. For example:
/// - `LITEBOX_LOG=debug` to show debug and higher level logs
/// - `LITEBOX_LOG=litebox=debug,litebox::fs=trace` for multiple filters at different levels
#[derive(Parser, Debug)]
#[allow(clippy::struct_excessive_bools)]
pub struct CliArgs {
Expand Down Expand Up @@ -124,6 +128,16 @@ fn mmapped_file(path: impl AsRef<Path>) -> Result<MmappedFile> {
/// panic. If it does actually panic, then ping the authors of LiteBox, and likely a better error
/// message could be thrown instead.
pub fn run(cli_args: CliArgs) -> Result<()> {
tracing_subscriber::fmt()
.with_timer(tracing_subscriber::fmt::time::uptime())
.with_level(true)
.with_env_filter(
tracing_subscriber::EnvFilter::builder()
.with_env_var("LITEBOX_LOG")
.from_env_lossy(),
)
.init();

if !cli_args.insert_files.is_empty() {
unimplemented!(
"this should (hopefully soon) have a nicer interface to support loading in files"
Expand Down
Loading