[PATCH 09/15] task_diag: add a flag to mark incomplete messages
From: Andrey Vagin
Date: Mon Apr 11 2016 - 19:38:31 EST
If all information about a process don't fit in a message, it's marked
by the TASK_DIAG_FLAG_CONT flag and the next message will describe the
same process.
Signed-off-by: Andrey Vagin <avagin@xxxxxxxxxx>
---
fs/proc/task_diag.c | 3 +++
include/uapi/linux/task_diag.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/fs/proc/task_diag.c b/fs/proc/task_diag.c
index 00db32d..cd10374 100644
--- a/fs/proc/task_diag.c
+++ b/fs/proc/task_diag.c
@@ -415,6 +415,7 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb,
msg = nlmsg_data(nlh);
msg->pid = task_pid_nr_ns(tsk, pidns);
msg->tgid = task_tgid_nr_ns(tsk, pidns);
+ msg->flags |= TASK_DIAG_FLAG_CONT;
if (show_flags & TASK_DIAG_SHOW_BASE) {
if (i >= n)
@@ -450,6 +451,8 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb,
i++;
}
+ msg->flags &= ~TASK_DIAG_FLAG_CONT;
+
nlmsg_end(skb, nlh);
if (cb)
cb->attr = 0;
diff --git a/include/uapi/linux/task_diag.h b/include/uapi/linux/task_diag.h
index 8bccd02..e967c5b 100644
--- a/include/uapi/linux/task_diag.h
+++ b/include/uapi/linux/task_diag.h
@@ -13,6 +13,8 @@ struct task_diag_msg {
__u32 flags;
};
+#define TASK_DIAG_FLAG_CONT 0x00000001
+
enum {
TASK_DIAG_BASE = 0,
TASK_DIAG_CRED,
--
2.5.5