From patchwork Sun Jun 11 18:59:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Yang X-Patchwork-Id: 13275340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94D9EC77B7A for ; Sun, 11 Jun 2023 19:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjFKTG1 (ORCPT ); Sun, 11 Jun 2023 15:06:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbjFKTG0 (ORCPT ); Sun, 11 Jun 2023 15:06:26 -0400 Received: from out162-62-57-137.mail.qq.com (out162-62-57-137.mail.qq.com [162.62.57.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD26F1B9; Sun, 11 Jun 2023 12:06:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1686510380; bh=8ml7v+xU/fb8GPueIIAwZGo3QlTjbtM+C3EF4n/SEqs=; h=From:To:Cc:Subject:Date; b=QkPBh4vQ5XsOUo8r6E89KkC0QoJdLQurRA2Nz0H+7BszcFuxxGCrCcmZEbnCmdTv4 z+Ea+ODfiP99gG9y8WxF+gbj3RMMjCehgWTm7HytQdXzxSzNcsh4/ph0h52i10YWP1 bUDGDRvs9JPom/BkbUoQOBnX5pMrpeF976Jc0KG0= Received: from wen-VirtualBox.. ([240e:331:cb9:1200:2421:564d:c6df:cf15]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 231CFF; Mon, 12 Jun 2023 03:00:02 +0800 X-QQ-mid: xmsmtpt1686510002t1ci3qf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zJoXo PitgszsngPhaxtiX7I6glkPDXlXbO3F9NxnurIziQv6f2w7C/dkd0gNowKvf5wFO616/T19g== From: wenyang.linux@foxmail.com To: Alexander Viro , Jens Axboe , Christian Brauner Cc: Wen Yang , Christoph Hellwig , Dylan Yudaken , David Woodhouse , Matthew Wilcox , Eric Biggers , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] eventfd: show flags in fdinfo Date: Mon, 12 Jun 2023 02:59:47 +0800 X-OQ-MSGID: <20230611185947.2208-1-wenyang.linux@foxmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Wen Yang The flags should be displayed in fdinfo, as different flags could affect the behavior of eventfd. Signed-off-by: Wen Yang Cc: Alexander Viro Cc: Jens Axboe Cc: Christian Brauner Cc: Christoph Hellwig Cc: Dylan Yudaken Cc: David Woodhouse Cc: Matthew Wilcox Cc: Eric Biggers Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- fs/eventfd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/eventfd.c b/fs/eventfd.c index 6c06a527747f..5b5448e65f6f 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c @@ -33,10 +33,10 @@ struct eventfd_ctx { /* * Every time that a write(2) is performed on an eventfd, the * value of the __u64 being written is added to "count" and a - * wakeup is performed on "wqh". A read(2) will return the "count" - * value to userspace, and will reset "count" to zero. The kernel - * side eventfd_signal() also, adds to the "count" counter and - * issue a wakeup. + * wakeup is performed on "wqh". If EFD_SEMAPHORE flag was not + * specified, a read(2) will return the "count" value to userspace, + * and will reset "count" to zero. The kernel side eventfd_signal() + * also, adds to the "count" counter and issue a wakeup. */ __u64 count; unsigned int flags; @@ -301,6 +301,7 @@ static void eventfd_show_fdinfo(struct seq_file *m, struct file *f) (unsigned long long)ctx->count); spin_unlock_irq(&ctx->wqh.lock); seq_printf(m, "eventfd-id: %d\n", ctx->id); + seq_printf(m, "eventfd-flags: 0%o\n", ctx->flags); } #endif