class JobPolicy
Defined at line 129 of file ../../zircon/kernel/object/include/object/job_policy.h
JobPolicy is a value type that provides a space-efficient encoding of the policies defined in the
policy.h public header.
JobPolicy encodes two kinds of policy, basic and timer slack.
Basic policy is logically an array of zx_policy_basic elements. For example:
zx_policy_basic policy[] = {
{ ZX_POL_BAD_HANDLE, ZX_POL_ACTION_KILL },
{ ZX_POL_NEW_CHANNEL, ZX_POL_ACTION_ALLOW },
{ ZX_POL_NEW_FIFO, ZX_POL_ACTION_ALLOW_EXCEPTION },
{ ZX_POL_VMAR_WX, ZX_POL_ACTION_KILL }}
Timer slack policy defines the type and minimum amount of slack that will be applied to timer
and deadline events.
Public Methods
void JobPolicy (const JobPolicy & parent)
Defined at line 76 of file ../../zircon/kernel/object/job_policy.cc
JobPolicy CreateRootPolicy ()
static
Defined at line 82 of file ../../zircon/kernel/object/job_policy.cc
zx_status_t AddBasicPolicy (uint32_t mode, const zx_policy_basic_v2_t * policy, size_t count)
Merge array |policy| of length |count| into this object.
|mode| controls what happens when the policies in |policy| and this object intersect. |mode|
must be one of:
ZX_JOB_POL_RELATIVE - Conflicting policies are ignored and will not cause the call to fail.
ZX_JOB_POL_ABSOLUTE - If any of the policies in |policy| conflict with those in this object,
the call will fail with an error and this object will not be modified.
Defined at line 87 of file ../../zircon/kernel/object/job_policy.cc
void JobPolicy ()
Defined at line 131 of file ../../zircon/kernel/object/include/object/job_policy.h
uint32_t QueryBasicPolicy (uint32_t condition)
Returns the action (e.g. ZX_POL_ACTION_ALLOW) for the specified |condition|.
This method asserts if |policy| is invalid, and returns ZX_POL_ACTION_DENY for all other
failure modes.
Defined at line 131 of file ../../zircon/kernel/object/job_policy.cc
uint32_t QueryBasicPolicyOverride (uint32_t condition)
Returns if the action for the specified condition can be overriden, so it returns
ZX_POL_OVERRIDE_ALLOW or ZX_POL_OVERRIDE_DENY.
Defined at line 140 of file ../../zircon/kernel/object/job_policy.cc
void SetTimerSlack (TimerSlack slack)
Sets the timer slack policy.
|slack.amount| must be >= 0.
Defined at line 150 of file ../../zircon/kernel/object/job_policy.cc
TimerSlack GetTimerSlack ()
Returns the timer slack policy.
Defined at line 152 of file ../../zircon/kernel/object/job_policy.cc
bool operator== (const JobPolicy & rhs)
Defined at line 154 of file ../../zircon/kernel/object/job_policy.cc
bool operator!= (const JobPolicy & rhs)
Defined at line 162 of file ../../zircon/kernel/object/job_policy.cc
void IncrementCounter (uint32_t action, uint32_t condition)
Increment the kcounter for the given |action| and |condition|.
action must be
<
ZX_POL_ACTION_MAX and condition must be
<
ZX_POL_MAX.
For example: IncrementCounter(ZX_POL_ACTION_KILL, ZX_POL_NEW_CHANNEL);
Defined at line 239 of file ../../zircon/kernel/object/job_policy.cc