Skip to contentSkip to conversation

2.6.24-rc4-mm1 and /proc/<pid>/status Name: field

DISCUSSION Zan Lynx 3 participants 3 messages Dec 7, 2007 – Dec 8, 2007 Proc filesystem

lore
Share & tools
lore

Zan Lynx

author
#0 lore raw

Today I noticed pgrep doesn't work. It seems the reason is a missing
Name: tag in the status file for a process in /proc.

# cat /proc/1/status
init
State:  S (sleeping)
Tgid:   1
Pid:    1
PPid:   0
TracerPid:      0
...etc, etc...

This is supposed to look like:

# cat /proc/1/status
Name:	init
State:	S (sleeping)
Tgid:	1
Pid:	1
PPid:	0
TracerPid:	0
...
Signature · 1 line
Zan Lynx <[email protected]>
#1 lore raw
Quoted 13 lines · On Fri, 07 Dec 2007 20:26:43 +0000 Zan Lynx <[email protected]> wrote:

Today I noticed pgrep doesn't work. It seems the reason is a missing
Name: tag in the status file for a process in /proc.

# cat /proc/1/status
init
State:  S (sleeping)
Tgid:   1
Pid:    1
PPid:   0
TracerPid:      0
...etc, etc...

This is supposed to look like:

Quoted 9 lines
# cat /proc/1/status
Name:	init
State:	S (sleeping)
Tgid:	1
Pid:	1
PPid:	0
TracerPid:	0
...

Thanks. Two (more) bugs in proc-seqfile-convert-proc_pid_status-to-properly-handle-pid-namespaces.patch

fs/proc/array.c renamed from fs/proc/array.c~proc-seqfile-convert-proc_pid_status-to-properly-handle-pid-namespaces-fix-3 +1 -1
@@ -98,9 +98,9 @@ static inline void task_name(struct seq_
 
 	get_task_comm(tcomm, p);
 
+	seq_printf(m, "Name:\t");
 	end = m->buf + m->size;
 	buf = m->buf + m->count;
-	seq_printf(m, "Name:\n");
 	name = tcomm;
 	i = sizeof(tcomm);
 	while (i && (buf < end)) {

_

#2 lore raw
Quoted 26 lines · Andrew Morton
Quoted 13 lines · On Fri, 07 Dec 2007 20:26:43 +0000 Zan Lynx <[email protected]> wrote:

Today I noticed pgrep doesn't work. It seems the reason is a missing
Name: tag in the status file for a process in /proc.

# cat /proc/1/status
init
State:  S (sleeping)
Tgid:   1
Pid:    1
PPid:   0
TracerPid:      0
...etc, etc...

This is supposed to look like:

Quoted 9 lines
# cat /proc/1/status
Name:	init
State:	S (sleeping)
Tgid:	1
Pid:	1
PPid:	0
TracerPid:	0
...
Quoted 2 lines

Thanks. Two (more) bugs in proc-seqfile-convert-proc_pid_status-to-properly-handle-pid-namespaces.patch

Doh! How did I get that one confused?

Thanks.
Eric

Quoted 16 lines

---
a/fs/proc/array.c~proc-seqfile-convert-proc_pid_status-to-properly-handle-pid-namespaces-fix-3 +++ a/fs/proc/array.c

fs/proc/array.c renamed from fs/proc/array.c~proc-seqfile-convert-proc_pid_status-to-properly-handle-pid-namespaces-fix-3 +1 -1
@@ -98,9 +98,9 @@ static inline void task_name(struct seq_
 
 	get_task_comm(tcomm, p);
 
+	seq_printf(m, "Name:\t");
 	end = m->buf + m->size;
 	buf = m->buf + m->count;
-	seq_printf(m, "Name:\n");
 	name = tcomm;
 	i = sizeof(tcomm);
 	while (i && (buf < end)) {

_