diff options
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r-- | fs/proc/array.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 1295a00ca316..3f57dac31ba6 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -99,8 +99,8 @@ static inline void task_name(struct seq_file *m, struct task_struct *p) | |||
99 | buf = m->buf + m->count; | 99 | buf = m->buf + m->count; |
100 | 100 | ||
101 | /* Ignore error for now */ | 101 | /* Ignore error for now */ |
102 | string_escape_str(tcomm, &buf, m->size - m->count, | 102 | buf += string_escape_str(tcomm, buf, m->size - m->count, |
103 | ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); | 103 | ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); |
104 | 104 | ||
105 | m->count = buf - m->buf; | 105 | m->count = buf - m->buf; |
106 | seq_putc(m, '\n'); | 106 | seq_putc(m, '\n'); |
@@ -126,6 +126,14 @@ static inline const char *get_task_state(struct task_struct *tsk) | |||
126 | { | 126 | { |
127 | unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; | 127 | unsigned int state = (tsk->state | tsk->exit_state) & TASK_REPORT; |
128 | 128 | ||
129 | /* | ||
130 | * Parked tasks do not run; they sit in __kthread_parkme(). | ||
131 | * Without this check, we would report them as running, which is | ||
132 | * clearly wrong, so we report them as sleeping instead. | ||
133 | */ | ||
134 | if (tsk->state == TASK_PARKED) | ||
135 | state = TASK_INTERRUPTIBLE; | ||
136 | |||
129 | BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array)-1); | 137 | BUILD_BUG_ON(1 + ilog2(TASK_REPORT) != ARRAY_SIZE(task_state_array)-1); |
130 | 138 | ||
131 | return task_state_array[fls(state)]; | 139 | return task_state_array[fls(state)]; |
@@ -188,6 +196,24 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
188 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); | 196 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); |
189 | put_cred(cred); | 197 | put_cred(cred); |
190 | 198 | ||
199 | #ifdef CONFIG_PID_NS | ||
200 | seq_puts(m, "\nNStgid:"); | ||
201 | for (g = ns->level; g <= pid->level; g++) | ||
202 | seq_printf(m, "\t%d", | ||
203 | task_tgid_nr_ns(p, pid->numbers[g].ns)); | ||
204 | seq_puts(m, "\nNSpid:"); | ||
205 | for (g = ns->level; g <= pid->level; g++) | ||
206 | seq_printf(m, "\t%d", | ||
207 | task_pid_nr_ns(p, pid->numbers[g].ns)); | ||
208 | seq_puts(m, "\nNSpgid:"); | ||
209 | for (g = ns->level; g <= pid->level; g++) | ||
210 | seq_printf(m, "\t%d", | ||
211 | task_pgrp_nr_ns(p, pid->numbers[g].ns)); | ||
212 | seq_puts(m, "\nNSsid:"); | ||
213 | for (g = ns->level; g <= pid->level; g++) | ||
214 | seq_printf(m, "\t%d", | ||
215 | task_session_nr_ns(p, pid->numbers[g].ns)); | ||
216 | #endif | ||
191 | seq_putc(m, '\n'); | 217 | seq_putc(m, '\n'); |
192 | } | 218 | } |
193 | 219 | ||
@@ -614,7 +640,9 @@ static int children_seq_show(struct seq_file *seq, void *v) | |||
614 | pid_t pid; | 640 | pid_t pid; |
615 | 641 | ||
616 | pid = pid_nr_ns(v, inode->i_sb->s_fs_info); | 642 | pid = pid_nr_ns(v, inode->i_sb->s_fs_info); |
617 | return seq_printf(seq, "%d ", pid); | 643 | seq_printf(seq, "%d ", pid); |
644 | |||
645 | return 0; | ||
618 | } | 646 | } |
619 | 647 | ||
620 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) | 648 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) |