public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat
@ 2012-03-21 14:12 Jan Engelhardt
  2012-03-22 21:57 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2012-03-21 14:12 UTC (permalink / raw)
  To: akpm; +Cc: gorcunov, linux-kernel, jengelh

* field 14, 15: clock_t is a long
* field 18, 19: task_nice/task_prio return int
* field 24: get_mm_rss returns unsigned long
* field 36, 37: always 0

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 fs/proc/array.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index c602b8d..1451dd6 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -361,7 +361,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 			struct pid *pid, struct task_struct *task, int whole)
 {
 	unsigned long vsize, eip, esp, wchan = ~0UL;
-	long priority, nice;
+	int priority, nice;
 	int tty_pgrp = -1, tty_nr = 0;
 	sigset_t sigign, sigcatch;
 	char state;
@@ -463,8 +463,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 	start_time = nsec_to_clock_t(start_time);
 
 	seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
-%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
-%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
+%lu %lu %lu %ld %ld %ld %ld %d %d %d 0 %llu %lu %lu %lu %lu %lu %lu %lu \
+%lu %lu %lu %lu %lu %lu 0 0 %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
 		pid_nr_ns(pid, ns),
 		tcomm,
 		state,
@@ -503,8 +503,6 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 		sigign      .sig[0] & 0x7fffffffUL,
 		sigcatch    .sig[0] & 0x7fffffffUL,
 		wchan,
-		0UL,
-		0UL,
 		task->exit_signal,
 		task_cpu(task),
 		task->rt_priority,
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat
  2012-03-21 14:12 [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat Jan Engelhardt
@ 2012-03-22 21:57 ` Andrew Morton
  2012-04-04 13:12   ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2012-03-22 21:57 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: gorcunov, linux-kernel

On Wed, 21 Mar 2012 15:12:16 +0100
Jan Engelhardt <jengelh@medozas.de> wrote:

> * field 14, 15: clock_t is a long
> * field 18, 19: task_nice/task_prio return int
> * field 24: get_mm_rss returns unsigned long
> * field 36, 37: always 0
> 
> ...
>
> --- a/fs/proc/array.c
> +++ b/fs/proc/array.c
> @@ -361,7 +361,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
>  			struct pid *pid, struct task_struct *task, int whole)
>  {
>  	unsigned long vsize, eip, esp, wchan = ~0UL;
> -	long priority, nice;
> +	int priority, nice;
>  	int tty_pgrp = -1, tty_nr = 0;
>  	sigset_t sigign, sigcatch;
>  	char state;
> @@ -463,8 +463,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
>  	start_time = nsec_to_clock_t(start_time);
>  
>  	seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
> -%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
> -%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
> +%lu %lu %lu %ld %ld %ld %ld %d %d %d 0 %llu %lu %lu %lu %lu %lu %lu %lu \
> +%lu %lu %lu %lu %lu %lu 0 0 %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
>  		pid_nr_ns(pid, ns),
>  		tcomm,
>  		state,
> @@ -503,8 +503,6 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
>  		sigign      .sig[0] & 0x7fffffffUL,
>  		sigcatch    .sig[0] & 0x7fffffffUL,
>  		wchan,
> -		0UL,
> -		0UL,
>  		task->exit_signal,
>  		task_cpu(task),
>  		task->rt_priority,

When trying to review this I went completely crosseyed then fell on
the floor.  Which is why this code got ripped out and redone in
linux-next, against which I'll ask you to redo the patch, please.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat
  2012-03-22 21:57 ` Andrew Morton
@ 2012-04-04 13:12   ` Jan Engelhardt
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Engelhardt @ 2012-04-04 13:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: gorcunov, linux-kernel


On Thursday 2012-03-22 22:57, Andrew Morton wrote:
>On Wed, 21 Mar 2012 15:12:16 +0100 Jan Engelhardt wrote:
>> @@ -463,8 +463,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
>>  	start_time = nsec_to_clock_t(start_time);
>>  
>>  	seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
>> -%lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
>> -%lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
>> +%lu %lu %lu %ld %ld %ld %ld %d %d %d 0 %llu %lu %lu %lu %lu %lu %lu %lu \
>> +%lu %lu %lu %lu %lu %lu 0 0 %d %d %u %u %llu %lu %ld %lu %lu %lu\n",
>>  		pid_nr_ns(pid, ns),
>>  		tcomm,
>>  		state,
>
>When trying to review this I went completely crosseyed then fell on
>the floor.  Which is why this code got ripped out and redone in
>linux-next, against which I'll ask you to redo the patch, please.

>From d066116cdffdeac58815f0417bb8f7ed1dba4433 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@medozas.de>
Date: Mon, 19 Mar 2012 20:28:46 +0100
Subject: [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat

- use int, since task_nice()/task_prio() return that
- field 24: get_mm_rss returns unsigned long

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
 fs/proc/array.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/array.c b/fs/proc/array.c
index f9bd395..8e27e53 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -361,7 +361,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 			struct pid *pid, struct task_struct *task, int whole)
 {
 	unsigned long vsize, eip, esp, wchan = ~0UL;
-	long priority, nice;
+	int priority, nice;
 	int tty_pgrp = -1, tty_nr = 0;
 	sigset_t sigign, sigcatch;
 	char state;
@@ -483,7 +483,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
 	seq_put_decimal_ull(m, ' ', 0);
 	seq_put_decimal_ull(m, ' ', start_time);
 	seq_put_decimal_ull(m, ' ', vsize);
-	seq_put_decimal_ll(m, ' ', mm ? get_mm_rss(mm) : 0);
+	seq_put_decimal_ull(m, ' ', mm ? get_mm_rss(mm) : 0);
 	seq_put_decimal_ull(m, ' ', rsslim);
 	seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->start_code : 1) : 0);
 	seq_put_decimal_ull(m, ' ', mm ? (permitted ? mm->end_code : 1) : 0);
-- 
1.7.7


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-04 13:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 14:12 [PATCH] procfs: use more apprioriate types when dumping /proc/N/stat Jan Engelhardt
2012-03-22 21:57 ` Andrew Morton
2012-04-04 13:12   ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox