aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c87
1 files changed, 47 insertions, 40 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 88c7de12197b..5e7d2521d496 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -186,51 +186,52 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
186 task_unlock(p); 186 task_unlock(p);
187 rcu_read_unlock(); 187 rcu_read_unlock();
188 188
189 seq_printf(m, 189 seq_printf(m, "State:\t%s", get_task_state(p));
190 "State:\t%s\n" 190
191 "Tgid:\t%d\n" 191 seq_puts(m, "\nTgid:\t");
192 "Ngid:\t%d\n" 192 seq_put_decimal_ull(m, 0, tgid);
193 "Pid:\t%d\n" 193 seq_puts(m, "\nNgid:\t");
194 "PPid:\t%d\n" 194 seq_put_decimal_ull(m, 0, ngid);
195 "TracerPid:\t%d\n" 195 seq_puts(m, "\nPid:\t");
196 "Uid:\t%d\t%d\t%d\t%d\n" 196 seq_put_decimal_ull(m, 0, pid_nr_ns(pid, ns));
197 "Gid:\t%d\t%d\t%d\t%d\n" 197 seq_puts(m, "\nPPid:\t");
198 "FDSize:\t%d\nGroups:\t", 198 seq_put_decimal_ull(m, 0, ppid);
199 get_task_state(p), 199 seq_puts(m, "\nTracerPid:\t");
200 tgid, ngid, pid_nr_ns(pid, ns), ppid, tpid, 200 seq_put_decimal_ull(m, 0, tpid);
201 from_kuid_munged(user_ns, cred->uid), 201 seq_puts(m, "\nUid:");
202 from_kuid_munged(user_ns, cred->euid), 202 seq_put_decimal_ull(m, '\t', from_kuid_munged(user_ns, cred->uid));
203 from_kuid_munged(user_ns, cred->suid), 203 seq_put_decimal_ull(m, '\t', from_kuid_munged(user_ns, cred->euid));
204 from_kuid_munged(user_ns, cred->fsuid), 204 seq_put_decimal_ull(m, '\t', from_kuid_munged(user_ns, cred->suid));
205 from_kgid_munged(user_ns, cred->gid), 205 seq_put_decimal_ull(m, '\t', from_kuid_munged(user_ns, cred->fsuid));
206 from_kgid_munged(user_ns, cred->egid), 206 seq_puts(m, "\nGid:");
207 from_kgid_munged(user_ns, cred->sgid), 207 seq_put_decimal_ull(m, '\t', from_kgid_munged(user_ns, cred->gid));
208 from_kgid_munged(user_ns, cred->fsgid), 208 seq_put_decimal_ull(m, '\t', from_kgid_munged(user_ns, cred->egid));
209 max_fds); 209 seq_put_decimal_ull(m, '\t', from_kgid_munged(user_ns, cred->sgid));
210 210 seq_put_decimal_ull(m, '\t', from_kgid_munged(user_ns, cred->fsgid));
211 seq_puts(m, "\nFDSize:\t");
212 seq_put_decimal_ull(m, 0, max_fds);
213
214 seq_puts(m, "\nGroups:\t");
211 group_info = cred->group_info; 215 group_info = cred->group_info;
212 for (g = 0; g < group_info->ngroups; g++) 216 for (g = 0; g < group_info->ngroups; g++)
213 seq_printf(m, "%d ", 217 seq_put_decimal_ull(m, g ? ' ' : 0, from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
214 from_kgid_munged(user_ns, GROUP_AT(group_info, g)));
215 put_cred(cred); 218 put_cred(cred);
219 /* Trailing space shouldn't have been added in the first place. */
220 seq_putc(m, ' ');
216 221
217#ifdef CONFIG_PID_NS 222#ifdef CONFIG_PID_NS
218 seq_puts(m, "\nNStgid:"); 223 seq_puts(m, "\nNStgid:");
219 for (g = ns->level; g <= pid->level; g++) 224 for (g = ns->level; g <= pid->level; g++)
220 seq_printf(m, "\t%d", 225 seq_put_decimal_ull(m, '\t', task_tgid_nr_ns(p, pid->numbers[g].ns));
221 task_tgid_nr_ns(p, pid->numbers[g].ns));
222 seq_puts(m, "\nNSpid:"); 226 seq_puts(m, "\nNSpid:");
223 for (g = ns->level; g <= pid->level; g++) 227 for (g = ns->level; g <= pid->level; g++)
224 seq_printf(m, "\t%d", 228 seq_put_decimal_ull(m, '\t', task_pid_nr_ns(p, pid->numbers[g].ns));
225 task_pid_nr_ns(p, pid->numbers[g].ns));
226 seq_puts(m, "\nNSpgid:"); 229 seq_puts(m, "\nNSpgid:");
227 for (g = ns->level; g <= pid->level; g++) 230 for (g = ns->level; g <= pid->level; g++)
228 seq_printf(m, "\t%d", 231 seq_put_decimal_ull(m, '\t', task_pgrp_nr_ns(p, pid->numbers[g].ns));
229 task_pgrp_nr_ns(p, pid->numbers[g].ns));
230 seq_puts(m, "\nNSsid:"); 232 seq_puts(m, "\nNSsid:");
231 for (g = ns->level; g <= pid->level; g++) 233 for (g = ns->level; g <= pid->level; g++)
232 seq_printf(m, "\t%d", 234 seq_put_decimal_ull(m, '\t', task_session_nr_ns(p, pid->numbers[g].ns));
233 task_session_nr_ns(p, pid->numbers[g].ns));
234#endif 235#endif
235 seq_putc(m, '\n'); 236 seq_putc(m, '\n');
236} 237}
@@ -299,11 +300,14 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
299 unlock_task_sighand(p, &flags); 300 unlock_task_sighand(p, &flags);
300 } 301 }
301 302
302 seq_printf(m, "Threads:\t%d\n", num_threads); 303 seq_puts(m, "Threads:\t");
303 seq_printf(m, "SigQ:\t%lu/%lu\n", qsize, qlim); 304 seq_put_decimal_ull(m, 0, num_threads);
305 seq_puts(m, "\nSigQ:\t");
306 seq_put_decimal_ull(m, 0, qsize);
307 seq_put_decimal_ull(m, '/', qlim);
304 308
305 /* render them all */ 309 /* render them all */
306 render_sigset_t(m, "SigPnd:\t", &pending); 310 render_sigset_t(m, "\nSigPnd:\t", &pending);
307 render_sigset_t(m, "ShdPnd:\t", &shpending); 311 render_sigset_t(m, "ShdPnd:\t", &shpending);
308 render_sigset_t(m, "SigBlk:\t", &blocked); 312 render_sigset_t(m, "SigBlk:\t", &blocked);
309 render_sigset_t(m, "SigIgn:\t", &ignored); 313 render_sigset_t(m, "SigIgn:\t", &ignored);
@@ -348,17 +352,20 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p)
348static inline void task_seccomp(struct seq_file *m, struct task_struct *p) 352static inline void task_seccomp(struct seq_file *m, struct task_struct *p)
349{ 353{
350#ifdef CONFIG_SECCOMP 354#ifdef CONFIG_SECCOMP
351 seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode); 355 seq_puts(m, "Seccomp:\t");
356 seq_put_decimal_ull(m, 0, p->seccomp.mode);
357 seq_putc(m, '\n');
352#endif 358#endif
353} 359}
354 360
355static inline void task_context_switch_counts(struct seq_file *m, 361static inline void task_context_switch_counts(struct seq_file *m,
356 struct task_struct *p) 362 struct task_struct *p)
357{ 363{
358 seq_printf(m, "voluntary_ctxt_switches:\t%lu\n" 364 seq_puts(m, "voluntary_ctxt_switches:\t");
359 "nonvoluntary_ctxt_switches:\t%lu\n", 365 seq_put_decimal_ull(m, 0, p->nvcsw);
360 p->nvcsw, 366 seq_puts(m, "\nnonvoluntary_ctxt_switches:\t");
361 p->nivcsw); 367 seq_put_decimal_ull(m, 0, p->nivcsw);
368 seq_putc(m, '\n');
362} 369}
363 370
364static void task_cpus_allowed(struct seq_file *m, struct task_struct *task) 371static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)