Skip to content

Commit dfd7be6

Browse files
chore: removed utility cage 0 (#466)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 64c1eef commit dfd7be6

File tree

1 file changed

+2
-55
lines changed

1 file changed

+2
-55
lines changed

src/rawposix/src/sys_calls.rs

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,34 +1015,12 @@ pub fn rawposix_start(verbosity: isize) {
10151015

10161016
fdtables::register_close_handlers(FDKIND_KERNEL, fdtables::NULL_FUNC, kernel_close);
10171017

1018-
let utilcage = Cage {
1019-
cageid: 0,
1020-
cwd: RwLock::new(Arc::new(PathBuf::from("/"))),
1021-
parent: 0,
1022-
rev_shm: Mutex::new(Vec::new()),
1023-
main_threadid: RwLock::new(0),
1024-
interval_timer: IntervalTimer::new(0),
1025-
epoch_handler: DashMap::new(),
1026-
pending_signals: RwLock::new(vec![]),
1027-
signalhandler: DashMap::new(),
1028-
sigset: AtomicU64::new(0),
1029-
zombies: RwLock::new(vec![]),
1030-
child_num: AtomicU64::new(0),
1031-
vmmap: RwLock::new(Vmmap::new()),
1032-
};
1033-
1034-
add_cage(
1035-
0, // cageid
1036-
utilcage,
1037-
);
1038-
fdtables::init_empty_cage(0);
1039-
// Set the first 3 fd to STDIN / STDOUT / STDERR
1018+
// Set up standard file descriptors for the init cage
10401019
// TODO:
10411020
// Replace the hardcoded values with variables (possibly by adding a LIND-specific constants file)
10421021
let dev_null = CString::new("/home/lind-wasm/src/RawPOSIX/tmp/dev/null").unwrap();
10431022

1044-
// Make sure that the standard file descriptor (stdin, stdout, stderr) is always valid, even if they
1045-
// are closed before.
1023+
// Make sure that the standard file descriptors (stdin, stdout, stderr) are always valid
10461024
// Standard input (fd = 0) is redirected to /dev/null
10471025
// Standard output (fd = 1) is redirected to /dev/null
10481026
// Standard error (fd = 2) is set to copy of stdout
@@ -1052,37 +1030,6 @@ pub fn rawposix_start(verbosity: isize) {
10521030
libc::dup(1);
10531031
}
10541032

1055-
// STDIN
1056-
fdtables::get_specific_virtual_fd(
1057-
0,
1058-
STDIN_FILENO as u64,
1059-
FDKIND_KERNEL,
1060-
STDIN_FILENO as u64,
1061-
false,
1062-
0,
1063-
)
1064-
.unwrap();
1065-
// STDOUT
1066-
fdtables::get_specific_virtual_fd(
1067-
0,
1068-
STDOUT_FILENO as u64,
1069-
FDKIND_KERNEL,
1070-
STDOUT_FILENO as u64,
1071-
false,
1072-
0,
1073-
)
1074-
.unwrap();
1075-
// STDERR
1076-
fdtables::get_specific_virtual_fd(
1077-
0,
1078-
STDERR_FILENO as u64,
1079-
FDKIND_KERNEL,
1080-
STDERR_FILENO as u64,
1081-
false,
1082-
0,
1083-
)
1084-
.unwrap();
1085-
10861033
//init cage is its own parent
10871034
let initcage = Cage {
10881035
cageid: 1,

0 commit comments

Comments
 (0)