Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp376233img; Wed, 20 Mar 2019 02:32:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSAuSJFvDiZopdNlLWQyi8KKGYRZJ4yhhgAu02NirSnaJkUfQ5szZOKpPn7Bi9Sk1ViyCQ X-Received: by 2002:a65:5b47:: with SMTP id y7mr5694536pgr.449.1553074340047; Wed, 20 Mar 2019 02:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553074340; cv=none; d=google.com; s=arc-20160816; b=iV9P36ibMHa0iv4Hv+NHTnUpDyr1Pb66MX6QPw8+PEcOxIEnkGx4/2Zrw9TXsKuLrz gN9N3tglguyU3qbsuXLwaoLpTDwdMqEoA4NAKcSLYIsQ1TXC97ehH6/MhaBBVPFNV89y YdL7CrSC4k0SW3SNBUo97BOBFU402upGkssceBJxHmaaEs/V7TBOiXpeIhCIRvWS684S g6bEb2DrQOPYxObKA5+FWd3X+mF9QNxDo/NWlDKL1+v7T1Uh3ipR3aoxrDIg1dYHkjH0 H7gcZw4kgYcqTUxsQE7WY0hDNIMTEwrt2zfZ/uijCJAFZ96mNBwyQve8lNSHEkALGnqs SJLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=XtLjz3vRlJbGUqgwtPP8ejPJ6GSwjs+L5n82NygQJ+A=; b=Safy3mj1M1fmKjKLcKER1pq7XpGiW0XAt9v317Xip0wnjAktt4e8eiOVIo1NFt7LP2 5yjC9iuzH2CdHx/xmsOJmy5z0gKet6AML/t4FyEx7JADC8MVmdKcltaE9MGOWrZIZl/c HP1Vv4JHx7qNoqF+YQaRFjSvsHzoeMQ4VqvS6xb3Ymx5s9nue+aMgJBaJjHvzTAcZY6r AXUuT7TzIY912m1dvDqNzjrXOT5dof1WKozICypXQ01ADRrFsLZ5JpjErcMaZ80qAD25 /I8ejgIMEACiqQUc3/fTUz+rpnNbD9kZTUKJWMnfVOO1gLJLv+C3LRJ9envnNdmbR423 utEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si1478463plb.39.2019.03.20.02.32.04; Wed, 20 Mar 2019 02:32:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbfCTJ3r (ORCPT + 99 others); Wed, 20 Mar 2019 05:29:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37442 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726910AbfCTJ3q (ORCPT ); Wed, 20 Mar 2019 05:29:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 240D56F567; Wed, 20 Mar 2019 09:29:46 +0000 (UTC) Received: from slave.localdomain.com (unknown [10.64.193.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7D6D01DB26; Wed, 20 Mar 2019 09:29:44 +0000 (UTC) From: Masatake YAMATO To: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, yamato@redhat.com Subject: [PATCH RESEND] eventfd: prepare id to userspace via fdinfo Date: Wed, 20 Mar 2019 18:29:29 +0900 Message-Id: <20190320092929.14628-1-yamato@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Mar 2019 09:29:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 20 Mar 2019 09:29:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'yamato@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Finding endpoints of an IPC channel is one of essential task to understand how a user program works. Procfs and netlink socket provide enough hints to find endpoints for IPC channels like pipes, unix sockets, and pseudo terminals. However, there is no simple way to find endpoints for an eventfd file from userland. An inode number doesn't hint. Unlike pipe, all eventfd files share the same inode object. To provide the way to find endpoints of an eventfd file, this patch adds "eventfd-id" field to /proc/PID/fdinfo of eventfd as identifier. Address for eventfd context is used as id. A tool like lsof can utilize the information to print endpoints. Signed-off-by: Masatake YAMATO --- fs/eventfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/eventfd.c b/fs/eventfd.c index 08d3bd602f73..fc63ad43d962 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -297,6 +297,7 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f) seq_printf(m, "eventfd-count: %16llx\n", (unsigned long long)ctx->count); spin_unlock_irq(&ctx->wqh.lock); + seq_printf(m, "eventfd-id: %p\n", ctx); } #endif -- 2.17.2