[PATCH] selftests/filesystems: include <fcntl.h> in wrappers.h

From: Sasha Levin

Date: Wed Nov 11 2026 - 20:49:15 EST


openat_o_mkdir() in wrappers.h uses O_DIRECTORY, O_CREAT and O_EXCL, but
the header doesn't include <fcntl.h>. fscontext_ns_test.c doesn't
either, so it no longer builds:

../wrappers.h:116:32: error: 'O_DIRECTORY' undeclared

Include it in the header.

Fixes: b536a4aa16ea ("selftest: add tests for open*(O_CREAT|O_DIRECTORY)")
Reported-by: kernelci.org bot <bot@xxxxxxxxxxxx>
Closes: https://d.kernelci.org/test/maestro:6af49b775b429d354e37819c
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/r/202611110221.YzAZrCXO-lkp@xxxxxxxxx/
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
Every selftest that includes wrappers.h builds with this, gcc and clang
on x86_64.

tools/testing/selftests/filesystems/wrappers.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/filesystems/wrappers.h b/tools/testing/selftests/filesystems/wrappers.h
index bc58bdb800631..09f02f67487c6 100644
--- a/tools/testing/selftests/filesystems/wrappers.h
+++ b/tools/testing/selftests/filesystems/wrappers.h
@@ -5,6 +5,7 @@

#define _GNU_SOURCE

+#include <fcntl.h>
#include <linux/types.h>
#include <linux/mount.h>
#include <sys/syscall.h>

base-commit: 13419eff849a88a276dec97fa62a532dc7fff400
--
2.53.0