Skip to content

Commit a56d3fc

Browse files
ebiedermLinus Torvalds
authored andcommitted
seqfile convert proc_pid_statm
This conversion is just for code cleanliness, uniformity, and general safety. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ee99274 commit a56d3fc

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎fs/proc/array.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
563563
return do_task_stat(m, ns, pid, task, 1);
564564
}
565565

566-
int proc_pid_statm(struct task_struct *task, char *buffer)
566+
int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
567+
struct pid *pid, struct task_struct *task)
567568
{
568569
int size = 0, resident = 0, shared = 0, text = 0, lib = 0, data = 0;
569570
struct mm_struct *mm = get_task_mm(task);
@@ -572,7 +573,8 @@ int proc_pid_statm(struct task_struct *task, char *buffer)
572573
size = task_statm(mm, &shared, &text, &data, &resident);
573574
mmput(mm);
574575
}
576+
seq_printf(m, "%d %d %d %d %d %d %d\n",
577+
size, resident, shared, text, lib, data, 0);
575578

576-
return sprintf(buffer, "%d %d %d %d %d %d %d\n",
577-
size, resident, shared, text, lib, data, 0);
579+
return 0;
578580
}

‎fs/proc/base.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ static const struct pid_entry tgid_base_stuff[] = {
22812281
#endif
22822282
INF("cmdline", S_IRUGO, pid_cmdline),
22832283
ONE("stat", S_IRUGO, tgid_stat),
2284-
INF("statm", S_IRUGO, pid_statm),
2284+
ONE("statm", S_IRUGO, pid_statm),
22852285
REG("maps", S_IRUGO, maps),
22862286
#ifdef CONFIG_NUMA
22872287
REG("numa_maps", S_IRUGO, numa_maps),
@@ -2612,7 +2612,7 @@ static const struct pid_entry tid_base_stuff[] = {
26122612
#endif
26132613
INF("cmdline", S_IRUGO, pid_cmdline),
26142614
ONE("stat", S_IRUGO, tid_stat),
2615-
INF("statm", S_IRUGO, pid_statm),
2615+
ONE("statm", S_IRUGO, pid_statm),
26162616
REG("maps", S_IRUGO, maps),
26172617
#ifdef CONFIG_NUMA
26182618
REG("numa_maps", S_IRUGO, numa_maps),

‎fs/proc/internal.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ extern int proc_tid_stat(struct seq_file *m, struct pid_namespace *ns,
5454
extern int proc_tgid_stat(struct seq_file *m, struct pid_namespace *ns,
5555
struct pid *pid, struct task_struct *task);
5656
extern int proc_pid_status(struct task_struct *, char *);
57-
extern int proc_pid_statm(struct task_struct *, char *);
57+
extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
58+
struct pid *pid, struct task_struct *task);
5859
extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
5960

6061
extern const struct file_operations proc_maps_operations;

0 commit comments

Comments
 (0)