Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754598AbbGFIvf (ORCPT ); Mon, 6 Jul 2015 04:51:35 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:5476 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754567AbbGFIvb (ORCPT ); Mon, 6 Jul 2015 04:51:31 -0400 From: Andrey Vagin To: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, Andrey Vagin , Oleg Nesterov , Andrew Morton , Cyrill Gorcunov , Pavel Emelyanov , Roger Luethi , Arnd Bergmann , Arnaldo Carvalho de Melo , David Ahern , Andy Lutomirski , Pavel Odintsov Subject: [PATCH 21/24] task diag: Add support for TGID attribute Date: Mon, 6 Jul 2015 11:47:22 +0300 Message-Id: <1436172445-6979-22-git-send-email-avagin@openvz.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1436172445-6979-1-git-send-email-avagin@openvz.org> References: <1436172445-6979-1-git-send-email-avagin@openvz.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1982 Lines: 65 From: David Ahern Add TGID attribute and put in every message. This is need for perf for example when processing messages with maps. Signed-off-by: David Ahern Signed-off-by: Andrey Vagin --- include/uapi/linux/task_diag.h | 1 + kernel/taskdiag.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/task_diag.h b/include/uapi/linux/task_diag.h index 19c9579..935502b 100644 --- a/include/uapi/linux/task_diag.h +++ b/include/uapi/linux/task_diag.h @@ -15,6 +15,7 @@ enum { /* other attributes */ TASK_DIAG_PID = 64, /* u32 */ + TASK_DIAG_TGID, /* u32 */ __TASK_DIAG_ATTR_MAX #define TASK_DIAG_ATTR_MAX (__TASK_DIAG_ATTR_MAX - 1) diff --git a/kernel/taskdiag.c b/kernel/taskdiag.c index 6549df3..ccba538 100644 --- a/kernel/taskdiag.c +++ b/kernel/taskdiag.c @@ -13,6 +13,7 @@ static size_t taskdiag_packet_size(u64 show_flags, int n_vma) size_t size; size = nla_total_size(sizeof(u32)); /* PID */ + + nla_total_size(sizeof(u32)); /* TGID */ if (show_flags & TASK_DIAG_SHOW_BASE) size += nla_total_size(sizeof(struct task_diag_base)); @@ -451,7 +452,7 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb, int err = 0, i = 0, n = 0; bool progress = false; int flags = 0; - u32 pid; + u32 pid, tgid; if (cb) { n = cb->args[2]; @@ -468,6 +469,11 @@ static int task_diag_fill(struct task_struct *tsk, struct sk_buff *skb, if (err) goto err; + tgid = task_tgid_vnr(tsk); + err = nla_put_u32(skb, TASK_DIAG_TGID, tgid); + if (err) + goto err; + if (show_flags & TASK_DIAG_SHOW_BASE) { if (i >= n) err = fill_task_base(tsk, skb); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/