public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
To: axboe@kernel.dk
Cc: io-uring@vger.kernel.org, Yang Xiuwei <yangxiuwei@kylinos.cn>
Subject: [PATCH 2/2] test/cbpf_filter: skip when openat2.h is not available
Date: Sat, 14 Mar 2026 16:35:38 +0800	[thread overview]
Message-ID: <20260314083538.791693-3-yangxiuwei@kylinos.cn> (raw)
In-Reply-To: <20260314083538.791693-1-yangxiuwei@kylinos.cn>

cbpf_filter.c unconditionally includes <linux/openat2.h>, so the test
fails to build on systems whose kernel headers do not provide that
file (e.g. older distros or LTS). configure already sets
CONFIG_HAVE_OPEN_HOW=n and provides struct open_how in compat.h for
the library and other tests; only this test bypassed that by
including the kernel header directly.

Wrap the entire test in #ifdef CONFIG_HAVE_OPEN_HOW and add a stub
main that returns T_EXIT_SKIP in the #else branch. The test then
always compiles; on systems without openat2.h it skips at runtime.

Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
---
 test/cbpf_filter.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/cbpf_filter.c b/test/cbpf_filter.c
index 41fd284e..050b3ac7 100644
--- a/test/cbpf_filter.c
+++ b/test/cbpf_filter.c
@@ -6,6 +6,7 @@
  * Unlike eBPF which requires a separate compiled program, cBPF filters can
  * be defined inline as an array of sock_filter instructions.
  */
+#ifdef CONFIG_HAVE_OPEN_HOW
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1443,3 +1444,10 @@ int main(int argc, char *argv[])
 
 	return total_failed;
 }
+#else /* #ifdef CONFIG_HAVE_OPEN_HOW */
+#include "helpers.h"
+int main(void)
+{
+	return T_EXIT_SKIP;
+}
+#endif /* #ifdef CONFIG_HAVE_OPEN_HOW */
-- 
2.25.1


  parent reply	other threads:[~2026-03-14  8:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14  8:35 [PATCH Liburing 0/2] build and compiler warning fixes Yang Xiuwei
2026-03-14  8:35 ` [PATCH 1/2] examples/send-zerocopy: fix -Wstringop-truncation on ifr.ifr_name Yang Xiuwei
2026-03-14  8:35 ` Yang Xiuwei [this message]
2026-03-14 13:35   ` [PATCH 2/2] test/cbpf_filter: skip when openat2.h is not available Jens Axboe
2026-03-15  5:02     ` Yang Xiuwei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260314083538.791693-3-yangxiuwei@kylinos.cn \
    --to=yangxiuwei@kylinos.cn \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox