aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c82
1 files changed, 47 insertions, 35 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a3d6b559178b..093ca14f5701 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -238,13 +238,15 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns,
238 238
239 wchan = get_wchan(task); 239 wchan = get_wchan(task);
240 240
241 if (lookup_symbol_name(wchan, symname) < 0) 241 if (lookup_symbol_name(wchan, symname) < 0) {
242 if (!ptrace_may_access(task, PTRACE_MODE_READ)) 242 if (!ptrace_may_access(task, PTRACE_MODE_READ))
243 return 0; 243 return 0;
244 else 244 seq_printf(m, "%lu", wchan);
245 return seq_printf(m, "%lu", wchan); 245 } else {
246 else 246 seq_printf(m, "%s", symname);
247 return seq_printf(m, "%s", symname); 247 }
248
249 return 0;
248} 250}
249#endif /* CONFIG_KALLSYMS */ 251#endif /* CONFIG_KALLSYMS */
250 252
@@ -309,10 +311,12 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
309static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, 311static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
310 struct pid *pid, struct task_struct *task) 312 struct pid *pid, struct task_struct *task)
311{ 313{
312 return seq_printf(m, "%llu %llu %lu\n", 314 seq_printf(m, "%llu %llu %lu\n",
313 (unsigned long long)task->se.sum_exec_runtime, 315 (unsigned long long)task->se.sum_exec_runtime,
314 (unsigned long long)task->sched_info.run_delay, 316 (unsigned long long)task->sched_info.run_delay,
315 task->sched_info.pcount); 317 task->sched_info.pcount);
318
319 return 0;
316} 320}
317#endif 321#endif
318 322
@@ -387,7 +391,9 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
387 points = oom_badness(task, NULL, NULL, totalpages) * 391 points = oom_badness(task, NULL, NULL, totalpages) *
388 1000 / totalpages; 392 1000 / totalpages;
389 read_unlock(&tasklist_lock); 393 read_unlock(&tasklist_lock);
390 return seq_printf(m, "%lu\n", points); 394 seq_printf(m, "%lu\n", points);
395
396 return 0;
391} 397}
392 398
393struct limit_names { 399struct limit_names {
@@ -432,15 +438,15 @@ static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns,
432 * print the file header 438 * print the file header
433 */ 439 */
434 seq_printf(m, "%-25s %-20s %-20s %-10s\n", 440 seq_printf(m, "%-25s %-20s %-20s %-10s\n",
435 "Limit", "Soft Limit", "Hard Limit", "Units"); 441 "Limit", "Soft Limit", "Hard Limit", "Units");
436 442
437 for (i = 0; i < RLIM_NLIMITS; i++) { 443 for (i = 0; i < RLIM_NLIMITS; i++) {
438 if (rlim[i].rlim_cur == RLIM_INFINITY) 444 if (rlim[i].rlim_cur == RLIM_INFINITY)
439 seq_printf(m, "%-25s %-20s ", 445 seq_printf(m, "%-25s %-20s ",
440 lnames[i].name, "unlimited"); 446 lnames[i].name, "unlimited");
441 else 447 else
442 seq_printf(m, "%-25s %-20lu ", 448 seq_printf(m, "%-25s %-20lu ",
443 lnames[i].name, rlim[i].rlim_cur); 449 lnames[i].name, rlim[i].rlim_cur);
444 450
445 if (rlim[i].rlim_max == RLIM_INFINITY) 451 if (rlim[i].rlim_max == RLIM_INFINITY)
446 seq_printf(m, "%-20s ", "unlimited"); 452 seq_printf(m, "%-20s ", "unlimited");
@@ -462,7 +468,9 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
462{ 468{
463 long nr; 469 long nr;
464 unsigned long args[6], sp, pc; 470 unsigned long args[6], sp, pc;
465 int res = lock_trace(task); 471 int res;
472
473 res = lock_trace(task);
466 if (res) 474 if (res)
467 return res; 475 return res;
468 476
@@ -477,7 +485,8 @@ static int proc_pid_syscall(struct seq_file *m, struct pid_namespace *ns,
477 args[0], args[1], args[2], args[3], args[4], args[5], 485 args[0], args[1], args[2], args[3], args[4], args[5],
478 sp, pc); 486 sp, pc);
479 unlock_trace(task); 487 unlock_trace(task);
480 return res; 488
489 return 0;
481} 490}
482#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */ 491#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */
483 492
@@ -2002,12 +2011,13 @@ static int show_timer(struct seq_file *m, void *v)
2002 notify = timer->it_sigev_notify; 2011 notify = timer->it_sigev_notify;
2003 2012
2004 seq_printf(m, "ID: %d\n", timer->it_id); 2013 seq_printf(m, "ID: %d\n", timer->it_id);
2005 seq_printf(m, "signal: %d/%p\n", timer->sigq->info.si_signo, 2014 seq_printf(m, "signal: %d/%p\n",
2006 timer->sigq->info.si_value.sival_ptr); 2015 timer->sigq->info.si_signo,
2016 timer->sigq->info.si_value.sival_ptr);
2007 seq_printf(m, "notify: %s/%s.%d\n", 2017 seq_printf(m, "notify: %s/%s.%d\n",
2008 nstr[notify & ~SIGEV_THREAD_ID], 2018 nstr[notify & ~SIGEV_THREAD_ID],
2009 (notify & SIGEV_THREAD_ID) ? "tid" : "pid", 2019 (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
2010 pid_nr_ns(timer->it_pid, tp->ns)); 2020 pid_nr_ns(timer->it_pid, tp->ns));
2011 seq_printf(m, "ClockID: %d\n", timer->it_clock); 2021 seq_printf(m, "ClockID: %d\n", timer->it_clock);
2012 2022
2013 return 0; 2023 return 0;
@@ -2352,21 +2362,23 @@ static int do_io_accounting(struct task_struct *task, struct seq_file *m, int wh
2352 2362
2353 unlock_task_sighand(task, &flags); 2363 unlock_task_sighand(task, &flags);
2354 } 2364 }
2355 result = seq_printf(m, 2365 seq_printf(m,
2356 "rchar: %llu\n" 2366 "rchar: %llu\n"
2357 "wchar: %llu\n" 2367 "wchar: %llu\n"
2358 "syscr: %llu\n" 2368 "syscr: %llu\n"
2359 "syscw: %llu\n" 2369 "syscw: %llu\n"
2360 "read_bytes: %llu\n" 2370 "read_bytes: %llu\n"
2361 "write_bytes: %llu\n" 2371 "write_bytes: %llu\n"
2362 "cancelled_write_bytes: %llu\n", 2372 "cancelled_write_bytes: %llu\n",
2363 (unsigned long long)acct.rchar, 2373 (unsigned long long)acct.rchar,
2364 (unsigned long long)acct.wchar, 2374 (unsigned long long)acct.wchar,
2365 (unsigned long long)acct.syscr, 2375 (unsigned long long)acct.syscr,
2366 (unsigned long long)acct.syscw, 2376 (unsigned long long)acct.syscw,
2367 (unsigned long long)acct.read_bytes, 2377 (unsigned long long)acct.read_bytes,
2368 (unsigned long long)acct.write_bytes, 2378 (unsigned long long)acct.write_bytes,
2369 (unsigned long long)acct.cancelled_write_bytes); 2379 (unsigned long long)acct.cancelled_write_bytes);
2380 result = 0;
2381
2370out_unlock: 2382out_unlock:
2371 mutex_unlock(&task->signal->cred_guard_mutex); 2383 mutex_unlock(&task->signal->cred_guard_mutex);
2372 return result; 2384 return result;