Commit cbac5542 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Linus Torvalds

fs, eventfd: add procfs fdinfo helper

This allows us to print out raw counter value.  The /proc/pid/fdinfo/fd
output is

 | pos:	0
 | flags:	04002
 | eventfd-count:               5a
Signed-off-by: default avatarCyrill Gorcunov <>
Acked-by: default avatarPavel Emelyanov <>
Cc: Oleg Nesterov <>
Cc: Andrey Vagin <>
Cc: Al Viro <>
Cc: Alexey Dobriyan <>
Cc: James Bottomley <>
Cc: "Aneesh Kumar K.V" <>
Cc: Alexey Dobriyan <>
Cc: Matthew Helsley <>
Cc: "J. Bruce Fields" <>
Cc: "Aneesh Kumar K.V" <>
Cc: Tvrtko Ursulin <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 55985dd7
......@@ -19,6 +19,8 @@
#include <linux/export.h>
#include <linux/kref.h>
#include <linux/eventfd.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
struct eventfd_ctx {
struct kref kref;
......@@ -284,7 +286,25 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c
return res;
static int eventfd_show_fdinfo(struct seq_file *m, struct file *f)
struct eventfd_ctx *ctx = f->private_data;
int ret;
ret = seq_printf(m, "eventfd-count: %16llx\n",
(unsigned long long)ctx->count);
return ret;
static const struct file_operations eventfd_fops = {
.show_fdinfo = eventfd_show_fdinfo,
.release = eventfd_release,
.poll = eventfd_poll,
.read = eventfd_read,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment