Skip to contentSkip to conversation

procfs: fix the output format in /proc/PID/wchan

PATCH In review Yafang Shao 3 participants 6 messages Nov 19, 2018 – Nov 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 procfs: fix the output format in /proc/PID/wchan

Just add the missing newline.

---
 fs/proc/base.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/base.c +2 -1
index ce34654..d7f49fb 100644
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 	wchan = get_wchan(task);
 	if (wchan && !lookup_symbol_name(wchan, symname)) {
 		seq_puts(m, symname);
+		seq_putc(m, '\n');
 		return 0;
 	}
 
 print0:
-	seq_putc(m, '0');
+	seq_puts(m, "0\n");
 	return 0;
 }
 #endif /* CONFIG_KALLSYMS */
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 10 lines · On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <[email protected]> wrote:

Just add the missing newline.

...

fs/proc/base.c +0 -0
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 	wchan = get_wchan(task);
 	if (wchan && !lookup_symbol_name(wchan, symname)) {
 		seq_puts(m, symname);

fs/proc/base.c static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, · line 381

Quoted 10 lines
fs/proc/base.c +2 -1
+		seq_putc(m, '\n');
 		return 0;
 	}
 
 print0:
-	seq_putc(m, '0');
+	seq_puts(m, "0\n");
 	return 0;
 }
 #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output? The changelog should explain such things, please.

Providing example output with the patch unapplied and then with the patch applied would help us to understand the patch's effect.

Thanks.

#2 lore raw
Quoted 16 lines · Andrew Morton
Quoted 14 lines · On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <[email protected]> wrote:

Just add the missing newline.

...

fs/proc/base.c +1 -0
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
 	wchan = get_wchan(task);
 	if (wchan && !lookup_symbol_name(wchan, symname)) {
 		seq_puts(m, symname);
+		seq_putc(m, '\n');
 		return 0;
 	}
 
Quoted 9 lines

fs/proc/base.c static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, · line 381

Quoted 6 lines
fs/proc/base.c +1 -1
 print0:
-	seq_putc(m, '0');
+	seq_puts(m, "0\n");
 	return 0;
 }
 #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output? The changelog should explain such things, please.

It is just newline to make "cat /proc/*/wchan" output look cool. But newline can break something.

#3 lore raw
Quoted 28 lines · Alexey Dobriyan
Quoted 16 lines · Andrew Morton
Quoted 14 lines · On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <[email protected]> wrote:

Just add the missing newline.

...

fs/proc/base.c +1 -0
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
    wchan = get_wchan(task);
    if (wchan && !lookup_symbol_name(wchan, symname)) {
            seq_puts(m, symname);
+           seq_putc(m, '\n');
            return 0;
    }
 
Quoted 9 lines

fs/proc/base.c static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, · line 381

Quoted 6 lines
fs/proc/base.c +1 -1
 print0:
-   seq_putc(m, '0');
+   seq_puts(m, "0\n");
    return 0;
 }
 #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output? The changelog should explain such things, please.

Quoted 2 lines

It is just newline to make "cat /proc/*/wchan" output look cool. But newline can break something.

Could you pls. show some examples for what the newline may break ?

Thanks
Yafang

#4 lore raw
Quoted 29 lines · Yafang Shao
Quoted 28 lines · Alexey Dobriyan
Quoted 25 lines · Andrew Morton
Quoted 10 lines · On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <[email protected]> wrote:

Just add the missing newline.

...

fs/proc/base.c +0 -0
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
    wchan = get_wchan(task);
    if (wchan && !lookup_symbol_name(wchan, symname)) {
            seq_puts(m, symname);

fs/proc/base.c static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, · line 381

Quoted 10 lines
fs/proc/base.c +2 -1
+           seq_putc(m, '\n');
            return 0;
    }
 
 print0:
-   seq_putc(m, '0');
+   seq_puts(m, "0\n");
    return 0;
 }
 #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output? The changelog should explain such things, please.

Quoted 4 lines
Quoted 2 lines

It is just newline to make "cat /proc/*/wchan" output look cool. But newline can break something.

Could you pls. show some examples for what the newline may break ?

	char buf[16];
	rv = read(fd, buf, sizeof(buf));
	assert(rv == 1);
#5 lore raw
Quoted 31 lines · Alexey Dobriyan
Quoted 29 lines · Yafang Shao
Quoted 28 lines · Alexey Dobriyan
Quoted 25 lines · Andrew Morton
Quoted 10 lines · On Mon, 19 Nov 2018 19:17:52 +0800 Yafang Shao <[email protected]> wrote:

Just add the missing newline.

...

fs/proc/base.c +0 -0
@@ -370,11 +370,12 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
    wchan = get_wchan(task);
    if (wchan && !lookup_symbol_name(wchan, symname)) {
            seq_puts(m, symname);

fs/proc/base.c static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, · line 381

Quoted 10 lines
fs/proc/base.c +2 -1
+           seq_putc(m, '\n');
            return 0;
    }
 
 print0:
-   seq_putc(m, '0');
+   seq_puts(m, "0\n");
    return 0;
 }
 #endif /* CONFIG_KALLSYMS */

What is presently wrong with the wchan output? The changelog should explain such things, please.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It is just newline to make "cat /proc/*/wchan" output look cool. But newline can break something.

Could you pls. show some examples for what the newline may break ?

        char buf[16];
        rv = read(fd, buf, sizeof(buf));
        assert(rv == 1);

That's really a break, so we can't apply this patch.

Hi Andrew,
I found that you have applied this patch to -mm tree, could you pls. help revert it as it may break something ?

Thanks
Yafang