pub fn sys_channel_write_etc(
        &self,
        handle: HandleValue,
        options: u32,
        user_bytes: UserInPtr<u8>,
        num_bytes: u32,
        mut user_handles: UserInOutPtr<HandleDisposition>,
        num_handles: u32,
    ) -> ZxResult {
        info!(
            "channel.write_etc: handle={:#x}, options={:#x}, user_bytes={:#x?}, num_bytes={:#x}, user_handles={:#x?}, num_handles={:#x}",
            handle, options, user_bytes, num_bytes, user_handles, num_handles
        );
        let proc = self.thread.proc();
        let data = user_bytes.read_array(num_bytes as usize)?;
        let mut dispositions = user_handles.read_array(num_handles as usize)?;
        let mut handles: Vec<Handle> = Vec::new();
        let mut ret: ZxResult = Ok(());
        for disposition in dispositions.iter_mut() {
            if let Ok((object, src_rights)) = proc.get_dyn_object_and_rights(disposition.handle) {
                match handle_check(disposition, &object, src_rights, handle) {
                    Err(e) => {
                        disposition.result = e as _;
                        if ret.is_ok() {
                            ret = Err(e);
                        }
                    }
                    Ok(()) => (),
                };
                let new_rights = if disposition.rights != Rights::SAME_RIGHTS.bits() {
                    Rights::from_bits(disposition.rights).unwrap()
                } else {
                    src_rights
                };
                let new_handle = Handle::new(object, new_rights);
                if disposition.op != ZX_HANDLE_OP_DUP {
                    proc.remove_handle(disposition.handle).unwrap();
                }
                handles.push(new_handle);
            } else {
                disposition.result = ZxError::BAD_HANDLE as _;
                ret = Err(ZxError::BAD_HANDLE);
            }
        }
        user_handles.write_array(&dispositions)?;
        if options != 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        if num_handles > 64 || num_bytes > 65536 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        ret?;
        let channel = proc.get_object_with_rights::<Channel>(handle, Rights::WRITE)?;
        channel.write(MessagePacket { data, handles })?;
        Ok(())
    }
/// Write a message to a channel.  
Write a message to a channel.
Write a message to a channel .
pub fn sys_channel_write_etc(
        &self,
        handle: HandleValue,
        options: u32,
        user_bytes: UserInPtr<u8>,
        num_bytes: u32,
        mut user_handles: UserInOutPtr<HandleDisposition>,
        num_handles: u32,
    ) -> ZxResult {
        info!(
            "channel.write_etc: handle={:#x}, options={:#x}, user_bytes={:#x?}, num_bytes={:#x}, user_handles={:#x?}, num_handles={:#x}",
            handle, options, user_bytes, num_bytes, user_handles, num_handles
        );
        let proc = self.thread.proc();
        let data = user_bytes.read_array(num_bytes as usize)?;
        let mut dispositions = user_handles.read_array(num_handles as usize)?;
        let mut handles: Vec<Handle> = Vec::new();
        let mut ret: ZxResult = Ok(());
        for disposition in dispositions.iter_mut() {
            if let Ok((object, src_rights)) = proc.get_dyn_object_and_rights(disposition.handle) {
                match handle_check(disposition, &object, src_rights, handle) {
                    Err(e) => {
                        disposition.result = e as _;
                        if ret.is_ok() {
                            ret = Err(e);
                        }
                    }
                    Ok(()) => (),
                };
                let new_rights = if disposition.rights != Rights::SAME_RIGHTS.bits() {
                    Rights::from_bits(disposition.rights).unwrap()
                } else {
                    src_rights
                };
                let new_handle = Handle::new(object, new_rights);
                if disposition.op != ZX_HANDLE_OP_DUP {
                    proc.remove_handle(disposition.handle).unwrap();
                }
                handles.push(new_handle);
            } else {
                disposition.result = ZxError::BAD_HANDLE as _;
                ret = Err(ZxError::BAD_HANDLE);
            }
        }
        user_handles.write_array(&dispositions)?;
        if options != 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        if num_handles > 64 || num_bytes > 65536 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        ret?;
        let channel = proc.get_object_with_rights::<Channel>(handle, Rights::WRITE)?;
        channel.write(MessagePacket { data, handles })?;
        Ok(())
    }
pub fn sys_channel_write_etc ( & self , handle : HandleValue , options : u32 , user_bytes : UserInPtr < u8 > , num_bytes : u32 , mut user_handles : UserInOutPtr < HandleDisposition > , num_handles : u32 , ) -> ZxResult { info ! ( " " handle options user_bytes num_bytes user_handles num_handles ) ; let proc = self . thread . proc ( ) ; let data = user_bytes . read_array ( num_bytes as usize ) ? ; let mut dispositions = user_handles . read_array ( num_handles as usize ) ? ; let mut handles : Vec < Handle > = Vec :: new ( ) ; let mut ret : ZxResult = Ok ( ( ) ) ; for disposition in dispositions . iter_mut ( ) { if let Ok ( ( object , src_rights ) ) = proc . get_dyn_object_and_rights ( disposition . handle ) { match handle_check ( disposition , & object , src_rights , handle ) { Err ( e ) => { disposition . result = e as _ ; if ret . is_ok ( ) { ret = Err ( e ) ; } } Ok ( ( ) ) => ( ) , } ; let new_rights = if disposition . rights != Rights :: SAME_RIGHTS . bits ( ) { Rights :: from_bits ( disposition . rights ) . unwrap ( ) } else { src_rights } ; let new_handle = Handle :: new ( object , new_rights ) ; if disposition . op != ZX_HANDLE_OP_DUP { proc . remove_handle ( disposition . handle ) . unwrap ( ) ; } handles . push ( new_handle ) ; } else { disposition . result = ZxError :: BAD_HANDLE as _ ; ret = Err ( ZxError :: BAD_HANDLE ) ; } } user_handles . write_array ( & dispositions ) ? ; if options != 0 { return Err ( ZxError :: INVALID_ARGS ) ; } if num_handles > 64 || num_bytes > 65536 { return Err ( ZxError :: OUT_OF_RANGE ) ; } ret ? ; let channel = proc . get_object_with_rights :: < Channel > ( handle , Rights :: WRITE ) ? ; channel . write ( MessagePacket { data , handles } ) ? ; Ok ( ( ) ) }
Write a message to a channel.
Write a message to a channel .
&self
handle
HandleValue
options
u32
user_bytes
UserInPtr<u8>
num_bytes
u32
user_handles
UserInOutPtr<HandleDisposition>
num_handles
u32
&self
handle
HandleValue
options
u32
user_bytes
UserInPtr<u8>
num_bytes
u32
user_handles
UserInOutPtr<HandleDisposition>
num_handles
u32