Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4933298ima; Tue, 5 Feb 2019 03:52:09 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia5151Ah7Cl8sasPnro0awV84EaUAOS6hxeX+BE2K/w9ZMWF2gXMwKLSj0mP65OfUlgmDig X-Received: by 2002:a65:6094:: with SMTP id t20mr180316pgu.285.1549367529171; Tue, 05 Feb 2019 03:52:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549367529; cv=none; d=google.com; s=arc-20160816; b=BuWeGoS8gs6g0qRBZ5//Vyxhz8nSat4ArVNOgN0iws52YdORPfvxmDj2H6HhXDlwBT CGFkJCBEZeZLb77lRe+ZpwfACszbNX28ub+qU0qtSdV9YNYfShQiig+QfxHMUoQxmU/k n28PeyCfIi0/gvcZUWYOGngp673PG6Z6mg0h9SvSzeiiSiZGoyQZP1r4EjhVJPTzXFom 1ob/rD4vVF1jO9t/OnT4GhccNkdxFn+r4OUyCb8t5MDKf3dsAJVYc4eAuRW0p+x22uXQ vt0qPOmoIBYPeiRoJ5PsW/tXNE6p8RR09TkHdr0oOr0Xr2u013NOJZfbxYi4Zo4O1GPj wwSw== 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=Hx7e9Om6KWir2y5Jll5K15qRwbmzzWisINZ45fm1GnE=; b=epCbd7/McIzeVKTofdHf91LlnQwprP/0mRx1DfDynHpCFRzVlaQ8kwBruh1e24WHaH HDNSaPaiW1EKV0yKO45Q77aYIWdLceJv9L0KD3pQeg7UzMvT6Z60P9BM34VxlwZs4PpC MtP3WpAv3iobaPHWzQhZmEUN3cD5PqEBHHS4axQOykr1nGlLKAqouzxjf0sK8sVRQqG8 WasokGRD5M1af/lZaVfZC5Z40ZBT2wwhvgdfVZzCGlL7LBoiwKsTbeEZpOkvLQsOPhkI 0o/mBViIH+tiy197Oe7xkX33+j3H2sW8ansjR2CGjQygQu82Lgjzqs1Am4iF4XtNresI nK4w== 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 e35si420870pgb.548.2019.02.05.03.51.53; Tue, 05 Feb 2019 03:52:09 -0800 (PST) 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 S1728593AbfBELvp (ORCPT + 99 others); Tue, 5 Feb 2019 06:51:45 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39784 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726622AbfBELvp (ORCPT ); Tue, 5 Feb 2019 06:51:45 -0500 X-Greylist: delayed 338 seconds by postgrey-1.27 at vger.kernel.org; Tue, 05 Feb 2019 06:51:44 EST Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 975A540200A8; Tue, 5 Feb 2019 11:46:06 +0000 (UTC) Received: from slave.localdomain.com (unknown [10.64.193.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A7BF2026DE4; Tue, 5 Feb 2019 11:46:05 +0000 (UTC) From: Masatake YAMATO To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, yamato@redhat.com Subject: [PATCH RESEND] eventfd: prepare id to userspace via fdinfo Date: Tue, 5 Feb 2019 20:46:00 +0900 Message-Id: <20190205114600.3182-1-yamato@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 05 Feb 2019 11:46:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Tue, 05 Feb 2019 11:46:06 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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 fdinfo of eventfd as identifier. Address for eventfd context is used as id. Typical applicaiton utilizing the information is lsof. 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