feat: Pass initial cwd fd to init
This commit is contained in:
committed by
Jeremy Soller
parent
75b9f07a92
commit
ac3d816672
Generated
+3
-3
@@ -891,7 +891,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "generic-rt"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#53cc0e5aed5b586dccdaad51032b15c0b3bf960e"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#27b4c3ed907f8037145616e653c36b276d8ab7d0"
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
@@ -1803,7 +1803,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "redox-ioctl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#53cc0e5aed5b586dccdaad51032b15c0b3bf960e"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#27b4c3ed907f8037145616e653c36b276d8ab7d0"
|
||||
dependencies = [
|
||||
"drm-sys",
|
||||
"redox_syscall 0.7.1",
|
||||
@@ -1829,7 +1829,7 @@ checksum = "436d45c2b6a5b159d43da708e62b25be3a4a3d5550d654b72216ade4c4bfd717"
|
||||
[[package]]
|
||||
name = "redox-rt"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#53cc0e5aed5b586dccdaad51032b15c0b3bf960e"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#27b4c3ed907f8037145616e653c36b276d8ab7d0"
|
||||
dependencies = [
|
||||
"bitflags 2.11.0",
|
||||
"generic-rt",
|
||||
|
||||
Generated
+2
-2
@@ -41,7 +41,7 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
||||
[[package]]
|
||||
name = "generic-rt"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#df3229958e534a8bfe7835b3c4fae6450daeea55"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#d0593f54804639117ba5e8d554dd118f634917d3"
|
||||
|
||||
[[package]]
|
||||
name = "goblin"
|
||||
@@ -150,7 +150,7 @@ checksum = "436d45c2b6a5b159d43da708e62b25be3a4a3d5550d654b72216ade4c4bfd717"
|
||||
[[package]]
|
||||
name = "redox-rt"
|
||||
version = "0.1.0"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#df3229958e534a8bfe7835b3c4fae6450daeea55"
|
||||
source = "git+https://gitlab.redox-os.org/redox-os/relibc.git#d0593f54804639117ba5e8d554dd118f634917d3"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"generic-rt",
|
||||
|
||||
@@ -7,7 +7,7 @@ use hashbrown::HashMap;
|
||||
|
||||
use syscall::CallFlags;
|
||||
use syscall::data::{GlobalSchemes, KernelSchemeInfo};
|
||||
use syscall::flag::{O_CLOEXEC, O_RDONLY};
|
||||
use syscall::flag::{O_CLOEXEC, O_RDONLY, O_STAT};
|
||||
use syscall::{EINTR, Error};
|
||||
|
||||
use redox_rt::proc::*;
|
||||
@@ -175,6 +175,10 @@ pub fn main() -> ! {
|
||||
// from this point, this_thr_fd is no longer valid
|
||||
|
||||
const CWD: &[u8] = b"/scheme/initfs";
|
||||
let cwd_fd =
|
||||
FdGuard::new(syscall::openat(initfs_fd, "", O_STAT, 0).expect("failed to open cwd fd"))
|
||||
.to_upper()
|
||||
.unwrap();
|
||||
let extrainfo = ExtraInfo {
|
||||
cwd: Some(CWD),
|
||||
sigprocmask: 0,
|
||||
@@ -183,6 +187,7 @@ pub fn main() -> ! {
|
||||
thr_fd: init_thr_fd.as_raw_fd(),
|
||||
proc_fd: init_proc_fd.as_raw_fd(),
|
||||
ns_fd: Some(initns_fd),
|
||||
cwd_fd: Some(cwd_fd.as_raw_fd()),
|
||||
};
|
||||
|
||||
let path = "/bin/init";
|
||||
|
||||
Reference in New Issue
Block a user