PERFORCE change 181132 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Sun Jul 18 11:19:28 UTC 2010
http://p4web.freebsd.org/@@181132?ac=10
Change 181132 by trasz at trasz_victim on 2010/07/18 11:19:11
Rename RUSAGE_ constants to match RLIMIT_ ones, to avoid confusion.
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#14 edit
.. //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#8 edit
.. //depot/projects/soc2009/trasz_limits/sys/i386/linux/imgact_linux.c#7 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_aout.c#8 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#13 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/imgact_gzip.c#6 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#25 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#15 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#23 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#19 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#88 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#40 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#20 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/vfs_vnops.c#18 edit
.. //depot/projects/soc2009/trasz_limits/sys/sys/container.h#8 edit
.. //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#18 edit
.. //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#8 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/compat/linux/linux_misc.c#14 (text+ko) ====
@@ -364,7 +364,7 @@
error = ENOMEM;
goto cleanup;
}
- error = rusage_set(td->td_proc, RUSAGE_DATASIZE,
+ error = rusage_set(td->td_proc, RUSAGE_DATA,
a_out->a_data + bss_size);
if (error) {
error = ENOMEM;
==== //depot/projects/soc2009/trasz_limits/sys/compat/svr4/imgact_svr4.c#8 (text+ko) ====
@@ -110,7 +110,7 @@
#ifdef CONTAINERS
if (a_out->a_text > maxtsiz)
return (ENOMEM);
- error = rusage_set(imgp->proc, RUSAGE_DATASIZE,
+ error = rusage_set(imgp->proc, RUSAGE_DATA,
a_out->a_data + bss_size);
if (error)
return (ENOMEM);
==== //depot/projects/soc2009/trasz_limits/sys/i386/linux/imgact_linux.c#7 (text+ko) ====
@@ -108,7 +108,7 @@
#ifdef CONTAINERS
if (a_out->a_text > maxtsiz)
return (ENOMEM);
- error = rusage_set(imgp->proc, RUSAGE_DATASIZE,
+ error = rusage_set(imgp->proc, RUSAGE_DATA,
a_out->a_data + bss_size);
if (error)
return (ENOMEM);
==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_aout.c#8 (text+ko) ====
@@ -189,7 +189,7 @@
if (/* text can't exceed maximum text size */
a_out->a_text > maxtsiz)
return (ENOMEM);
- error = rusage_set(imgp->proc, RUSAGE_DATASIZE,
+ error = rusage_set(imgp->proc, RUSAGE_DATA,
a_out->a_data + bss_size);
if (error)
return (ENOMEM);
==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_elf.c#13 (text+ko) ====
@@ -875,11 +875,11 @@
#ifdef CONTAINERS
if (text_size > maxtsiz)
return (ENOMEM);
- error = rusage_set(imgp->proc, RUSAGE_DATASIZE,
+ error = rusage_set(imgp->proc, RUSAGE_DATA,
data_size);
if (error)
return (ENOMEM);
- error = rusage_set(imgp->proc, RUSAGE_VMEMORYUSE,
+ error = rusage_set(imgp->proc, RUSAGE_VMEM,
total_size);
if (error)
return (ENOMEM);
==== //depot/projects/soc2009/trasz_limits/sys/kern/imgact_gzip.c#6 (text+ko) ====
@@ -216,7 +216,7 @@
gz->where = __LINE__;
return (ENOMEM);
}
- error = rusage_set(gz->ip->proc, RUSAGE_DATASIZE,
+ error = rusage_set(gz->ip->proc, RUSAGE_DATA,
gz->a_out.a_data + gz->bss_size);
if (error)
return (ENOMEM);
==== //depot/projects/soc2009/trasz_limits/sys/kern/init_main.c#25 (text+ko) ====
@@ -566,7 +566,7 @@
*/
(void)chgproccnt(p->p_ucred->cr_ruidinfo, 1, 0);
#ifdef CONTAINERS
- error = rusage_add(p, RUSAGE_MAXPROCESSES, 1);
+ error = rusage_add(p, RUSAGE_NPROC, 1);
KASSERT(error == 0, ("rusage_add failed"));
#endif
}
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#15 (text+ko) ====
@@ -421,7 +421,7 @@
{
switch (resource) {
- case RUSAGE_MAXPROCESSES:
+ case RUSAGE_NPROC:
return (0);
default:
return (1);
@@ -514,9 +514,9 @@
/*
* XXX: Free these three some other way.
*/
- rusage_set(p, RUSAGE_FILESIZE, 0);
- rusage_set(p, RUSAGE_COREDUMPSIZE, 0);
- rusage_set(p, RUSAGE_PTY, 0);
+ rusage_set(p, RUSAGE_FSIZE, 0);
+ rusage_set(p, RUSAGE_CORE, 0);
+ rusage_set(p, RUSAGE_NPTS, 0);
#ifdef HRL
hrl_proc_exit(p);
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_exit.c#23 (text+ko) ====
@@ -768,7 +768,7 @@
*/
(void)chgproccnt(p->p_ucred->cr_ruidinfo, -1, 0);
#ifdef CONTAINERS
- rusage_sub(p->p_pptr, RUSAGE_MAXPROCESSES, 1);
+ rusage_sub(p->p_pptr, RUSAGE_NPROC, 1);
/*
* Destroy resource container associated with the process.
@@ -936,9 +936,9 @@
return;
#ifdef CONTAINERS
- rusage_sub(child->p_pptr, RUSAGE_MAXPROCESSES, 1);
+ rusage_sub(child->p_pptr, RUSAGE_NPROC, 1);
/* XXX: What about return value? */
- rusage_add(parent, RUSAGE_MAXPROCESSES, 1);
+ rusage_add(parent, RUSAGE_NPROC, 1);
#endif
PROC_LOCK(child->p_pptr);
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_fork.c#19 (text+ko) ====
@@ -225,7 +225,7 @@
p1 = td->td_proc;
#ifdef CONTAINERS
- error = rusage_add(p1, RUSAGE_MAXPROCESSES, 1);
+ error = rusage_add(p1, RUSAGE_NPROC, 1);
if (error)
return (error);
#endif
@@ -241,7 +241,7 @@
if (thread_single(SINGLE_BOUNDARY)) {
PROC_UNLOCK(p1);
#ifdef CONTAINERS
- rusage_sub(p1, RUSAGE_MAXPROCESSES, 1);
+ rusage_sub(p1, RUSAGE_NPROC, 1);
#endif
return (ERESTART);
}
@@ -278,7 +278,7 @@
*procp = NULL;
#ifdef CONTAINERS
if (error)
- rusage_sub(p1, RUSAGE_MAXPROCESSES, 1);
+ rusage_sub(p1, RUSAGE_NPROC, 1);
#endif
return (error);
}
@@ -827,7 +827,7 @@
uma_zfree(proc_zone, newproc);
pause("fork", hz / 2);
#ifdef CONTAINERS
- rusage_sub(p1, RUSAGE_MAXPROCESSES, 1);
+ rusage_sub(p1, RUSAGE_NPROC, 1);
#endif
return (error);
}
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#88 (text+ko) ====
@@ -90,18 +90,18 @@
{ NULL, -1 }};
static struct dict resourcenames[] = {
- { "cputime", RUSAGE_CPUTIME },
- { "filesize", RUSAGE_FILESIZE },
- { "datasize", RUSAGE_DATASIZE },
- { "stacksize", RUSAGE_STACKSIZE },
- { "coredumpsize", RUSAGE_COREDUMPSIZE },
- { "memoryuse", RUSAGE_MEMORYUSE },
- { "memorylocked", RUSAGE_MEMORYLOCKED },
- { "maxprocesses", RUSAGE_MAXPROCESSES },
- { "filedescriptors", RUSAGE_FILEDESCRIPTORS },
+ { "cpu", RUSAGE_CPU },
+ { "fsize", RUSAGE_FSIZE },
+ { "data", RUSAGE_DATA },
+ { "stack", RUSAGE_STACK },
+ { "core", RUSAGE_CORE },
+ { "rss", RUSAGE_RSS },
+ { "memlock", RUSAGE_MEMLOCK },
+ { "nproc", RUSAGE_NPROC },
+ { "nofile", RUSAGE_NOFILE },
{ "sbsize", RUSAGE_SBSIZE },
- { "vmemoryuse", RUSAGE_VMEMORYUSE },
- { "pty", RUSAGE_PTY },
+ { "vmem", RUSAGE_VMEM },
+ { "npts", RUSAGE_NPTS },
{ "swap", RUSAGE_SWAP },
{ NULL, -1 }};
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_resource.c#40 (text+ko) ====
@@ -665,34 +665,34 @@
switch (which) {
case RLIMIT_CPU:
- rule->hr_resource = RUSAGE_CPUTIME;
+ rule->hr_resource = RUSAGE_CPU;
rule->hr_action = HRL_ACTION_SIGXCPU;
break;
case RLIMIT_FSIZE:
- rule->hr_resource = RUSAGE_FILESIZE;
+ rule->hr_resource = RUSAGE_FSIZE;
break;
case RLIMIT_DATA:
- rule->hr_resource = RUSAGE_DATASIZE;
+ rule->hr_resource = RUSAGE_DATA;
break;
case RLIMIT_STACK:
- rule->hr_resource = RUSAGE_STACKSIZE;
+ rule->hr_resource = RUSAGE_STACK;
rule->hr_action = HRL_ACTION_SIGSEGV;
break;
case RLIMIT_CORE:
- rule->hr_resource = RUSAGE_COREDUMPSIZE;
+ rule->hr_resource = RUSAGE_CORE;
break;
case RLIMIT_RSS:
- rule->hr_resource = RUSAGE_MEMORYUSE;
+ rule->hr_resource = RUSAGE_RSS;
break;
case RLIMIT_MEMLOCK:
- rule->hr_resource = RUSAGE_MEMORYLOCKED;
+ rule->hr_resource = RUSAGE_MEMLOCK;
break;
case RLIMIT_NPROC:
- rule->hr_resource = RUSAGE_MAXPROCESSES;
+ rule->hr_resource = RUSAGE_NPROC;
rule->hr_per = HRL_SUBJECT_TYPE_USER;
break;
case RLIMIT_NOFILE:
- rule->hr_resource = RUSAGE_FILEDESCRIPTORS;
+ rule->hr_resource = RUSAGE_NOFILE;
rule->hr_action = HRL_ACTION_SIGXFSZ;
break;
case RLIMIT_SBSIZE:
@@ -700,10 +700,10 @@
rule->hr_per = HRL_SUBJECT_TYPE_USER;
break;
case RLIMIT_VMEM:
- rule->hr_resource = RUSAGE_VMEMORYUSE;
+ rule->hr_resource = RUSAGE_VMEM;
break;
case RLIMIT_NPTS:
- rule->hr_resource = RUSAGE_PTY;
+ rule->hr_resource = RUSAGE_NPTS;
rule->hr_per = HRL_SUBJECT_TYPE_USER;
break;
case RLIMIT_SWAP:
==== //depot/projects/soc2009/trasz_limits/sys/kern/tty_pts.c#20 (text+ko) ====
@@ -577,7 +577,7 @@
tty_rel_gone(tp);
#ifdef CONTAINERS
- rusage_sub(td->td_proc, RUSAGE_PTY, 1);
+ rusage_sub(td->td_proc, RUSAGE_NPTS, 1);
#endif
/*
@@ -725,7 +725,7 @@
/* Resource limiting. */
#ifdef CONTAINERS
- ok = !rusage_add(p, RUSAGE_PTY, 1);
+ ok = !rusage_add(p, RUSAGE_NPTS, 1);
if (!ok)
return (EAGAIN);
#endif
@@ -734,7 +734,7 @@
PROC_UNLOCK(p);
if (!ok) {
#ifdef CONTAINERS
- rusage_sub(p, RUSAGE_PTY, 1);
+ rusage_sub(p, RUSAGE_NPTS, 1);
#endif
return (EAGAIN);
}
@@ -743,7 +743,7 @@
unit = alloc_unr(pts_pool);
if (unit < 0) {
#ifdef CONTAINERS
- rusage_sub(p, RUSAGE_PTY, 1);
+ rusage_sub(p, RUSAGE_NPTS, 1);
#endif
chgptscnt(uid, -1, 0);
return (EAGAIN);
@@ -783,7 +783,7 @@
/* Resource limiting. */
#ifdef CONTAINERS
- ok = !rusage_add(p, RUSAGE_PTY, 1);
+ ok = !rusage_add(p, RUSAGE_NPTS, 1);
if (!ok)
return (EAGAIN);
#endif
@@ -792,7 +792,7 @@
PROC_UNLOCK(p);
if (!ok) {
#ifdef CONTAINERS
- rusage_sub(p, RUSAGE_PTY, 1);
+ rusage_sub(p, RUSAGE_NPTS, 1);
#endif
return (EAGAIN);
}
==== //depot/projects/soc2009/trasz_limits/sys/kern/vfs_vnops.c#18 (text+ko) ====
@@ -1348,7 +1348,7 @@
if (vp->v_type != VREG || td == NULL)
return (0);
#ifdef CONTAINERS
- if (rusage_set(td->td_proc, RUSAGE_FILESIZE,
+ if (rusage_set(td->td_proc, RUSAGE_FSIZE,
(uoff_t)uio->uio_offset + uio->uio_resid))
return (EFBIG);
#else
==== //depot/projects/soc2009/trasz_limits/sys/sys/container.h#8 (text+ko) ====
@@ -52,19 +52,19 @@
#define CONTAINER_PARENTS_MAX 3
#define RUSAGE_UNDEFINED -1
-#define RUSAGE_CPUTIME 0x0000
-#define RUSAGE_FILESIZE 0x0001
-#define RUSAGE_DATASIZE 0x0002
-#define RUSAGE_STACKSIZE 0x0003
-#define RUSAGE_COREDUMPSIZE 0x0004
-#define RUSAGE_MEMORYUSE 0x0005
-#define RUSAGE_MEMORYLOCKED 0x0006
-#define RUSAGE_MAXPROCESSES 0x0007
-#define RUSAGE_FILEDESCRIPTORS 0x0008
-#define RUSAGE_SBSIZE 0x0009
-#define RUSAGE_VMEMORYUSE 0x000a
-#define RUSAGE_PTY 0x000b
-#define RUSAGE_SWAP 0x000c
+#define RUSAGE_CPU 0
+#define RUSAGE_FSIZE 1
+#define RUSAGE_DATA 2
+#define RUSAGE_STACK 3
+#define RUSAGE_CORE 4
+#define RUSAGE_RSS 5
+#define RUSAGE_MEMLOCK 6
+#define RUSAGE_NPROC 7
+#define RUSAGE_NOFILE 8
+#define RUSAGE_SBSIZE 9
+#define RUSAGE_VMEM 10
+#define RUSAGE_NPTS 11
+#define RUSAGE_SWAP 12
#define RUSAGE_MAX RUSAGE_SWAP
/*
==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_map.c#18 (text+ko) ====
@@ -413,11 +413,11 @@
vmspace_dofree(vm);
}
#ifdef CONTAINERS
- rusage_set(p, RUSAGE_DATASIZE, 0);
- rusage_set(p, RUSAGE_STACKSIZE, 0);
- rusage_set(p, RUSAGE_MEMORYUSE, 0);
- rusage_set(p, RUSAGE_MEMORYLOCKED, 0);
- rusage_set(p, RUSAGE_VMEMORYUSE, 0);
+ rusage_set(p, RUSAGE_DATA, 0);
+ rusage_set(p, RUSAGE_STACK, 0);
+ rusage_set(p, RUSAGE_RSS, 0);
+ rusage_set(p, RUSAGE_MEMLOCK, 0);
+ rusage_set(p, RUSAGE_VMEM, 0);
#endif
}
==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_unix.c#8 (text+ko) ====
@@ -95,7 +95,7 @@
old = base + ctob(vm->vm_dsize);
if (new > base) {
#ifdef CONTAINERS
- error = rusage_set(td->td_proc, RUSAGE_DATASIZE,
+ error = rusage_set(td->td_proc, RUSAGE_DATA,
new - base);
if (error) {
error = ENOMEM;
@@ -126,7 +126,7 @@
}
if (new > old) {
#ifdef CONTAINERS
- error = rusage_set(td->td_proc, RUSAGE_VMEMORYUSE,
+ error = rusage_set(td->td_proc, RUSAGE_VMEM,
vm->vm_map.size + (new - old));
if (error) {
error = ENOMEM;
More information about the p4-projects
mailing list