PERFORCE change 187864 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun Jan 16 17:48:02 UTC 2011
http://p4web.freebsd.org/@@187864?ac=10
Change 187864 by trasz at trasz_victim on 2011/01/16 17:47:36
Fix prefixes for structure element names, broken after last renaming.
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#54 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#10 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/rctl.h#4 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#54 (text+ko) ====
@@ -474,7 +474,7 @@
return (UINT64_MAX);
#endif
}
-
+
/*
* Decrease allocation of 'resource' by 'amount' for process 'p'.
*/
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#10 (text+ko) ====
@@ -79,8 +79,8 @@
* with uidinfo for user X, and to each process of that user.
*/
struct rctl_rule_link {
- LIST_ENTRY(rctl_rule_link) rctl_next;
- struct rctl_rule *rctl_rule;
+ LIST_ENTRY(rctl_rule_link) rrl_next;
+ struct rctl_rule *rrl_rule;
};
struct dict {
@@ -216,27 +216,27 @@
rw_assert(&rctl_lock, RA_LOCKED);
- resource = rule->hr_resource;
- switch (rule->hr_per) {
+ resource = rule->rr_resource;
+ switch (rule->rr_per) {
case RCTL_SUBJECT_TYPE_PROCESS:
- available = rule->hr_amount -
+ available = rule->rr_amount -
p->p_container.c_resources[resource];
break;
case RCTL_SUBJECT_TYPE_USER:
- available = rule->hr_amount -
+ available = rule->rr_amount -
cred->cr_ruidinfo->ui_container.c_resources[resource];
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- available = rule->hr_amount -
+ available = rule->rr_amount -
cred->cr_loginclass->lc_container.c_resources[resource];
break;
case RCTL_SUBJECT_TYPE_JAIL:
- available = rule->hr_amount -
+ available = rule->rr_amount -
cred->cr_prison->pr_container.c_resources[resource];
break;
default:
panic("rctl_compute_available: unknown per %d",
- rule->hr_per);
+ rule->rr_per);
}
return (available);
@@ -263,8 +263,8 @@
*/
if (available < 0) {
#ifdef notyet
- KASSERT(rule->hr_action != RCTL_ACTION_DENY ||
- !container_resource_deniable(rule->hr_resource),
+ KASSERT(rule->rr_action != RCTL_ACTION_DENY ||
+ !container_resource_deniable(rule->rr_resource),
("rctl_would_exceed: deny rule already exceeded"));
#endif
return (0);
@@ -295,14 +295,14 @@
* There may be more than one matching rule; go through all of them.
* Denial should be done last, after logging and sending signals.
*/
- LIST_FOREACH(link, &p->p_container.c_rule_links, rctl_next) {
- rule = link->rctl_rule;
- if (rule->hr_resource != resource)
+ LIST_FOREACH(link, &p->p_container.c_rule_links, rrl_next) {
+ rule = link->rrl_rule;
+ if (rule->rr_resource != resource)
continue;
if (!rctl_would_exceed(p, rule, amount))
continue;
- switch (rule->hr_action) {
+ switch (rule->rr_action) {
case RCTL_ACTION_DENY:
should_deny = 1;
continue;
@@ -344,7 +344,7 @@
continue;
default:
panic("rctl_enforce_proc: unknown action %d",
- rule->hr_action);
+ rule->rr_action);
}
}
@@ -374,14 +374,14 @@
* There may be more than one matching rule; go through all of them.
* Denial should be done last, after logging and sending signals.
*/
- LIST_FOREACH(link, &p->p_container.c_rule_links, rctl_next) {
- rule = link->rctl_rule;
- if (rule->hr_resource != resource)
+ LIST_FOREACH(link, &p->p_container.c_rule_links, rrl_next) {
+ rule = link->rrl_rule;
+ if (rule->rr_resource != resource)
continue;
- if (rule->hr_action != RCTL_ACTION_DENY)
+ if (rule->rr_action != RCTL_ACTION_DENY)
continue;
- if (rule->hr_amount < amount)
- amount = rule->hr_amount;
+ if (rule->rr_amount < amount)
+ amount = rule->rr_amount;
}
rw_runlock(&rctl_lock);
@@ -393,58 +393,58 @@
rctl_rule_matches(const struct rctl_rule *rule, const struct rctl_rule *filter)
{
- if (filter->hr_subject_type != RCTL_SUBJECT_TYPE_UNDEFINED) {
- if (rule->hr_subject_type != filter->hr_subject_type)
+ if (filter->rr_subject_type != RCTL_SUBJECT_TYPE_UNDEFINED) {
+ if (rule->rr_subject_type != filter->rr_subject_type)
return (0);
- switch (filter->hr_subject_type) {
+ switch (filter->rr_subject_type) {
case RCTL_SUBJECT_TYPE_PROCESS:
- if (filter->hr_subject.hs_proc != NULL &&
- rule->hr_subject.hs_proc !=
- filter->hr_subject.hs_proc)
+ if (filter->rr_subject.rs_proc != NULL &&
+ rule->rr_subject.rs_proc !=
+ filter->rr_subject.rs_proc)
return (0);
break;
case RCTL_SUBJECT_TYPE_USER:
- if (filter->hr_subject.hs_uip != NULL &&
- rule->hr_subject.hs_uip !=
- filter->hr_subject.hs_uip)
+ if (filter->rr_subject.rs_uip != NULL &&
+ rule->rr_subject.rs_uip !=
+ filter->rr_subject.rs_uip)
return (0);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (filter->hr_subject.hs_loginclass != NULL &&
- rule->hr_subject.hs_loginclass !=
- filter->hr_subject.hs_loginclass)
+ if (filter->rr_subject.hr_loginclass != NULL &&
+ rule->rr_subject.hr_loginclass !=
+ filter->rr_subject.hr_loginclass)
return (0);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- if (filter->hr_subject.hs_prison != NULL &&
- rule->hr_subject.hs_prison !=
- filter->hr_subject.hs_prison)
+ if (filter->rr_subject.rs_prison != NULL &&
+ rule->rr_subject.rs_prison !=
+ filter->rr_subject.rs_prison)
return (0);
break;
default:
panic("rctl_rule_matches: unknown subject type %d",
- filter->hr_subject_type);
+ filter->rr_subject_type);
}
}
- if (filter->hr_resource != RUSAGE_UNDEFINED) {
- if (rule->hr_resource != filter->hr_resource)
+ if (filter->rr_resource != RUSAGE_UNDEFINED) {
+ if (rule->rr_resource != filter->rr_resource)
return (0);
}
- if (filter->hr_action != RCTL_ACTION_UNDEFINED) {
- if (rule->hr_action != filter->hr_action)
+ if (filter->rr_action != RCTL_ACTION_UNDEFINED) {
+ if (rule->rr_action != filter->rr_action)
return (0);
}
- if (filter->hr_amount != RCTL_AMOUNT_UNDEFINED) {
- if (rule->hr_amount != filter->hr_amount)
+ if (filter->rr_amount != RCTL_AMOUNT_UNDEFINED) {
+ if (rule->rr_amount != filter->rr_amount)
return (0);
}
- if (filter->hr_per != RCTL_SUBJECT_TYPE_UNDEFINED) {
- if (rule->hr_per != filter->hr_per)
+ if (filter->rr_per != RCTL_SUBJECT_TYPE_UNDEFINED) {
+ if (rule->rr_per != filter->rr_per)
return (0);
}
@@ -511,10 +511,10 @@
rctl_rule_acquire(rule);
link = uma_zalloc(rctl_rule_link_zone, M_WAITOK);
- link->rctl_rule = rule;
+ link->rrl_rule = rule;
rw_wlock(&rctl_lock);
- LIST_INSERT_HEAD(&container->c_rule_links, link, rctl_next);
+ LIST_INSERT_HEAD(&container->c_rule_links, link, rrl_next);
rw_wunlock(&rctl_lock);
}
@@ -530,9 +530,9 @@
if (link == NULL)
return (ENOMEM);
rctl_rule_acquire(rule);
- link->rctl_rule = rule;
+ link->rrl_rule = rule;
- LIST_INSERT_HEAD(&container->c_rule_links, link, rctl_next);
+ LIST_INSERT_HEAD(&container->c_rule_links, link, rrl_next);
return (0);
}
@@ -550,12 +550,12 @@
rw_assert(&rctl_lock, RA_WLOCKED);
- LIST_FOREACH_SAFE(link, &container->c_rule_links, rctl_next, linktmp) {
- if (!rctl_rule_matches(link->rctl_rule, filter))
+ LIST_FOREACH_SAFE(link, &container->c_rule_links, rrl_next, linktmp) {
+ if (!rctl_rule_matches(link->rrl_rule, filter))
continue;
- LIST_REMOVE(link, rctl_next);
- rctl_rule_release(link->rctl_rule);
+ LIST_REMOVE(link, rrl_next);
+ rctl_rule_release(link->rrl_rule);
uma_zfree(rctl_rule_link_zone, link);
removed++;
}
@@ -566,25 +566,25 @@
rctl_rule_acquire_subject(struct rctl_rule *rule)
{
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_UNDEFINED:
case RCTL_SUBJECT_TYPE_PROCESS:
break;
case RCTL_SUBJECT_TYPE_USER:
- if (rule->hr_subject.hs_uip != NULL)
- uihold(rule->hr_subject.hs_uip);
+ if (rule->rr_subject.rs_uip != NULL)
+ uihold(rule->rr_subject.rs_uip);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (rule->hr_subject.hs_loginclass != NULL)
- loginclass_acquire(rule->hr_subject.hs_loginclass);
+ if (rule->rr_subject.hr_loginclass != NULL)
+ loginclass_acquire(rule->rr_subject.hr_loginclass);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- if (rule->hr_subject.hs_loginclass != NULL)
- prison_hold(rule->hr_subject.hs_prison);
+ if (rule->rr_subject.hr_loginclass != NULL)
+ prison_hold(rule->rr_subject.rs_prison);
break;
default:
panic("rctl_rule_acquire_subject: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
}
@@ -592,25 +592,25 @@
rctl_rule_release_subject(struct rctl_rule *rule)
{
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_UNDEFINED:
case RCTL_SUBJECT_TYPE_PROCESS:
break;
case RCTL_SUBJECT_TYPE_USER:
- if (rule->hr_subject.hs_uip != NULL)
- uifree(rule->hr_subject.hs_uip);
+ if (rule->rr_subject.rs_uip != NULL)
+ uifree(rule->rr_subject.rs_uip);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (rule->hr_subject.hs_loginclass != NULL)
- loginclass_release(rule->hr_subject.hs_loginclass);
+ if (rule->rr_subject.hr_loginclass != NULL)
+ loginclass_release(rule->rr_subject.hr_loginclass);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- if (rule->hr_subject.hs_prison != NULL)
- prison_free(rule->hr_subject.hs_prison);
+ if (rule->rr_subject.rs_prison != NULL)
+ prison_free(rule->rr_subject.rs_prison);
break;
default:
panic("rctl_rule_release_subject: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
}
@@ -622,16 +622,16 @@
rule = uma_zalloc(rctl_rule_zone, flags);
if (rule == NULL)
return (NULL);
- rule->hr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED;
- rule->hr_subject.hs_proc = NULL;
- rule->hr_subject.hs_uip = NULL;
- rule->hr_subject.hs_loginclass = NULL;
- rule->hr_subject.hs_prison = NULL;
- rule->hr_per = RCTL_SUBJECT_TYPE_UNDEFINED;
- rule->hr_resource = RUSAGE_UNDEFINED;
- rule->hr_action = RCTL_ACTION_UNDEFINED;
- rule->hr_amount = RCTL_AMOUNT_UNDEFINED;
- refcount_init(&rule->hr_refcount, 1);
+ rule->rr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED;
+ rule->rr_subject.rs_proc = NULL;
+ rule->rr_subject.rs_uip = NULL;
+ rule->rr_subject.hr_loginclass = NULL;
+ rule->rr_subject.rs_prison = NULL;
+ rule->rr_per = RCTL_SUBJECT_TYPE_UNDEFINED;
+ rule->rr_resource = RUSAGE_UNDEFINED;
+ rule->rr_action = RCTL_ACTION_UNDEFINED;
+ rule->rr_amount = RCTL_AMOUNT_UNDEFINED;
+ refcount_init(&rule->rr_refcount, 1);
return (rule);
}
@@ -644,16 +644,16 @@
copy = uma_zalloc(rctl_rule_zone, flags);
if (copy == NULL)
return (NULL);
- copy->hr_subject_type = rule->hr_subject_type;
- copy->hr_subject.hs_proc = rule->hr_subject.hs_proc;
- copy->hr_subject.hs_uip = rule->hr_subject.hs_uip;
- copy->hr_subject.hs_loginclass = rule->hr_subject.hs_loginclass;
- copy->hr_subject.hs_prison = rule->hr_subject.hs_prison;
- copy->hr_per = rule->hr_per;
- copy->hr_resource = rule->hr_resource;
- copy->hr_action = rule->hr_action;
- copy->hr_amount = rule->hr_amount;
- refcount_init(©->hr_refcount, 1);
+ copy->rr_subject_type = rule->rr_subject_type;
+ copy->rr_subject.rs_proc = rule->rr_subject.rs_proc;
+ copy->rr_subject.rs_uip = rule->rr_subject.rs_uip;
+ copy->rr_subject.hr_loginclass = rule->rr_subject.hr_loginclass;
+ copy->rr_subject.rs_prison = rule->rr_subject.rs_prison;
+ copy->rr_per = rule->rr_per;
+ copy->rr_resource = rule->rr_resource;
+ copy->rr_action = rule->rr_action;
+ copy->rr_amount = rule->rr_amount;
+ refcount_init(©->rr_refcount, 1);
rctl_rule_acquire_subject(copy);
return (copy);
@@ -663,18 +663,18 @@
rctl_rule_acquire(struct rctl_rule *rule)
{
- KASSERT(rule->hr_refcount > 0, ("rule->hr_refcount > 0"));
+ KASSERT(rule->rr_refcount > 0, ("rule->rr_refcount > 0"));
- refcount_acquire(&rule->hr_refcount);
+ refcount_acquire(&rule->rr_refcount);
}
void
rctl_rule_release(struct rctl_rule *rule)
{
- KASSERT(rule->hr_refcount > 0, ("rule->hr_refcount > 0"));
+ KASSERT(rule->rr_refcount > 0, ("rule->rr_refcount > 0"));
- if (refcount_release(&rule->hr_refcount)) {
+ if (refcount_release(&rule->rr_refcount)) {
rctl_rule_release_subject(rule);
uma_zfree(rctl_rule_zone, rule);
}
@@ -684,36 +684,36 @@
rctl_rule_fully_specified(const struct rctl_rule *rule)
{
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_UNDEFINED:
return (0);
case RCTL_SUBJECT_TYPE_PROCESS:
- if (rule->hr_subject.hs_proc == NULL)
+ if (rule->rr_subject.rs_proc == NULL)
return (0);
break;
case RCTL_SUBJECT_TYPE_USER:
- if (rule->hr_subject.hs_uip == NULL)
+ if (rule->rr_subject.rs_uip == NULL)
return (0);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (rule->hr_subject.hs_loginclass == NULL)
+ if (rule->rr_subject.hr_loginclass == NULL)
return (0);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- if (rule->hr_subject.hs_prison == NULL)
+ if (rule->rr_subject.rs_prison == NULL)
return (0);
break;
default:
panic("rctl_rule_fully_specified: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
- if (rule->hr_resource == RUSAGE_UNDEFINED)
+ if (rule->rr_resource == RUSAGE_UNDEFINED)
return (0);
- if (rule->hr_action == RCTL_ACTION_UNDEFINED)
+ if (rule->rr_action == RCTL_ACTION_UNDEFINED)
return (0);
- if (rule->hr_amount == RCTL_AMOUNT_UNDEFINED)
+ if (rule->rr_amount == RCTL_AMOUNT_UNDEFINED)
return (0);
- if (rule->hr_per == RCTL_SUBJECT_TYPE_UNDEFINED)
+ if (rule->rr_per == RCTL_SUBJECT_TYPE_UNDEFINED)
return (0);
return (1);
@@ -738,95 +738,95 @@
perstr = rulestr;
if (subjectstr == NULL || subjectstr[0] == '\0')
- rule->hr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED;
+ rule->rr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED;
else {
- error = str2value(subjectstr, &rule->hr_subject_type, subjectnames);
+ error = str2value(subjectstr, &rule->rr_subject_type, subjectnames);
if (error != 0)
goto out;
}
if (subject_idstr == NULL || subject_idstr[0] == '\0') {
- rule->hr_subject.hs_proc = NULL;
- rule->hr_subject.hs_uip = NULL;
- rule->hr_subject.hs_loginclass = NULL;
- rule->hr_subject.hs_prison = NULL;
+ rule->rr_subject.rs_proc = NULL;
+ rule->rr_subject.rs_uip = NULL;
+ rule->rr_subject.hr_loginclass = NULL;
+ rule->rr_subject.rs_prison = NULL;
} else {
/*
* Loginclasses don't have any numerical ID's.
*/
- if (rule->hr_subject_type != RCTL_SUBJECT_TYPE_LOGINCLASS) {
+ if (rule->rr_subject_type != RCTL_SUBJECT_TYPE_LOGINCLASS) {
error = str2id(subject_idstr, &id);
if (error != 0)
goto out;
}
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_UNDEFINED:
error = EINVAL;
goto out;
case RCTL_SUBJECT_TYPE_PROCESS:
sx_assert(&allproc_lock, SA_LOCKED);
- rule->hr_subject.hs_proc = pfind(id);
- if (rule->hr_subject.hs_proc == NULL) {
+ rule->rr_subject.rs_proc = pfind(id);
+ if (rule->rr_subject.rs_proc == NULL) {
error = ESRCH;
goto out;
}
- PROC_UNLOCK(rule->hr_subject.hs_proc);
+ PROC_UNLOCK(rule->rr_subject.rs_proc);
break;
case RCTL_SUBJECT_TYPE_USER:
- rule->hr_subject.hs_uip = uifind(id);
+ rule->rr_subject.rs_uip = uifind(id);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- rule->hr_subject.hs_loginclass = loginclass_find(subject_idstr);
+ rule->rr_subject.hr_loginclass = loginclass_find(subject_idstr);
break;
case RCTL_SUBJECT_TYPE_JAIL:
sx_slock(&allprison_lock);
- rule->hr_subject.hs_prison = prison_find(id);
- if (rule->hr_subject.hs_prison == NULL) {
+ rule->rr_subject.rs_prison = prison_find(id);
+ if (rule->rr_subject.rs_prison == NULL) {
sx_sunlock(&allprison_lock);
error = ESRCH;
goto out;
}
- prison_hold_locked(rule->hr_subject.hs_prison);
+ prison_hold_locked(rule->rr_subject.rs_prison);
/* prison_find() returns with mutex held. */
- mtx_unlock(&rule->hr_subject.hs_prison->pr_mtx);
+ mtx_unlock(&rule->rr_subject.rs_prison->pr_mtx);
sx_sunlock(&allprison_lock);
break;
default:
panic("rctl_rule_from_string: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
}
if (resourcestr == NULL || resourcestr[0] == '\0')
- rule->hr_resource = RUSAGE_UNDEFINED;
+ rule->rr_resource = RUSAGE_UNDEFINED;
else {
- error = str2value(resourcestr, &rule->hr_resource,
+ error = str2value(resourcestr, &rule->rr_resource,
resourcenames);
if (error != 0)
goto out;
}
if (actionstr == NULL || actionstr[0] == '\0')
- rule->hr_action = RCTL_ACTION_UNDEFINED;
+ rule->rr_action = RCTL_ACTION_UNDEFINED;
else {
- error = str2value(actionstr, &rule->hr_action, actionnames);
+ error = str2value(actionstr, &rule->rr_action, actionnames);
if (error != 0)
goto out;
}
if (amountstr == NULL || amountstr[0] == '\0')
- rule->hr_amount = RCTL_AMOUNT_UNDEFINED;
+ rule->rr_amount = RCTL_AMOUNT_UNDEFINED;
else {
- error = str2int64(amountstr, &rule->hr_amount);
+ error = str2int64(amountstr, &rule->rr_amount);
if (error != 0)
goto out;
}
if (perstr == NULL || perstr[0] == '\0')
- rule->hr_per = RCTL_SUBJECT_TYPE_UNDEFINED;
+ rule->rr_per = RCTL_SUBJECT_TYPE_UNDEFINED;
else {
- error = str2value(perstr, &rule->hr_per, subjectnames);
+ error = str2value(perstr, &rule->rr_per, subjectnames);
if (error != 0)
goto out;
}
@@ -855,7 +855,7 @@
KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified"));
- if (rule->hr_action == RCTL_ACTION_DELAY)
+ if (rule->rr_action == RCTL_ACTION_DELAY)
return (EOPNOTSUPP);
/*
@@ -863,9 +863,9 @@
*/
rctl_rule_remove(rule);
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_PROCESS:
- p = rule->hr_subject.hs_proc;
+ p = rule->rr_subject.rs_proc;
KASSERT(p != NULL, ("rctl_rule_add: NULL proc"));
rctl_container_add_rule(&p->p_container, rule);
/*
@@ -877,26 +877,26 @@
return (0);
case RCTL_SUBJECT_TYPE_USER:
- uip = rule->hr_subject.hs_uip;
+ uip = rule->rr_subject.rs_uip;
KASSERT(uip != NULL, ("rctl_rule_add: NULL uip"));
rctl_container_add_rule(&uip->ui_container, rule);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- lc = rule->hr_subject.hs_loginclass;
+ lc = rule->rr_subject.hr_loginclass;
KASSERT(lc != NULL, ("rctl_rule_add: NULL loginclass"));
rctl_container_add_rule(&lc->lc_container, rule);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- pr = rule->hr_subject.hs_prison;
+ pr = rule->rr_subject.rs_prison;
KASSERT(pr != NULL, ("rctl_rule_add: NULL pr"));
rctl_container_add_rule(&pr->pr_container, rule);
break;
default:
panic("rctl_rule_add: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
/*
@@ -906,20 +906,20 @@
sx_assert(&allproc_lock, SA_LOCKED);
FOREACH_PROC_IN_SYSTEM(p) {
cred = p->p_ucred;
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_USER:
- if (cred->cr_uidinfo == rule->hr_subject.hs_uip ||
- cred->cr_ruidinfo == rule->hr_subject.hs_uip)
+ if (cred->cr_uidinfo == rule->rr_subject.rs_uip ||
+ cred->cr_ruidinfo == rule->rr_subject.rs_uip)
break;
continue;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (cred->cr_loginclass == rule->hr_subject.hs_loginclass)
+ if (cred->cr_loginclass == rule->rr_subject.hr_loginclass)
break;
continue;
case RCTL_SUBJECT_TYPE_JAIL:
match = 0;
for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) {
- if (pr == rule->hr_subject.hs_prison) {
+ if (pr == rule->rr_subject.rs_prison) {
match = 1;
break;
}
@@ -929,7 +929,7 @@
continue;
default:
panic("rctl_rule_add: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
rctl_container_add_rule(&p->p_container, rule);
@@ -962,9 +962,9 @@
int error, found = 0;
struct proc *p;
- if (filter->hr_subject_type == RCTL_SUBJECT_TYPE_PROCESS &&
- filter->hr_subject.hs_proc != NULL) {
- p = filter->hr_subject.hs_proc;
+ if (filter->rr_subject_type == RCTL_SUBJECT_TYPE_PROCESS &&
+ filter->rr_subject.rs_proc != NULL) {
+ p = filter->rr_subject.rs_proc;
rw_wlock(&rctl_lock);
found = rctl_container_remove_rules(&p->p_container, filter);
rw_wunlock(&rctl_lock);
@@ -1002,45 +1002,45 @@
rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule)
{
- sbuf_printf(sb, "%s:", rctl_subject_type_name(rule->hr_subject_type));
+ sbuf_printf(sb, "%s:", rctl_subject_type_name(rule->rr_subject_type));
- switch (rule->hr_subject_type) {
+ switch (rule->rr_subject_type) {
case RCTL_SUBJECT_TYPE_PROCESS:
- if (rule->hr_subject.hs_proc == NULL)
+ if (rule->rr_subject.rs_proc == NULL)
sbuf_printf(sb, ":");
else
- sbuf_printf(sb, "%d:", rule->hr_subject.hs_proc->p_pid);
+ sbuf_printf(sb, "%d:", rule->rr_subject.rs_proc->p_pid);
break;
case RCTL_SUBJECT_TYPE_USER:
- if (rule->hr_subject.hs_uip == NULL)
+ if (rule->rr_subject.rs_uip == NULL)
sbuf_printf(sb, ":");
else
- sbuf_printf(sb, "%d:", rule->hr_subject.hs_uip->ui_uid);
+ sbuf_printf(sb, "%d:", rule->rr_subject.rs_uip->ui_uid);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- if (rule->hr_subject.hs_loginclass == NULL)
+ if (rule->rr_subject.hr_loginclass == NULL)
sbuf_printf(sb, ":");
else
- sbuf_printf(sb, "%s:", rule->hr_subject.hs_loginclass->lc_name);
+ sbuf_printf(sb, "%s:", rule->rr_subject.hr_loginclass->lc_name);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- if (rule->hr_subject.hs_prison == NULL)
+ if (rule->rr_subject.rs_prison == NULL)
sbuf_printf(sb, ":");
else
- sbuf_printf(sb, "%d:", rule->hr_subject.hs_prison->pr_id);
+ sbuf_printf(sb, "%d:", rule->rr_subject.rs_prison->pr_id);
break;
default:
panic("rctl_rule_to_sbuf: unknown subject type %d",
- rule->hr_subject_type);
+ rule->rr_subject_type);
}
sbuf_printf(sb, "%s:%s=%jd",
- rctl_resource_name(rule->hr_resource),
- rctl_action_name(rule->hr_action),
- rule->hr_amount);
+ rctl_resource_name(rule->rr_resource),
+ rctl_action_name(rule->rr_action),
+ rule->rr_amount);
- if (rule->hr_per != rule->hr_subject_type)
- sbuf_printf(sb, "/%s", rctl_subject_type_name(rule->hr_per));
+ if (rule->rr_per != rule->rr_subject_type)
+ sbuf_printf(sb, "/%s", rctl_subject_type_name(rule->rr_per));
}
/*
@@ -1128,9 +1128,9 @@
return (EINVAL);
}
- switch (filter->hr_subject_type) {
+ switch (filter->rr_subject_type) {
case RCTL_SUBJECT_TYPE_PROCESS:
- p = filter->hr_subject.hs_proc;
+ p = filter->rr_subject.rs_proc;
if (p == NULL) {
error = EINVAL;
goto out;
@@ -1138,7 +1138,7 @@
outputsbuf = rctl_container_to_sbuf(&p->p_container);
break;
case RCTL_SUBJECT_TYPE_USER:
- uip = filter->hr_subject.hs_uip;
+ uip = filter->rr_subject.rs_uip;
if (uip == NULL) {
error = EINVAL;
goto out;
@@ -1146,7 +1146,7 @@
outputsbuf = rctl_container_to_sbuf(&uip->ui_container);
break;
case RCTL_SUBJECT_TYPE_LOGINCLASS:
- lc = filter->hr_subject.hs_loginclass;
+ lc = filter->rr_subject.hr_loginclass;
if (lc == NULL) {
error = EINVAL;
goto out;
@@ -1154,7 +1154,7 @@
outputsbuf = rctl_container_to_sbuf(&lc->lc_container);
break;
case RCTL_SUBJECT_TYPE_JAIL:
- pr = filter->hr_subject.hs_prison;
+ pr = filter->rr_subject.rs_prison;
if (pr == NULL) {
error = EINVAL;
goto out;
@@ -1183,10 +1183,10 @@
struct sbuf *sb = (struct sbuf *)arg3;
rw_rlock(&rctl_lock);
- LIST_FOREACH(link, &container->c_rule_links, rctl_next) {
- if (!rctl_rule_matches(link->rctl_rule, filter))
+ LIST_FOREACH(link, &container->c_rule_links, rrl_next) {
+ if (!rctl_rule_matches(link->rrl_rule, filter))
continue;
- rctl_rule_to_sbuf(sb, link->rctl_rule);
+ rctl_rule_to_sbuf(sb, link->rrl_rule);
sbuf_printf(sb, ",");
}
rw_runlock(&rctl_lock);
@@ -1225,16 +1225,16 @@
sx_assert(&allproc_lock, SA_LOCKED);
FOREACH_PROC_IN_SYSTEM(p) {
rw_rlock(&rctl_lock);
- LIST_FOREACH(link, &p->p_container.c_rule_links, rctl_next) {
+ LIST_FOREACH(link, &p->p_container.c_rule_links, rrl_next) {
/*
* Non-process rules will be added to the buffer later.
* Adding them here would result in duplicated output.
*/
- if (link->rctl_rule->hr_subject_type != RCTL_SUBJECT_TYPE_PROCESS)
+ if (link->rrl_rule->rr_subject_type != RCTL_SUBJECT_TYPE_PROCESS)
continue;
- if (!rctl_rule_matches(link->rctl_rule, filter))
+ if (!rctl_rule_matches(link->rrl_rule, filter))
continue;
- rctl_rule_to_sbuf(sb, link->rctl_rule);
+ rctl_rule_to_sbuf(sb, link->rrl_rule);
sbuf_printf(sb, ",");
}
rw_runlock(&rctl_lock);
@@ -1286,17 +1286,17 @@
return (EINVAL);
}
- if (filter->hr_subject_type == RCTL_SUBJECT_TYPE_UNDEFINED) {
+ if (filter->rr_subject_type == RCTL_SUBJECT_TYPE_UNDEFINED) {
rctl_rule_release(filter);
sx_sunlock(&allproc_lock);
return (EINVAL);
}
- if (filter->hr_subject_type != RCTL_SUBJECT_TYPE_PROCESS) {
+ if (filter->rr_subject_type != RCTL_SUBJECT_TYPE_PROCESS) {
rctl_rule_release(filter);
sx_sunlock(&allproc_lock);
return (EOPNOTSUPP);
}
- if (filter->hr_subject.hs_proc == NULL) {
+ if (filter->rr_subject.rs_proc == NULL) {
rctl_rule_release(filter);
sx_sunlock(&allproc_lock);
return (EINVAL);
@@ -1308,8 +1308,8 @@
KASSERT(sb != NULL, ("sbuf_new failed"));
rw_rlock(&rctl_lock);
- LIST_FOREACH(link, &filter->hr_subject.hs_proc->p_container.c_rule_links, rctl_next) {
- rctl_rule_to_sbuf(sb, link->rctl_rule);
+ LIST_FOREACH(link, &filter->rr_subject.rs_proc->p_container.c_rule_links, rrl_next) {
+ rctl_rule_to_sbuf(sb, link->rrl_rule);
sbuf_printf(sb, ",");
}
rw_runlock(&rctl_lock);
@@ -1358,15 +1358,15 @@
/*
* The 'per' part of a rule is optional.
*/
- if (rule->hr_per == RCTL_SUBJECT_TYPE_UNDEFINED &&
- rule->hr_subject_type != RCTL_SUBJECT_TYPE_UNDEFINED)
- rule->hr_per = rule->hr_subject_type;
+ if (rule->rr_per == RCTL_SUBJECT_TYPE_UNDEFINED &&
+ rule->rr_subject_type != RCTL_SUBJECT_TYPE_UNDEFINED)
+ rule->rr_per = rule->rr_subject_type;
/*
* Some rules just don't make sense.
*/
- if (rule->hr_resource == RUSAGE_CPU &&
- rule->hr_action == RCTL_ACTION_DENY) {
+ if (rule->rr_resource == RUSAGE_CPU &&
+ rule->rr_action == RCTL_ACTION_DENY) {
error = EINVAL;
goto out;
}
@@ -1440,16 +1440,16 @@
*/
rulecnt = 0;
rw_rlock(&rctl_lock);
- LIST_FOREACH(link, &p->p_container.c_rule_links, rctl_next) {
- if (link->rctl_rule->hr_subject_type ==
+ LIST_FOREACH(link, &p->p_container.c_rule_links, rrl_next) {
+ if (link->rrl_rule->rr_subject_type ==
RCTL_SUBJECT_TYPE_PROCESS)
rulecnt++;
}
- LIST_FOREACH(link, &newuip->ui_container.c_rule_links, rctl_next)
+ LIST_FOREACH(link, &newuip->ui_container.c_rule_links, rrl_next)
rulecnt++;
- LIST_FOREACH(link, &newlc->lc_container.c_rule_links, rctl_next)
+ LIST_FOREACH(link, &newlc->lc_container.c_rule_links, rrl_next)
rulecnt++;
- LIST_FOREACH(link, &newpr->pr_container.c_rule_links, rctl_next)
+ LIST_FOREACH(link, &newpr->pr_container.c_rule_links, rrl_next)
rulecnt++;
rw_runlock(&rctl_lock);
@@ -1459,8 +1459,8 @@
*/
for (i = 0; i < rulecnt; i++) {
newlink = uma_zalloc(rctl_rule_link_zone, M_WAITOK);
- newlink->rctl_rule = NULL;
- LIST_INSERT_HEAD(&newrules, newlink, rctl_next);
+ newlink->rrl_rule = NULL;
+ LIST_INSERT_HEAD(&newrules, newlink, rrl_next);
}
newlink = LIST_FIRST(&newrules);
@@ -1469,42 +1469,42 @@
* Assign rules to the newly allocated list entries.
*/
rw_wlock(&rctl_lock);
- LIST_FOREACH(link, &p->p_container.c_rule_links, rctl_next) {
- if (link->rctl_rule->hr_subject_type ==
+ LIST_FOREACH(link, &p->p_container.c_rule_links, rrl_next) {
+ if (link->rrl_rule->rr_subject_type ==
RCTL_SUBJECT_TYPE_PROCESS) {
if (newlink == NULL)
goto goaround;
- rctl_rule_acquire(link->rctl_rule);
- newlink->rctl_rule = link->rctl_rule;
- newlink = LIST_NEXT(newlink, rctl_next);
+ rctl_rule_acquire(link->rrl_rule);
+ newlink->rrl_rule = link->rrl_rule;
+ newlink = LIST_NEXT(newlink, rrl_next);
rulecnt--;
}
}
- LIST_FOREACH(link, &newuip->ui_container.c_rule_links, rctl_next) {
+ LIST_FOREACH(link, &newuip->ui_container.c_rule_links, rrl_next) {
if (newlink == NULL)
goto goaround;
- rctl_rule_acquire(link->rctl_rule);
- newlink->rctl_rule = link->rctl_rule;
- newlink = LIST_NEXT(newlink, rctl_next);
+ rctl_rule_acquire(link->rrl_rule);
+ newlink->rrl_rule = link->rrl_rule;
+ newlink = LIST_NEXT(newlink, rrl_next);
rulecnt--;
}
- LIST_FOREACH(link, &newlc->lc_container.c_rule_links, rctl_next) {
+ LIST_FOREACH(link, &newlc->lc_container.c_rule_links, rrl_next) {
if (newlink == NULL)
goto goaround;
- rctl_rule_acquire(link->rctl_rule);
- newlink->rctl_rule = link->rctl_rule;
- newlink = LIST_NEXT(newlink, rctl_next);
+ rctl_rule_acquire(link->rrl_rule);
+ newlink->rrl_rule = link->rrl_rule;
+ newlink = LIST_NEXT(newlink, rrl_next);
rulecnt--;
}
- LIST_FOREACH(link, &newpr->pr_container.c_rule_links, rctl_next) {
+ LIST_FOREACH(link, &newpr->pr_container.c_rule_links, rrl_next) {
if (newlink == NULL)
goto goaround;
- rctl_rule_acquire(link->rctl_rule);
- newlink->rctl_rule = link->rctl_rule;
- newlink = LIST_NEXT(newlink, rctl_next);
+ rctl_rule_acquire(link->rrl_rule);
+ newlink->rrl_rule = link->rrl_rule;
+ newlink = LIST_NEXT(newlink, rrl_next);
rulecnt--;
}
@@ -1514,8 +1514,8 @@
*/
while (!LIST_EMPTY(&p->p_container.c_rule_links)) {
link = LIST_FIRST(&p->p_container.c_rule_links);
- LIST_REMOVE(link, rctl_next);
- rctl_rule_release(link->rctl_rule);
+ LIST_REMOVE(link, rrl_next);
+ rctl_rule_release(link->rrl_rule);
uma_zfree(rctl_rule_link_zone, link);
}
@@ -1527,9 +1527,9 @@
*/
while (!LIST_EMPTY(&newrules)) {
newlink = LIST_FIRST(&newrules);
- LIST_REMOVE(newlink, rctl_next);
+ LIST_REMOVE(newlink, rrl_next);
LIST_INSERT_HEAD(&p->p_container.c_rule_links,
- newlink, rctl_next);
+ newlink, rrl_next);
}
rw_wunlock(&rctl_lock);
@@ -1546,9 +1546,9 @@
*/
while (!LIST_EMPTY(&newrules)) {
newlink = LIST_FIRST(&newrules);
- LIST_REMOVE(newlink, rctl_next);
- if (newlink->rctl_rule != NULL)
- rctl_rule_release(newlink->rctl_rule);
+ LIST_REMOVE(newlink, rrl_next);
+ if (newlink->rrl_rule != NULL)
+ rctl_rule_release(newlink->rrl_rule);
uma_zfree(rctl_rule_link_zone, newlink);
}
@@ -1576,22 +1576,22 @@
/*
* Go through limits applicable to the parent and assign them to the child.
* Rules with 'process' subject have to be duplicated in order to make their
- * hr_subject point to the new process.
+ * rr_subject point to the new process.
*/
- LIST_FOREACH(link, &parent->p_container.c_rule_links, rctl_next) {
- if (link->rctl_rule->hr_subject_type == RCTL_SUBJECT_TYPE_PROCESS) {
- rule = rctl_rule_duplicate(link->rctl_rule, M_NOWAIT);
+ LIST_FOREACH(link, &parent->p_container.c_rule_links, rrl_next) {
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list