diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2014-08-08 17:21:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-08 18:57:23 -0400 |
commit | 6ba51e3751a3543f353a06cd8a6c975bda707c45 (patch) | |
tree | d1ecdd0ed8446ed700147b581f44f4cc91d431fe /fs/proc | |
parent | f6e826ca37a56e103cf45e0658ef293bb6b54c7c (diff) |
proc: convert /proc/$PID/oom_score 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/proc')
-rw-r--r-- | fs/proc/base.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 4bb8d3481970..d0bf0001dfac 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -411,7 +411,8 @@ static const struct file_operations proc_cpuset_operations = { | |||
411 | }; | 411 | }; |
412 | #endif | 412 | #endif |
413 | 413 | ||
414 | static int proc_oom_score(struct task_struct *task, char *buffer) | 414 | static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns, |
415 | struct pid *pid, struct task_struct *task) | ||
415 | { | 416 | { |
416 | unsigned long totalpages = totalram_pages + total_swap_pages; | 417 | unsigned long totalpages = totalram_pages + total_swap_pages; |
417 | unsigned long points = 0; | 418 | unsigned long points = 0; |
@@ -421,7 +422,7 @@ static int proc_oom_score(struct task_struct *task, char *buffer) | |||
421 | points = oom_badness(task, NULL, NULL, totalpages) * | 422 | points = oom_badness(task, NULL, NULL, totalpages) * |
422 | 1000 / totalpages; | 423 | 1000 / totalpages; |
423 | read_unlock(&tasklist_lock); | 424 | read_unlock(&tasklist_lock); |
424 | return sprintf(buffer, "%lu\n", points); | 425 | return seq_printf(m, "%lu\n", points); |
425 | } | 426 | } |
426 | 427 | ||
427 | struct limit_names { | 428 | struct limit_names { |
@@ -2616,7 +2617,7 @@ static const struct pid_entry tgid_base_stuff[] = { | |||
2616 | #ifdef CONFIG_CGROUPS | 2617 | #ifdef CONFIG_CGROUPS |
2617 | REG("cgroup", S_IRUGO, proc_cgroup_operations), | 2618 | REG("cgroup", S_IRUGO, proc_cgroup_operations), |
2618 | #endif | 2619 | #endif |
2619 | INF("oom_score", S_IRUGO, proc_oom_score), | 2620 | ONE("oom_score", S_IRUGO, proc_oom_score), |
2620 | REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), | 2621 | REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), |
2621 | REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), | 2622 | REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), |
2622 | #ifdef CONFIG_AUDITSYSCALL | 2623 | #ifdef CONFIG_AUDITSYSCALL |
@@ -2954,7 +2955,7 @@ static const struct pid_entry tid_base_stuff[] = { | |||
2954 | #ifdef CONFIG_CGROUPS | 2955 | #ifdef CONFIG_CGROUPS |
2955 | REG("cgroup", S_IRUGO, proc_cgroup_operations), | 2956 | REG("cgroup", S_IRUGO, proc_cgroup_operations), |
2956 | #endif | 2957 | #endif |
2957 | INF("oom_score", S_IRUGO, proc_oom_score), | 2958 | ONE("oom_score", S_IRUGO, proc_oom_score), |
2958 | REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), | 2959 | REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), |
2959 | REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), | 2960 | REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations), |
2960 | #ifdef CONFIG_AUDITSYSCALL | 2961 | #ifdef CONFIG_AUDITSYSCALL |