lkml.org 
[lkml]   [2020]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 2/5] fs/proc: Introduce /proc/all/statm
Date
Returns statm lines for all visible processes with prepended PIDs.

Signed-off-by: Eugene Lubarsky <elubarsky.linux@gmail.com>
---
fs/proc/base.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index e0f60a1528b7..8396a38ba7d2 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3884,6 +3884,18 @@ static int proc_all_stat(struct seq_file *m, void *v)
return proc_tgid_stat(m, iter->ns, iter->tgid_iter.task->thread_pid, iter->tgid_iter.task);
}

+static int proc_all_statm(struct seq_file *m, void *v)
+{
+ struct all_iter *iter = (struct all_iter *) v;
+ struct pid_namespace *ns = iter->ns;
+ struct task_struct *task = iter->tgid_iter.task;
+ struct pid *pid = task->thread_pid;
+
+ seq_put_decimal_ull(m, "", pid_nr_ns(pid, ns));
+ seq_puts(m, " ");
+ return proc_pid_statm(m, ns, pid, task);
+}
+

#define PROC_ALL_OPS(NAME) static const struct seq_operations proc_all_##NAME##_ops = { \
.start = proc_all_start, \
@@ -3893,6 +3905,7 @@ static int proc_all_stat(struct seq_file *m, void *v)
}

PROC_ALL_OPS(stat);
+PROC_ALL_OPS(statm);

#define PROC_ALL_CREATE(NAME) \
do { \
@@ -3908,4 +3921,5 @@ void __init proc_all_init(void)
return;

PROC_ALL_CREATE(stat);
+ PROC_ALL_CREATE(statm);
}
--
2.25.1
\
 
 \ /
  Last update: 2020-08-10 17:00    [W:0.189 / U:1.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site