pub fn sys_job_set_policy(
        &self,
        handle: HandleValue,
        options: u32,
        topic: u32,
        policy: usize,
        count: u32,
    ) -> ZxResult {
        info!(
            "job.set_policy: handle={:#x}, options={:#x}, topic={:#x}, policy={:#x?}, count={:#x}",
            handle, options, topic, policy, count,
        );
        let proc = self.thread.proc();
        let job = proc.get_object_with_rights::<Job>(handle, Rights::SET_POLICY)?;
        match topic {
            JOB_POL_BASE_V1 | JOB_POL_BASE_V2 => {
                let policy_option = match options {
                    JOB_POL_RELATIVE => SetPolicyOptions::Relative,
                    JOB_POL_ABSOLUTE => SetPolicyOptions::Absolute,
                    _ => return Err(ZxError::INVALID_ARGS),
                };
                let all_policy =
                    UserInPtr::<BasicPolicy>::from(policy).read_array(count as usize)?;
                job.set_policy_basic(policy_option, &all_policy)
            }
            //JOB_POL_BASE_V2 => unimplemented!(),
            JOB_POL_TIMER_SLACK => {
                if options != JOB_POL_RELATIVE {
                    return Err(ZxError::INVALID_ARGS);
                }
                if count != 1 {
                    return Err(ZxError::INVALID_ARGS);
                }
                let timer_policy = UserInPtr::<TimerSlackPolicy>::from(policy).read()?;
                job.set_policy_timer_slack(timer_policy)
            }
            _ => Err(ZxError::INVALID_ARGS),
        }
    }
/// Sets one or more security and/or resource policies to an empty job.
Sets one or more security and/or resource policies to an empty job.
Sets one or more security and / or resource policies to an empty job .
pub fn sys_job_set_policy(
        &self,
        handle: HandleValue,
        options: u32,
        topic: u32,
        policy: usize,
        count: u32,
    ) -> ZxResult {
        info!(
            "job.set_policy: handle={:#x}, options={:#x}, topic={:#x}, policy={:#x?}, count={:#x}",
            handle, options, topic, policy, count,
        );
        let proc = self.thread.proc();
        let job = proc.get_object_with_rights::<Job>(handle, Rights::SET_POLICY)?;
        match topic {
            JOB_POL_BASE_V1 | JOB_POL_BASE_V2 => {
                let policy_option = match options {
                    JOB_POL_RELATIVE => SetPolicyOptions::Relative,
                    JOB_POL_ABSOLUTE => SetPolicyOptions::Absolute,
                    _ => return Err(ZxError::INVALID_ARGS),
                };
                let all_policy =
                    UserInPtr::<BasicPolicy>::from(policy).read_array(count as usize)?;
                job.set_policy_basic(policy_option, &all_policy)
            }
            //JOB_POL_BASE_V2 => unimplemented!(),
            JOB_POL_TIMER_SLACK => {
                if options != JOB_POL_RELATIVE {
                    return Err(ZxError::INVALID_ARGS);
                }
                if count != 1 {
                    return Err(ZxError::INVALID_ARGS);
                }
                let timer_policy = UserInPtr::<TimerSlackPolicy>::from(policy).read()?;
                job.set_policy_timer_slack(timer_policy)
            }
            _ => Err(ZxError::INVALID_ARGS),
        }
    }
pub fn sys_job_set_policy ( & self , handle : HandleValue , options : u32 , topic : u32 , policy : usize , count : u32 , ) -> ZxResult { info ! ( " " handle options topic policy count ) ; let proc = self . thread . proc ( ) ; let job = proc . get_object_with_rights :: < Job > ( handle , Rights :: SET_POLICY ) ? ; match topic { JOB_POL_BASE_V1 | JOB_POL_BASE_V2 => { let policy_option = match options { JOB_POL_RELATIVE => SetPolicyOptions :: Relative , JOB_POL_ABSOLUTE => SetPolicyOptions :: Absolute , _ => return Err ( ZxError :: INVALID_ARGS ) , } ; let all_policy = UserInPtr :: < BasicPolicy > :: from ( policy ) . read_array ( count as usize ) ? ; job . set_policy_basic ( policy_option , & all_policy ) } //JOB_POL_BASE_V2 => unimplemented!(), JOB_POL_TIMER_SLACK => { if options != JOB_POL_RELATIVE { return Err ( ZxError :: INVALID_ARGS ) ; } if count != 1 { return Err ( ZxError :: INVALID_ARGS ) ; } let timer_policy = UserInPtr :: < TimerSlackPolicy > :: from ( policy ) . read ( ) ? ; job . set_policy_timer_slack ( timer_policy ) } _ => Err ( ZxError :: INVALID_ARGS ) , } }
Sets one or more security and/or resource policies to an empty job.
Sets one or more security and / or resource policies to an empty job .
&self
handle
HandleValue
options
u32
topic
u32
policy
usize
count
u32
&self
handle
HandleValue
options
u32
topic
u32
policy
usize
count
u32