MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rctl_available_resource

Function rctl_available_resource

freebsd/kern/kern_rctl.c:360–373  ·  view source on GitHub ↗

* Return the amount of resource that can be allocated by 'p' before * hitting 'rule'. */

Source from the content-addressed store, hash-verified

358 * hitting 'rule'.
359 */
360static int64_t
361rctl_available_resource(const struct proc *p, const struct rctl_rule *rule)
362{
363 const struct racct *racct;
364 int64_t available;
365
366 ASSERT_RACCT_ENABLED();
367 RACCT_LOCK_ASSERT();
368
369 racct = rctl_proc_rule_to_racct(p, rule);
370 available = rule->rr_amount - racct->r_resources[rule->rr_resource];
371
372 return (available);
373}
374
375/*
376 * Called every second for proc, uidinfo, loginclass, and jail containers.

Callers 3

rctl_pcpu_availableFunction · 0.85
rctl_enforceFunction · 0.85
rctl_get_availableFunction · 0.85

Calls 1

rctl_proc_rule_to_racctFunction · 0.85

Tested by

no test coverage detected