Re: [RFC] Per-thread getrusage

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Roland McGrath
Date: Friday, January 18, 2008 - 6:14 pm

I agree that RUSAGE_THREAD is fine.  (In fact, if you'd pressed me to
remember without looking, I would have assumed we put it in already.)
However, in the implementation, I would keep it cleaner by moving the
identical code from inside the loop under case RUSAGE_SELF into a shared
subfunction, rather than duplicating it.  In fact, here you go (next posting).

As to getting arbitrary other threads' data, there are several problems
there.  Adding a syscall is often more trouble than it's worth.  Ulrich
cited the issues with that as the API.  You also didn't handle compat for
it correctly.  To warrant the code necessary to make this available by
whatever API, I think you need to say some more about what it's needed for.

Off hand, it seems most in keeping with other things to expose this via a
/proc file, i.e. /proc/tgid/task/tid/rusage and (/proc/tgid/rusage for the
RUSAGE_SELF behavior on a foreign process).  There we already have the
infrastructure for dealing with the security issues uniformly with how we
control other similar information.  Personally I tend to prefer a binary
interface, i.e. a virtual file whose contents are struct rusage; for that
you still need to do the extra compat work, since a 32-bit process should
have the 32-bit struct rusage layout in its /proc files.  If you put the
numbers into ascii text as some /proc interfaces do, you don't need any
special considerations for CONFIG_COMPAT.


Thanks,
Roland
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] Per-thread getrusage, Vinay Sridhar, (Thu Jan 17, 1:27 am)
Re: [RFC] Per-thread getrusage, Ulrich Drepper, (Thu Jan 17, 8:42 am)
Re: [RFC] Per-thread getrusage, Roland McGrath, (Fri Jan 18, 6:14 pm)
[PATCH] RUSAGE_THREAD, Roland McGrath, (Fri Jan 18, 6:14 pm)
Re: [PATCH] RUSAGE_THREAD, Ulrich Drepper, (Fri Jan 18, 11:21 pm)
Re: [PATCH] RUSAGE_THREAD, Christoph Hellwig, (Mon Jan 21, 2:55 am)
Re: [PATCH] RUSAGE_THREAD, Michael Kerrisk, (Sat Jan 26, 12:23 am)
Re: [RFC] Per-thread getrusage, Andrew Morton, (Sun Jan 27, 10:52 pm)
Re: [RFC] Per-thread getrusage, Pavel Emelyanov, (Mon Jan 28, 12:48 am)
Re: [RFC] Per-thread getrusage, Sripathi Kodi, (Mon Jan 28, 1:24 am)
Re: [RFC] Per-thread getrusage, Andrew Morton, (Mon Jan 28, 2:10 am)
Re: [RFC] Per-thread getrusage, Andrew Morton, (Mon Jan 28, 2:22 am)
Re: [RFC] Per-thread getrusage, Pavel Emelyanov, (Mon Jan 28, 2:38 am)
Re: [RFC] Per-thread getrusage, Andrew Morton, (Mon Jan 28, 2:45 am)
Re: [RFC] Per-thread getrusage, Pavel Emelyanov, (Mon Jan 28, 2:57 am)
Re: [RFC] Per-thread getrusage, Eric W. Biederman, (Mon Jan 28, 1:43 pm)
Re: [RFC] Per-thread getrusage, Andrew Morton, (Mon Jan 28, 2:57 pm)
Re: [RFC] Per-thread getrusage, Pavel Emelyanov, (Tue Jan 29, 1:17 am)
Re: [RFC] Per-thread getrusage, Pavel Emelyanov, (Tue Jan 29, 1:29 am)