2002-10-06 19:39:45

by Robert Love

[permalink] [raw]
Subject: [PATCH] 2.4: export scheduling information from /proc

Menacing Marcelo,

Attached patch exports scheduling policy and real-time priority from
/proc/<pid>/stats.

This code is in 2.4-ac and 2.5.

This does _not_ break previous versions of procps -- there is no harm
and it is fully backward compatible. New versions, starting with 2.0.8,
can parse this information.

Patch is against 2.4.20-pre9. Please, apply.

Robert Love

diff -urN linux-2.4.20-pre9/fs/proc/array.c linux/fs/proc/array.c
--- linux-2.4.20-pre9/fs/proc/array.c 2002-10-06 14:57:17.000000000 -0400
+++ linux/fs/proc/array.c 2002-10-06 15:02:53.000000000 -0400
@@ -347,7 +347,7 @@
read_unlock(&tasklist_lock);
res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
%lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
-%lu %lu %lu %lu %lu %lu %lu %lu %d %d\n",
+%lu %lu %lu %lu %lu %lu %lu %lu %d %d %lu %lu\n",
task->pid,
task->comm,
state,
@@ -390,7 +390,9 @@
task->nswap,
task->cnswap,
task->exit_signal,
- task->processor);
+ task->processor,
+ task->rt_priority,
+ task->policy);
if(mm)
mmput(mm);
return res;