lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 Apr 2007 11:10:50 -0700
From:	William Lee Irwin III <wli@...omorphy.com>
To:	Eric Dumazet <dada1@...mosbay.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: per-thread rusage

On Wed, 4 Apr 2007 10:29:31 -0700 William Lee Irwin III <wli@...omorphy.com> wrote:
>> It is not now possible for a thread to retrieve its own rusage in
>> isolation. Its rusage is nowhere exposed without being intermixed with
>> that of its sibling threads. This patch adds support for an
>> RUSAGE_THREAD who argument that returns rusage for only the desired
>> thread.

On Wed, Apr 04, 2007 at 07:48:29PM +0200, Eric Dumazet wrote:
> Please check mm, because we now return ru_inblock and ru_oublock as well.
> r->ru_inblock = task_io_get_inblock(p);
> r->ru_oublock = task_io_get_oublock(p);

Respun vs. 2.6.21-rc5-mm4, still untested. Also...

Signed-off-by: William Irwin <bill.irwin@...cle.com>


-- wli


Index: mm-2.6.21-rc5-4/include/linux/resource.h
===================================================================
--- mm-2.6.21-rc5-4.orig/include/linux/resource.h	2007-04-03 23:31:19.000000000 -0700
+++ mm-2.6.21-rc5-4/include/linux/resource.h	2007-04-04 13:08:47.000000000 -0700
@@ -18,7 +18,8 @@
  */
 #define	RUSAGE_SELF	0
 #define	RUSAGE_CHILDREN	(-1)
-#define RUSAGE_BOTH	(-2)		/* sys_wait4() uses this */
+#define RUSAGE_THREAD	(-2)
+#define RUSAGE_BOTH	(-3)		/* sys_wait4() uses this */
 
 struct	rusage {
 	struct timeval ru_utime;	/* user time used */
Index: mm-2.6.21-rc5-4/kernel/sys.c
===================================================================
--- mm-2.6.21-rc5-4.orig/kernel/sys.c	2007-04-03 23:33:27.000000000 -0700
+++ mm-2.6.21-rc5-4/kernel/sys.c	2007-04-04 13:11:17.000000000 -0700
@@ -2074,6 +2074,16 @@
 	}
 
 	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;
 		case RUSAGE_BOTH:
 		case RUSAGE_CHILDREN:
 			utime = p->signal->cutime;
@@ -2131,7 +2141,8 @@
 
 asmlinkage long sys_getrusage(int who, struct rusage __user *ru)
 {
-	if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
+	if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
+						who != RUSAGE_THREAD)
 		return -EINVAL;
 	return getrusage(current, who, ru);
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ