diff options
Diffstat (limited to 'fs/proc')
| -rw-r--r-- | fs/proc/array.c | 26 | ||||
| -rw-r--r-- | fs/proc/base.c | 82 | ||||
| -rw-r--r-- | fs/proc/fd.c | 27 |
3 files changed, 87 insertions, 48 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 1295a00ca316..fd02a9ebfc30 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'); |
| @@ -188,6 +188,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))); | 188 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); |
| 189 | put_cred(cred); | 189 | put_cred(cred); |
| 190 | 190 | ||
| 191 | #ifdef CONFIG_PID_NS | ||
| 192 | seq_puts(m, "\nNStgid:"); | ||
| 193 | for (g = ns->level; g <= pid->level; g++) | ||
| 194 | seq_printf(m, "\t%d", | ||
| 195 | task_tgid_nr_ns(p, pid->numbers[g].ns)); | ||
| 196 | seq_puts(m, "\nNSpid:"); | ||
| 197 | for (g = ns->level; g <= pid->level; g++) | ||
| 198 | seq_printf(m, "\t%d", | ||
| 199 | task_pid_nr_ns(p, pid->numbers[g].ns)); | ||
| 200 | seq_puts(m, "\nNSpgid:"); | ||
| 201 | for (g = ns->level; g <= pid->level; g++) | ||
| 202 | seq_printf(m, "\t%d", | ||
| 203 | task_pgrp_nr_ns(p, pid->numbers[g].ns)); | ||
| 204 | seq_puts(m, "\nNSsid:"); | ||
| 205 | for (g = ns->level; g <= pid->level; g++) | ||
| 206 | seq_printf(m, "\t%d", | ||
| 207 | task_session_nr_ns(p, pid->numbers[g].ns)); | ||
| 208 | #endif | ||
| 191 | seq_putc(m, '\n'); | 209 | seq_putc(m, '\n'); |
| 192 | } | 210 | } |
| 193 | 211 | ||
| @@ -614,7 +632,9 @@ static int children_seq_show(struct seq_file *seq, void *v) | |||
| 614 | pid_t pid; | 632 | pid_t pid; |
| 615 | 633 | ||
| 616 | pid = pid_nr_ns(v, inode->i_sb->s_fs_info); | 634 | pid = pid_nr_ns(v, inode->i_sb->s_fs_info); |
| 617 | return seq_printf(seq, "%d ", pid); | 635 | seq_printf(seq, "%d ", pid); |
| 636 | |||
| 637 | return 0; | ||
| 618 | } | 638 | } |
| 619 | 639 | ||
| 620 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) | 640 | static void *children_seq_start(struct seq_file *seq, loff_t *pos) |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3f3d7aeb0712..7a3b82f986dd 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, | |||
| 309 | static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, | 311 | static 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 | ||
| 393 | struct limit_names { | 399 | struct 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 | |||
| 2370 | out_unlock: | 2382 | out_unlock: |
| 2371 | mutex_unlock(&task->signal->cred_guard_mutex); | 2383 | mutex_unlock(&task->signal->cred_guard_mutex); |
| 2372 | return result; | 2384 | return result; |
diff --git a/fs/proc/fd.c b/fs/proc/fd.c index 8e5ad83b629a..af84ad04df77 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/security.h> | 8 | #include <linux/security.h> |
| 9 | #include <linux/file.h> | 9 | #include <linux/file.h> |
| 10 | #include <linux/seq_file.h> | 10 | #include <linux/seq_file.h> |
| 11 | #include <linux/fs.h> | ||
| 11 | 12 | ||
| 12 | #include <linux/proc_fs.h> | 13 | #include <linux/proc_fs.h> |
| 13 | 14 | ||
| @@ -48,17 +49,23 @@ static int seq_show(struct seq_file *m, void *v) | |||
| 48 | put_files_struct(files); | 49 | put_files_struct(files); |
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | if (!ret) { | 52 | if (ret) |
| 52 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\nmnt_id:\t%i\n", | 53 | return ret; |
| 53 | (long long)file->f_pos, f_flags, | ||
| 54 | real_mount(file->f_path.mnt)->mnt_id); | ||
| 55 | if (file->f_op->show_fdinfo) | ||
| 56 | file->f_op->show_fdinfo(m, file); | ||
| 57 | ret = seq_has_overflowed(m); | ||
| 58 | fput(file); | ||
| 59 | } | ||
| 60 | 54 | ||
| 61 | return ret; | 55 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\nmnt_id:\t%i\n", |
| 56 | (long long)file->f_pos, f_flags, | ||
| 57 | real_mount(file->f_path.mnt)->mnt_id); | ||
| 58 | |||
| 59 | show_fd_locks(m, file, files); | ||
| 60 | if (seq_has_overflowed(m)) | ||
| 61 | goto out; | ||
| 62 | |||
| 63 | if (file->f_op->show_fdinfo) | ||
| 64 | file->f_op->show_fdinfo(m, file); | ||
| 65 | |||
| 66 | out: | ||
| 67 | fput(file); | ||
| 68 | return 0; | ||
| 62 | } | 69 | } |
| 63 | 70 | ||
| 64 | static int seq_fdinfo_open(struct inode *inode, struct file *file) | 71 | static int seq_fdinfo_open(struct inode *inode, struct file *file) |
