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
18 changes: 18 additions & 0 deletions litebox_common_linux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1990,6 +1990,14 @@ pub struct TaskParams {
pub execfn: Option<alloc::string::String>,
}

/// The longest host name or NIS domain name, in bytes, not counting a terminating NUL (Linux's
/// `__NEW_UTS_LEN`).
pub const UTS_NAME_LENGTH: usize = 64;

// Every name Linux accepts fits in LiteBox's host names.
const _: () =
assert!(UTS_NAME_LENGTH <= litebox_broker_protocol::process::MAX_HOST_NAME_SIZE as usize);

#[repr(C)]
#[derive(Clone, FromBytes, IntoBytes)]
pub struct Utsname {
Expand Down Expand Up @@ -3237,6 +3245,14 @@ pub enum SyscallRequest {
Uname {
buf: UserPtrMut<Utsname>,
},
Sethostname {
name: UserPtr<u8>,
len: i32,
},
Setdomainname {
name: UserPtr<u8>,
len: i32,
},
Statfs {
pathname: UserPtr<c_char>,
buf: UserPtrMut<Statfs>,
Expand Down Expand Up @@ -3855,6 +3871,8 @@ impl SyscallRequest {
Sysno::wait4 => sys_req!(Wait4 { pid, wstatus:*, options, rusage:* }),
Sysno::waitid => sys_req!(Waitid { idtype, id, infop:*, options, rusage:* }),
Sysno::uname => sys_req!(Uname { buf:* }),
Sysno::sethostname => sys_req!(Sethostname { name:*, len }),
Sysno::setdomainname => sys_req!(Setdomainname { name:*, len }),
Sysno::statfs => sys_req!(Statfs { pathname:*, buf:* }),
Sysno::fstatfs => sys_req!(Fstatfs { fd, buf:* }),
Sysno::fcntl => {
Expand Down
3 changes: 2 additions & 1 deletion litebox_runner_linux_on_macos_userland/src/test_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use litebox_broker_core::{
stdio::StdioOutputStream,
test_support::{TestBrokerBuilder, TestStdioProvider},
};
use litebox_broker_host::test_support::InProcessBrokerSetup;
use litebox_broker_host::{default_host_names, test_support::InProcessBrokerSetup};
use litebox_broker_local::BrokerLocal;
use litebox_broker_protocol::fs::{FileMode, FileUser};
use litebox_platform_macos_userland::MacosUserland4K;
Expand Down Expand Up @@ -110,6 +110,7 @@ pub(crate) fn setup(
))
.with_random_provider(Arc::new(TestRandomProvider))
.with_file_service(Arc::new(Resolver::<MacosUserland4K, _>::new(fs)))
.with_host_names(default_host_names())
.build()
.map_err(|error| anyhow!("test broker: {error:?}"))?;
let root = broker
Expand Down
3 changes: 2 additions & 1 deletion litebox_runner_linux_userland/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,8 @@ fn spawn_test_broker_with_mode(
&file_roots,
std::sync::Arc::new(CapturingStdioProvider { stdout_tx }),
limits.max_shared_files,
));
))
.with_host_names(litebox_broker_host::default_host_names());
if let Some(vsock) = &vsock {
broker = broker.with_vsock_provider(vsock.provider());
}
Expand Down
Loading
Loading