Skip to content

Commit 33d8b5d

Browse files
tasksetbrauner
authored andcommitted
eventfd: show the EFD_SEMAPHORE flag in fdinfo
The EFD_SEMAPHORE flag should be displayed in fdinfo, as different value could affect the behavior of eventfd. Suggested-by: Christian Brauner <[email protected]> Signed-off-by: Wen Yang <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dylan Yudaken <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Eric Biggers <[email protected]> Cc: [email protected] Cc: [email protected] Message-Id: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 5c075c5 commit 33d8b5d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/eventfd.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ struct eventfd_ctx {
3333
/*
3434
* Every time that a write(2) is performed on an eventfd, the
3535
* value of the __u64 being written is added to "count" and a
36-
* wakeup is performed on "wqh". A read(2) will return the "count"
37-
* value to userspace, and will reset "count" to zero. The kernel
38-
* side eventfd_signal() also, adds to the "count" counter and
39-
* issue a wakeup.
36+
* wakeup is performed on "wqh". If EFD_SEMAPHORE flag was not
37+
* specified, a read(2) will return the "count" value to userspace,
38+
* and will reset "count" to zero. The kernel side eventfd_signal()
39+
* also, adds to the "count" counter and issue a wakeup.
4040
*/
4141
__u64 count;
4242
unsigned int flags;
@@ -301,6 +301,8 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f)
301301
(unsigned long long)ctx->count);
302302
spin_unlock_irq(&ctx->wqh.lock);
303303
seq_printf(m, "eventfd-id: %d\n", ctx->id);
304+
seq_printf(m, "eventfd-semaphore: %d\n",
305+
!!(ctx->flags & EFD_SEMAPHORE));
304306
}
305307
#endif
306308

0 commit comments

Comments
 (0)