pub fn sys_object_get_property(
        &self,
        handle_value: HandleValue,
        property: u32,
        buffer: usize,
        buffer_size: usize,
    ) -> ZxResult {
        let property = Property::try_from(property).map_err(|_| ZxError::INVALID_ARGS)?;
        info!(
            "object.get_property: handle={:#x?}, property={:?}, buffer=({:#x}; {:#x?})",
            handle_value, property, buffer, buffer_size
        );
        let proc = self.thread.proc();
        let object = proc.get_dyn_object_with_rights(handle_value, Rights::GET_PROPERTY)?;
        match property {
            Property::Name => {
                if buffer_size < MAX_NAME_LEN {
                    return Err(ZxError::BUFFER_TOO_SMALL);
                }
                let s = object.name();
                info!("name={:?}", s);
                UserOutPtr::<u8>::from(buffer).write_cstring(s.as_str())?;
                Ok(())
            }
            Property::ProcessDebugAddr => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let debug_addr = proc
                    .get_object_with_rights::<Process>(handle_value, Rights::GET_PROPERTY)?
                    .get_debug_addr();
                info_ptr.write(debug_addr)?;
                Ok(())
            }
            Property::ProcessVdsoBaseAddress => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let vdso_base = proc.vmar().vdso_base_addr().unwrap_or(0);
                info_ptr.write(vdso_base)?;
                Ok(())
            }
            Property::ProcessBreakOnLoad => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let break_on_load = proc
                    .get_object_with_rights::<Process>(handle_value, Rights::GET_PROPERTY)?
                    .get_dyn_break_on_load();
                info_ptr.write(break_on_load)?;
                Ok(())
            }
            Property::SocketRxThreshold => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let rx = proc
                    .get_object_with_rights::<Socket>(handle_value, Rights::GET_PROPERTY)?
                    .get_rx_tx_threshold()
                    .0;
                info_ptr.write(rx)?;
                Ok(())
            }
            Property::SocketTxThreshold => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let tx = proc
                    .get_object_with_rights::<Socket>(handle_value, Rights::GET_PROPERTY)?
                    .get_rx_tx_threshold()
                    .1;
                info_ptr.write(tx)?;
                Ok(())
            }
            Property::VmoContentSize => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let content_size = proc
                    .get_object_with_rights::<VmObject>(handle_value, Rights::GET_PROPERTY)?
                    .content_size();
                info_ptr.write(content_size)?;
                Ok(())
            }
            Property::ExceptionState => {
                let mut info_ptr = UserOutPtr::<u32>::from_addr_size(buffer, buffer_size)?;
                let state = proc
                    .get_object_with_rights::<ExceptionObject>(handle_value, Rights::GET_PROPERTY)?
                    .state();
                info_ptr.write(state)?;
                Ok(())
            }
            Property::ExceptionStrategy => {
                let mut info_ptr = UserOutPtr::<u32>::from_addr_size(buffer, buffer_size)?;
                let strategy = proc
                    .get_object_with_rights::<ExceptionObject>(handle_value, Rights::GET_PROPERTY)?
                    .strategy();
                info_ptr.write(strategy)?;
                Ok(())
            }
            _ => {
                warn!("unknown property {:?}", property);
                Err(ZxError::INVALID_ARGS)
            }
        }
    }
/// Ask for various properties of various kernel objects.
///
/// `handle_value: HandleValue`, indicates the target kernel object.
/// `property: u32`, indicates which property to get/set.
/// `buffer: usize`, holds the property value, and must be a pointer to a buffer of value_size bytes.
Ask for various properties of various kernel objects.
`handle_value: HandleValue`, indicates the target kernel object.
`property: u32`, indicates which property to get/set.
`buffer: usize`, holds the property value, and must be a pointer to a buffer of value_size bytes.
Ask for various properties of various kernel objects . ` handle_value : HandleValue ` indicates the target kernel object . ` property : u32 ` indicates which property to get / set . ` buffer : usize ` holds the property value and must be a pointer to a buffer of value_size bytes .
pub fn sys_object_get_property(
        &self,
        handle_value: HandleValue,
        property: u32,
        buffer: usize,
        buffer_size: usize,
    ) -> ZxResult {
        let property = Property::try_from(property).map_err(|_| ZxError::INVALID_ARGS)?;
        info!(
            "object.get_property: handle={:#x?}, property={:?}, buffer=({:#x}; {:#x?})",
            handle_value, property, buffer, buffer_size
        );
        let proc = self.thread.proc();
        let object = proc.get_dyn_object_with_rights(handle_value, Rights::GET_PROPERTY)?;
        match property {
            Property::Name => {
                if buffer_size < MAX_NAME_LEN {
                    return Err(ZxError::BUFFER_TOO_SMALL);
                }
                let s = object.name();
                info!("name={:?}", s);
                UserOutPtr::<u8>::from(buffer).write_cstring(s.as_str())?;
                Ok(())
            }
            Property::ProcessDebugAddr => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let debug_addr = proc
                    .get_object_with_rights::<Process>(handle_value, Rights::GET_PROPERTY)?
                    .get_debug_addr();
                info_ptr.write(debug_addr)?;
                Ok(())
            }
            Property::ProcessVdsoBaseAddress => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let vdso_base = proc.vmar().vdso_base_addr().unwrap_or(0);
                info_ptr.write(vdso_base)?;
                Ok(())
            }
            Property::ProcessBreakOnLoad => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let break_on_load = proc
                    .get_object_with_rights::<Process>(handle_value, Rights::GET_PROPERTY)?
                    .get_dyn_break_on_load();
                info_ptr.write(break_on_load)?;
                Ok(())
            }
            Property::SocketRxThreshold => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let rx = proc
                    .get_object_with_rights::<Socket>(handle_value, Rights::GET_PROPERTY)?
                    .get_rx_tx_threshold()
                    .0;
                info_ptr.write(rx)?;
                Ok(())
            }
            Property::SocketTxThreshold => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let tx = proc
                    .get_object_with_rights::<Socket>(handle_value, Rights::GET_PROPERTY)?
                    .get_rx_tx_threshold()
                    .1;
                info_ptr.write(tx)?;
                Ok(())
            }
            Property::VmoContentSize => {
                let mut info_ptr = UserOutPtr::<usize>::from_addr_size(buffer, buffer_size)?;
                let content_size = proc
                    .get_object_with_rights::<VmObject>(handle_value, Rights::GET_PROPERTY)?
                    .content_size();
                info_ptr.write(content_size)?;
                Ok(())
            }
            Property::ExceptionState => {
                let mut info_ptr = UserOutPtr::<u32>::from_addr_size(buffer, buffer_size)?;
                let state = proc
                    .get_object_with_rights::<ExceptionObject>(handle_value, Rights::GET_PROPERTY)?
                    .state();
                info_ptr.write(state)?;
                Ok(())
            }
            Property::ExceptionStrategy => {
                let mut info_ptr = UserOutPtr::<u32>::from_addr_size(buffer, buffer_size)?;
                let strategy = proc
                    .get_object_with_rights::<ExceptionObject>(handle_value, Rights::GET_PROPERTY)?
                    .strategy();
                info_ptr.write(strategy)?;
                Ok(())
            }
            _ => {
                warn!("unknown property {:?}", property);
                Err(ZxError::INVALID_ARGS)
            }
        }
    }
pub fn sys_object_get_property ( & self , handle_value : HandleValue , property : u32 , buffer : usize , buffer_size : usize , ) -> ZxResult { let property = Property :: try_from ( property ) . map_err ( | _ | ZxError :: INVALID_ARGS ) ? ; info ! ( " " handle_value property buffer buffer_size ) ; let proc = self . thread . proc ( ) ; let object = proc . get_dyn_object_with_rights ( handle_value , Rights :: GET_PROPERTY ) ? ; match property { Property :: Name => { if buffer_size < MAX_NAME_LEN { return Err ( ZxError :: BUFFER_TOO_SMALL ) ; } let s = object . name ( ) ; info ! ( " " s ) ; UserOutPtr :: < u8 > :: from ( buffer ) . write_cstring ( s . as_str ( ) ) ? ; Ok ( ( ) ) } Property :: ProcessDebugAddr => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let debug_addr = proc . get_object_with_rights :: < Process > ( handle_value , Rights :: GET_PROPERTY ) ? . get_debug_addr ( ) ; info_ptr . write ( debug_addr ) ? ; Ok ( ( ) ) } Property :: ProcessVdsoBaseAddress => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let vdso_base = proc . vmar ( ) . vdso_base_addr ( ) . unwrap_or ( 0 ) ; info_ptr . write ( vdso_base ) ? ; Ok ( ( ) ) } Property :: ProcessBreakOnLoad => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let break_on_load = proc . get_object_with_rights :: < Process > ( handle_value , Rights :: GET_PROPERTY ) ? . get_dyn_break_on_load ( ) ; info_ptr . write ( break_on_load ) ? ; Ok ( ( ) ) } Property :: SocketRxThreshold => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let rx = proc . get_object_with_rights :: < Socket > ( handle_value , Rights :: GET_PROPERTY ) ? . get_rx_tx_threshold ( ) . 0 ; info_ptr . write ( rx ) ? ; Ok ( ( ) ) } Property :: SocketTxThreshold => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let tx = proc . get_object_with_rights :: < Socket > ( handle_value , Rights :: GET_PROPERTY ) ? . get_rx_tx_threshold ( ) . 1 ; info_ptr . write ( tx ) ? ; Ok ( ( ) ) } Property :: VmoContentSize => { let mut info_ptr = UserOutPtr :: < usize > :: from_addr_size ( buffer , buffer_size ) ? ; let content_size = proc . get_object_with_rights :: < VmObject > ( handle_value , Rights :: GET_PROPERTY ) ? . content_size ( ) ; info_ptr . write ( content_size ) ? ; Ok ( ( ) ) } Property :: ExceptionState => { let mut info_ptr = UserOutPtr :: < u32 > :: from_addr_size ( buffer , buffer_size ) ? ; let state = proc . get_object_with_rights :: < ExceptionObject > ( handle_value , Rights :: GET_PROPERTY ) ? . state ( ) ; info_ptr . write ( state ) ? ; Ok ( ( ) ) } Property :: ExceptionStrategy => { let mut info_ptr = UserOutPtr :: < u32 > :: from_addr_size ( buffer , buffer_size ) ? ; let strategy = proc . get_object_with_rights :: < ExceptionObject > ( handle_value , Rights :: GET_PROPERTY ) ? . strategy ( ) ; info_ptr . write ( strategy ) ? ; Ok ( ( ) ) } _ => { warn ! ( " " property ) ; Err ( ZxError :: INVALID_ARGS ) } } }
Ask for various properties of various kernel objects.
Ask for various properties of various kernel objects .
&self
handle_value
HandleValue
property
u32
buffer
usize
buffer_size
usize
&self
handle_value
HandleValue
property
u32
buffer
usize
buffer_size
usize