Adapt to cwd only being in relibc.
This commit is contained in:
Generated
+1
-1
@@ -96,7 +96,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "redox-exec"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#13e58007bcf11e9c0341d066168b90fb981f4cdf"
|
||||
source = "git+https://gitlab.redox-os.org/4lDO2/relibc.git?branch=relibc_cwd#bc8a6d2cc4d2ed4cffdfc1e4797566605c5e54ea"
|
||||
dependencies = [
|
||||
"goblin",
|
||||
"plain",
|
||||
|
||||
+2
-1
@@ -12,7 +12,8 @@ crate-type = ["staticlib"]
|
||||
[dependencies]
|
||||
linked_list_allocator = "0.9"
|
||||
redox-initfs = { git = "https://gitlab.redox-os.org/redox-os/redox-initfs.git", features = ["kernel"], default-features = false }
|
||||
redox-exec = { git = "https://gitlab.redox-os.org/redox-os/relibc.git" }
|
||||
#redox-exec = { git = "https://gitlab.redox-os.org/redox-os/relibc.git" }
|
||||
redox-exec = { git = "https://gitlab.redox-os.org/4lDO2/relibc.git", branch = "relibc_cwd" }
|
||||
redox_syscall = "0.3"
|
||||
|
||||
[profile.release]
|
||||
|
||||
+7
-4
@@ -53,14 +53,19 @@ pub fn main() -> ! {
|
||||
|
||||
spawn_initfs(initfs_offset, initfs_length);
|
||||
}
|
||||
const CWD: &[u8] = b"initfs:";
|
||||
let extrainfo = redox_exec::ExtraInfo {
|
||||
cwd: Some(CWD),
|
||||
};
|
||||
|
||||
let path = "initfs:bin/init";
|
||||
let total_args_envs_size = path.len() + 1 + envs.len() + envs.iter().map(|v| v.len()).sum::<usize>();
|
||||
let total_args_envs_auxvpointee_size = path.len() + 1 + envs.len() + envs.iter().map(|v| v.len()).sum::<usize>() + CWD.len() + 1;
|
||||
|
||||
let image_file = FdGuard::new(syscall::open(path, O_RDONLY).expect("failed to open init"));
|
||||
let open_via_dup = FdGuard::new(syscall::open("thisproc:current/open_via_dup", 0).expect("failed to open open_via_dup"));
|
||||
let memory = FdGuard::new(syscall::open("memory:", 0).expect("failed to open memory"));
|
||||
|
||||
fexec_impl(image_file, open_via_dup, &memory, path.as_bytes(), [path], envs.iter(), total_args_envs_size, None).expect("failed to execute init");
|
||||
fexec_impl(image_file, open_via_dup, &memory, path.as_bytes(), [path], envs.iter(), total_args_envs_auxvpointee_size, &extrainfo, None).expect("failed to execute init");
|
||||
|
||||
unreachable!()
|
||||
}
|
||||
@@ -83,8 +88,6 @@ unsafe fn spawn_initfs(initfs_start: usize, initfs_length: usize) {
|
||||
let _ = syscall::close(write);
|
||||
let _ = syscall::read(read, &mut [0]);
|
||||
|
||||
let _ = syscall::chdir("initfs:");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user