diff --git a/kernel/src/ipc/syscall.rs b/kernel/src/ipc/syscall.rs index 2abcc397d..88245b705 100644 --- a/kernel/src/ipc/syscall.rs +++ b/kernel/src/ipc/syscall.rs @@ -5,7 +5,10 @@ use core::{ use crate::{ arch::asm::current::current_pcb, - filesystem::vfs::{file::{File, FileMode}, fcntl::{FcntlCommand, FD_CLOEXEC}}, + filesystem::vfs::{ + fcntl::{FcntlCommand, FD_CLOEXEC}, + file::{File, FileMode}, + }, include::bindings::bindings::{pid_t, verify_area, NULL}, kwarn, syscall::{Syscall, SystemError}, @@ -47,14 +50,14 @@ impl Syscall { /// /// - `fd`: 用于返回文件描述符的数组 /// - `flags`:设置管道的参数 - pub fn pipe2(fd: &mut [i32],flags:PipeFlag) -> Result { + pub fn pipe2(fd: &mut [i32], flags: PipeFlag) -> Result { let pipe_ptr = LockedPipeInode::new(flags); let read_file = File::new(pipe_ptr.clone(), FileMode::O_RDONLY)?; let write_file = File::new(pipe_ptr.clone(), FileMode::O_WRONLY)?; let read_fd = current_pcb().alloc_fd(read_file, None)?; let write_fd = current_pcb().alloc_fd(write_file, None)?; - if flags.contains(PipeFlag::O_CLOEXEC){ + if flags.contains(PipeFlag::O_CLOEXEC) { Syscall::fcntl(read_fd, FcntlCommand::SetFd, FD_CLOEXEC as i32)?; Syscall::fcntl(write_fd, FcntlCommand::SetFd, FD_CLOEXEC as i32)?; }