diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2014-08-08 17:21:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:22 -0400 |
commit | 1c963eb135075ecc5126c1ef695090cb0aea95c4 (patch) | |
tree | db3009293171d3e163c29dd3ee82371449dbe993 /fs | |
parent | f9ea536ef80d7b3ce531943e2c6aae7c0fedd9bd (diff) |
proc: convert /proc/$PID/limits to seq_file interface
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/proc/base.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 154bbd353b10..1dd692132ede 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -440,12 +440,11 @@ static const struct limit_names lnames[RLIM_NLIMITS] = { | |||
440 | }; | 440 | }; |
441 | 441 | ||
442 | /* Display limits for a process */ | 442 | /* Display limits for a process */ |
443 | static int proc_pid_limits(struct task_struct *task, char *buffer) | 443 | static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns, |
444 | struct pid *pid, struct task_struct *task) | ||
444 | { | 445 | { |
445 | unsigned int i; | 446 | unsigned int i; |
446 | int count = 0; | ||
447 | unsigned long flags; | 447 | unsigned long flags; |
448 | char *bufptr = buffer; | ||
449 | 448 | ||
450 | struct rlimit rlim[RLIM_NLIMITS]; | 449 | struct rlimit rlim[RLIM_NLIMITS]; |
451 | 450 | ||
@@ -457,31 +456,29 @@ static int proc_pid_limits(struct task_struct *task, char *buffer) | |||
457 | /* | 456 | /* |
458 | * print the file header | 457 | * print the file header |
459 | */ | 458 | */ |
460 | count += sprintf(&bufptr[count], "%-25s %-20s %-20s %-10s\n", | 459 | seq_printf(m, "%-25s %-20s %-20s %-10s\n", |
461 | "Limit", "Soft Limit", "Hard Limit", "Units"); | 460 | "Limit", "Soft Limit", "Hard Limit", "Units"); |
462 | 461 | ||
463 | for (i = 0; i < RLIM_NLIMITS; i++) { | 462 | for (i = 0; i < RLIM_NLIMITS; i++) { |
464 | if (rlim[i].rlim_cur == RLIM_INFINITY) | 463 | if (rlim[i].rlim_cur == RLIM_INFINITY) |
465 | count += sprintf(&bufptr[count], "%-25s %-20s ", | 464 | seq_printf(m, "%-25s %-20s ", |
466 | lnames[i].name, "unlimited"); | 465 | lnames[i].name, "unlimited"); |
467 | else | 466 | else |
468 | count += sprintf(&bufptr[count], "%-25s %-20lu ", | 467 | seq_printf(m, "%-25s %-20lu ", |
469 | lnames[i].name, rlim[i].rlim_cur); | 468 | lnames[i].name, rlim[i].rlim_cur); |
470 | 469 | ||
471 | if (rlim[i].rlim_max == RLIM_INFINITY) | 470 | if (rlim[i].rlim_max == RLIM_INFINITY) |
472 | count += sprintf(&bufptr[count], "%-20s ", "unlimited"); | 471 | seq_printf(m, "%-20s ", "unlimited"); |
473 | else | 472 | else |
474 | count += sprintf(&bufptr[count], "%-20lu ", | 473 | seq_printf(m, "%-20lu ", rlim[i].rlim_max); |
475 | rlim[i].rlim_max); | ||
476 | 474 | ||
477 | if (lnames[i].unit) | 475 | if (lnames[i].unit) |
478 | count += sprintf(&bufptr[count], "%-10s\n", | 476 | seq_printf(m, "%-10s\n", lnames[i].unit); |
479 | lnames[i].unit); | ||
480 | else | 477 | else |
481 | count += sprintf(&bufptr[count], "\n"); | 478 | seq_putc(m, '\n'); |
482 | } | 479 | } |
483 | 480 | ||
484 | return count; | 481 | return 0; |
485 | } | 482 | } |
486 | 483 | ||
487 | #ifdef CONFIG_HAVE_ARCH_TRACEHOOK | 484 | #ifdef CONFIG_HAVE_ARCH_TRACEHOOK |
@@ -2558,7 +2555,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2558 | ONE("auxv", S_IRUSR, proc_pid_auxv), | 2555 | ONE("auxv", S_IRUSR, proc_pid_auxv), |
2559 | ONE("status", S_IRUGO, proc_pid_status), | 2556 | ONE("status", S_IRUGO, proc_pid_status), |
2560 | ONE("personality", S_IRUSR, proc_pid_personality), | 2557 | ONE("personality", S_IRUSR, proc_pid_personality), |
2561 | INF("limits", S_IRUGO, proc_pid_limits), | 2558 | ONE("limits", S_IRUGO, proc_pid_limits), |
2562 | #ifdef CONFIG_SCHED_DEBUG | 2559 | #ifdef CONFIG_SCHED_DEBUG |
2563 | REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), | 2560 | REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), |
2564 | #endif | 2561 | #endif |
@@ -2897,7 +2894,7 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2897 | ONE("auxv", S_IRUSR, proc_pid_auxv), | 2894 | ONE("auxv", S_IRUSR, proc_pid_auxv), |
2898 | ONE("status", S_IRUGO, proc_pid_status), | 2895 | ONE("status", S_IRUGO, proc_pid_status), |
2899 | ONE("personality", S_IRUSR, proc_pid_personality), | 2896 | ONE("personality", S_IRUSR, proc_pid_personality), |
2900 | INF("limits", S_IRUGO, proc_pid_limits), | 2897 | ONE("limits", S_IRUGO, proc_pid_limits), |
2901 | #ifdef CONFIG_SCHED_DEBUG | 2898 | #ifdef CONFIG_SCHED_DEBUG |
2902 | REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), | 2899 | REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations), |
2903 | #endif | 2900 | #endif |