Commit a56d3fc7 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Linus Torvalds

seqfile convert proc_pid_statm

This conversion is just for code cleanliness, uniformity, and general safety.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ee992744
...@@ -563,7 +563,8 @@ int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, ...@@ -563,7 +563,8 @@ int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
return do_task_stat(m, ns, pid, task, 1); return do_task_stat(m, ns, pid, task, 1);
} }
int proc_pid_statm(struct task_struct *task, char *buffer) int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task)
{ {
int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0; int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0;
struct mm_struct *mm = get_task_mm(task); struct mm_struct *mm = get_task_mm(task);
...@@ -572,7 +573,8 @@ int proc_pid_statm(struct task_struct *task, char *buffer) ...@@ -572,7 +573,8 @@ int proc_pid_statm(struct task_struct *task, char *buffer)
size = task_statm(mm, &shared, &text, &data, &resident); size = task_statm(mm, &shared, &text, &data, &resident);
mmput(mm); mmput(mm);
} }
seq_printf(m, "%d %d %d %d %d %d %d\n",
size, resident, shared, text, lib, data, 0);
return sprintf(buffer, "%d %d %d %d %d %d %d\n", return 0;
size, resident, shared, text, lib, data, 0);
} }
...@@ -2281,7 +2281,7 @@ static const struct pid_entry tgid_base_stuff[] = { ...@@ -2281,7 +2281,7 @@ static const struct pid_entry tgid_base_stuff[] = {
#endif #endif
INF("cmdline", S_IRUGO, pid_cmdline), INF("cmdline", S_IRUGO, pid_cmdline),
ONE("stat", S_IRUGO, tgid_stat), ONE("stat", S_IRUGO, tgid_stat),
INF("statm", S_IRUGO, pid_statm), ONE("statm", S_IRUGO, pid_statm),
REG("maps", S_IRUGO, maps), REG("maps", S_IRUGO, maps),
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
REG("numa_maps", S_IRUGO, numa_maps), REG("numa_maps", S_IRUGO, numa_maps),
...@@ -2612,7 +2612,7 @@ static const struct pid_entry tid_base_stuff[] = { ...@@ -2612,7 +2612,7 @@ static const struct pid_entry tid_base_stuff[] = {
#endif #endif
INF("cmdline", S_IRUGO, pid_cmdline), INF("cmdline", S_IRUGO, pid_cmdline),
ONE("stat", S_IRUGO, tid_stat), ONE("stat", S_IRUGO, tid_stat),
INF("statm", S_IRUGO, pid_statm), ONE("statm", S_IRUGO, pid_statm),
REG("maps", S_IRUGO, maps), REG("maps", S_IRUGO, maps),
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
REG("numa_maps", S_IRUGO, numa_maps), REG("numa_maps", S_IRUGO, numa_maps),
......
...@@ -54,7 +54,8 @@ extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns, ...@@ -54,7 +54,8 @@ extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns, extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task); struct pid *pid, struct task_struct *task);
extern int proc_pid_status(struct task_struct *, char *); extern int proc_pid_status(struct task_struct *, char *);
extern int proc_pid_statm(struct task_struct *, char *); extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task);
extern loff_t mem_lseek(struct file *file, loff_t offset, int orig); extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
extern const struct file_operations proc_maps_operations; extern const struct file_operations proc_maps_operations;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment