pub fn sys_channel_write(
        &self,
        handle_value: HandleValue,
        options: u32,
        user_bytes: UserInPtr<u8>,
        num_bytes: u32,
        user_handles: UserInPtr<HandleValue>,
        num_handles: u32,
    ) -> ZxResult {
        info!(
            "channel.write: handle_value={:#x}, num_bytes={:#x}, num_handles={:#x}",
            handle_value, num_bytes, num_handles,
        );
        if options != 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        if num_bytes > 65536 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        let proc = self.thread.proc();
        let data = user_bytes.read_array(num_bytes as usize)?;
        let handles = user_handles.read_array(num_handles as usize)?;
        let transfer_self = handles.iter().any(|&handle| handle == handle_value);
        let handles = proc.remove_handles(&handles)?;
        if transfer_self {
            return Err(ZxError::NOT_SUPPORTED);
        }
        if handles.len() > 64 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        for handle in handles.iter() {
            if !handle.rights.contains(Rights::TRANSFER) {
                return Err(ZxError::ACCESS_DENIED);
            }
        }
        let channel = proc.get_object_with_rights::<Channel>(handle_value, 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(
        &self,
        handle_value: HandleValue,
        options: u32,
        user_bytes: UserInPtr<u8>,
        num_bytes: u32,
        user_handles: UserInPtr<HandleValue>,
        num_handles: u32,
    ) -> ZxResult {
        info!(
            "channel.write: handle_value={:#x}, num_bytes={:#x}, num_handles={:#x}",
            handle_value, num_bytes, num_handles,
        );
        if options != 0 {
            return Err(ZxError::INVALID_ARGS);
        }
        if num_bytes > 65536 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        let proc = self.thread.proc();
        let data = user_bytes.read_array(num_bytes as usize)?;
        let handles = user_handles.read_array(num_handles as usize)?;
        let transfer_self = handles.iter().any(|&handle| handle == handle_value);
        let handles = proc.remove_handles(&handles)?;
        if transfer_self {
            return Err(ZxError::NOT_SUPPORTED);
        }
        if handles.len() > 64 {
            return Err(ZxError::OUT_OF_RANGE);
        }
        for handle in handles.iter() {
            if !handle.rights.contains(Rights::TRANSFER) {
                return Err(ZxError::ACCESS_DENIED);
            }
        }
        let channel = proc.get_object_with_rights::<Channel>(handle_value, Rights::WRITE)?;
        channel.write(MessagePacket { data, handles })?;
        Ok(())
    }
pub fn sys_channel_write ( & self , handle_value : HandleValue , options : u32 , user_bytes : UserInPtr < u8 > , num_bytes : u32 , user_handles : UserInPtr < HandleValue > , num_handles : u32 , ) -> ZxResult { info ! ( " " handle_value num_bytes num_handles ) ; if options != 0 { return Err ( ZxError :: INVALID_ARGS ) ; } if num_bytes > 65536 { return Err ( ZxError :: OUT_OF_RANGE ) ; } let proc = self . thread . proc ( ) ; let data = user_bytes . read_array ( num_bytes as usize ) ? ; let handles = user_handles . read_array ( num_handles as usize ) ? ; let transfer_self = handles . iter ( ) . any ( | & handle | handle == handle_value ) ; let handles = proc . remove_handles ( & handles ) ? ; if transfer_self { return Err ( ZxError :: NOT_SUPPORTED ) ; } if handles . len ( ) > 64 { return Err ( ZxError :: OUT_OF_RANGE ) ; } for handle in handles . iter ( ) { if ! handle . rights . contains ( Rights :: TRANSFER ) { return Err ( ZxError :: ACCESS_DENIED ) ; } } let channel = proc . get_object_with_rights :: < Channel > ( handle_value , Rights :: WRITE ) ? ; channel . write ( MessagePacket { data , handles } ) ? ; Ok ( ( ) ) }
Write a message to a channel.
Write a message to a channel .
&self
handle_value
HandleValue
options
u32
user_bytes
UserInPtr<u8>
num_bytes
u32
user_handles
UserInPtr<HandleValue>
num_handles
u32
&self
handle_value
HandleValue
options
u32
user_bytes
UserInPtr<u8>
num_bytes
u32
user_handles
UserInPtr<HandleValue>
num_handles
u32