Date: Sun, 16 Jan 2011 18:04:27 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 187865 for review Message-ID: <201101161804.p0GI4RRp091590@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@187865?ac=10 Change 187865 by trasz@trasz_victim on 2011/01/16 18:03:31 Make routine names less confusing. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#55 edit .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#11 edit .. //depot/projects/soc2009/trasz_limits/sys/sys/rctl.h#5 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#55 (text+ko) ==== @@ -311,7 +311,7 @@ mtx_lock(&container_lock); #ifdef RCTL - error = rctl_enforce_proc(p, resource, amount); + error = rctl_enforce(p, resource, amount); if (error && container_resource_deniable(resource)) { SDT_PROBE(container, kernel, rusage, add_failure, p, resource, amount, 0, 0); mtx_unlock(&container_lock); @@ -402,7 +402,7 @@ #endif #ifdef RCTL if (diff > 0) { - error = rctl_enforce_proc(p, resource, diff); + error = rctl_enforce(p, resource, diff); if (error && container_resource_deniable(resource)) { SDT_PROBE(container, kernel, rusage, set_failure, p, resource, amount, 0, 0); return (error); @@ -462,14 +462,15 @@ /* * Returns amount of 'resource' the process 'p' can keep allocated. * Allocating more than that would be denied, unless the resource - * is marked undeniable. + * is marked undeniable. Amount of already allocated resource does + * not matter. */ uint64_t rusage_get_limit(struct proc *p, int resource) { #ifdef RCTL - return (rctl_available_proc(p, resource)); + return (rctl_get_limit(p, resource)); #else return (UINT64_MAX); #endif ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_rctl.c#11 (text+ko) ==== @@ -279,7 +279,7 @@ * be denied, 0 otherwise. */ int -rctl_enforce_proc(struct proc *p, int resource, uint64_t amount) +rctl_enforce(struct proc *p, int resource, uint64_t amount) { struct rctl_rule *rule; struct rctl_rule_link *link; @@ -312,7 +312,7 @@ buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); if (buf == NULL) { - printf("rctl_enforce_proc: out of memory\n"); + printf("rctl_enforce: out of memory\n"); continue; } sbuf_new(&sb, buf, RCTL_LOG_BUFSIZE, SBUF_FIXEDLEN); @@ -343,7 +343,7 @@ rctl_deferred_psignal(p, SIGXFSZ); continue; default: - panic("rctl_enforce_proc: unknown action %d", + panic("rctl_enforce: unknown action %d", rule->rr_action); } } @@ -362,7 +362,7 @@ } uint64_t -rctl_available_proc(struct proc *p, int resource) +rctl_get_limit(struct proc *p, int resource) { struct rctl_rule *rule; struct rctl_rule_link *link; ==== //depot/projects/soc2009/trasz_limits/sys/sys/rctl.h#5 (text+ko) ==== @@ -119,8 +119,8 @@ int rctl_rule_add(struct rctl_rule *rule); int rctl_rule_remove(struct rctl_rule *filter); -int rctl_enforce_proc(struct proc *p, int resource, uint64_t amount); -uint64_t rctl_available_proc(struct proc *p, int resource); +int rctl_enforce(struct proc *p, int resource, uint64_t amount); +uint64_t rctl_get_limit(struct proc *p, int resource); const char *rctl_resource_name(int resource); int rctl_proc_fork(struct proc *parent, struct proc *child); void rctl_proc_exit(struct proc *p);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101161804.p0GI4RRp091590>