pub fn sys_pipe2(&self, mut fds: UserOutPtr<[i32; 2]>, flags: usize) -> SysResult {
        info!("pipe2: fds={:?}, flags: {:#x}", fds, flags);

        let proc = self.linux_process();
        let (read, write) = Pipe::create_pair();

        let base_flags =
            OpenFlags::from_bits_truncate(flags) & (OpenFlags::NON_BLOCK | OpenFlags::CLOEXEC);
        let read_fd = proc.add_file(File::new(
            Arc::new(read),
            base_flags | OpenFlags::RDONLY,
            String::from("pipe_r:[]"),
        ))?;

        let write_fd = proc.add_file(File::new(
            Arc::new(write),
            base_flags | OpenFlags::WRONLY,
            String::from("pipe_w:[]"),
        ))?;
        fds.write([read_fd.into(), write_fd.into()])?;

        info!(
            "pipe2: created rfd={:?} wfd={:?} fds={:?}",
            read_fd, write_fd, fds
        );

        Ok(0)
    }
/// Creates a pipe, a unidirectional data channel that can be used for interprocess communication.
Creates a pipe, a unidirectional data channel that can be used for interprocess communication.
Creates a pipe a unidirectional data channel that can be used for interprocess communication .
pub fn sys_pipe2(&self, mut fds: UserOutPtr<[i32; 2]>, flags: usize) -> SysResult {
        info!("pipe2: fds={:?}, flags: {:#x}", fds, flags);
        let proc = self.linux_process();
        let (read, write) = Pipe::create_pair();
        let base_flags =
            OpenFlags::from_bits_truncate(flags) & (OpenFlags::NON_BLOCK | OpenFlags::CLOEXEC);
        let read_fd = proc.add_file(File::new(
            Arc::new(read),
            base_flags | OpenFlags::RDONLY,
            String::from("pipe_r:[]"),
        ))?;
        let write_fd = proc.add_file(File::new(
            Arc::new(write),
            base_flags | OpenFlags::WRONLY,
            String::from("pipe_w:[]"),
        ))?;
        fds.write([read_fd.into(), write_fd.into()])?;
        info!(
            "pipe2: created rfd={:?} wfd={:?} fds={:?}",
            read_fd, write_fd, fds
        );
        Ok(0)
    }
pub fn sys_pipe2 ( & self , mut fds : UserOutPtr < [ i32 ; 2 ] > , flags : usize ) -> SysResult { info ! ( " " fds flags ) ; let proc = self . linux_process ( ) ; let ( read , write ) = Pipe :: create_pair ( ) ; let base_flags = OpenFlags :: from_bits_truncate ( flags ) & ( OpenFlags :: NON_BLOCK | OpenFlags :: CLOEXEC ) ; let read_fd = proc . add_file ( File :: new ( Arc :: new ( read ) , base_flags | OpenFlags :: RDONLY , String :: from ( " " ) , ) ) ? ; let write_fd = proc . add_file ( File :: new ( Arc :: new ( write ) , base_flags | OpenFlags :: WRONLY , String :: from ( " " ) , ) ) ? ; fds . write ( [ read_fd . into ( ) , write_fd . into ( ) ] ) ? ; info ! ( " " read_fd write_fd fds ) ; Ok ( 0 ) }
Creates a pipe, a unidirectional data channel that can be used for interprocess communication.
Creates a pipe a unidirectional data channel that can be used for interprocess communication .
&self
fds
UserOutPtr<[i32; 2]>
flags
usize
&self
fds
UserOutPtr<[i32; 2]>
flags
usize