patch-1.3.40 linux/fs/proc/array.c
Next file: linux/fs/smbfs/dir.c
Previous file: linux/fs/msdos/namei.c
Back to the patch index
Back to the overall index
-  Lines: 27
 -  Date:
Fri Nov 10 08:15:13 1995
 -  Orig file: 
v1.3.39/linux/fs/proc/array.c
 -  Orig date: 
Thu Nov  9 11:23:51 1995
 
diff -u --recursive --new-file v1.3.39/linux/fs/proc/array.c linux/fs/proc/array.c
@@ -482,10 +482,11 @@
 		tty_pgrp = -1;
 
 	/* scale priority and nice values from timeslices to -20..20 */
+	/* to make it look like a "normal" unix priority/nice value  */
 	priority = tsk->counter;
-	priority = (priority * 10 + DEF_PRIORITY / 2) / DEF_PRIORITY - 20;
+	priority = 20 - (priority * 10 + DEF_PRIORITY / 2) / DEF_PRIORITY;
 	nice = tsk->priority;
-	nice = (nice * 20 + DEF_PRIORITY / 2) / DEF_PRIORITY - 20;
+	nice = 20 - (nice * 20 + DEF_PRIORITY / 2) / DEF_PRIORITY;
 
 	return sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
 %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu \
@@ -507,10 +508,8 @@
 		tsk->stime,
 		tsk->cutime,
 		tsk->cstime,
-		priority,  /* this is the kernel priority ---
-				   subtract 20 in your user-level program. */
-		nice,	   /* this is the nice value ---
-				   subtract 20 in your user-level program. */
+		priority,
+		nice,
 		tsk->timeout,
 		tsk->it_real_value,
 		tsk->start_time,
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this