William Lee Irwin III <[email protected]> wrote:
>
> switch (who) {
> + case RUSAGE_THREAD:
> + utime = p->utime;
> + stime = p->stime;
> + r->ru_nvcsw = p->nvcsw;
> + r->ru_nivcsw = p->nivcsw;
> + r->ru_minflt = p->min_flt;
> + r->ru_majflt = p->maj_flt;
> + r->ru_inblock = task_io_get_inblock(p);
> + r->ru_oublock = task_io_get_oublock(p);
> + break;
Minor nit. Perhaps it makes sense to introduce
static void rusage_self(struct rusage *r, struct task_struct *p);
for that. Could be re-used by "do {} while ()" below. Of course, we need
s/=/+=/.
Or, if we think the kernel code is too much clean,
--- kernel/sys.c~ 2007-04-05 12:20:35.000000000 +0400
+++ kernel/sys.c 2007-04-11 00:08:53.000000000 +0400
@@ -2097,6 +2097,7 @@ static void k_getrusage(struct task_stru
r->ru_majflt += p->signal->maj_flt;
r->ru_inblock += p->signal->inblock;
r->ru_oublock += p->signal->oublock;
+ case RUSAGE_THREAD:
t = p;
do {
utime = cputime_add(utime, t->utime);
@@ -2107,7 +2108,9 @@ static void k_getrusage(struct task_stru
r->ru_majflt += t->maj_flt;
r->ru_inblock += task_io_get_inblock(t);
r->ru_oublock += task_io_get_oublock(t);
- t = next_thread(t);
+
+ if (who != RUSAGE_THREAD)
+ t = next_thread(t);
} while (t != p);
break;
Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]