Replace pipe2 with pipe scheme.

This commit is contained in:
4lDO2
2023-06-27 16:37:59 +02:00
parent 1effea3ce8
commit c6c46803d2
2 changed files with 5 additions and 3 deletions
+4 -3
View File
@@ -71,9 +71,10 @@ pub fn main() -> ! {
}
unsafe fn spawn_initfs(initfs_start: usize, initfs_length: usize) {
let mut buf = [0; 2];
syscall::pipe2(&mut buf, syscall::O_CLOEXEC).expect("failed to open sync pipe");
let [read, write] = buf;
let read = syscall::open("pipe:", syscall::O_CLOEXEC).expect("failed to open sync read pipe");
// The write pipe will not inherit O_CLOEXEC, but is closed by the daemon later.
let write = syscall::dup(read, b"write").expect("failed to open sync write pipe");
match redox_exec::fork_impl() {
Err(err) => {
+1
View File
@@ -258,6 +258,7 @@ pub fn run(bytes: &'static [u8], sync_pipe: usize) -> ! {
.expect("failed to open initfs scheme socket");
let _ = syscall::write(sync_pipe, &[0]);
let _ = syscall::close(sync_pipe);
let mut packet = Packet::default();