cgroup_util.c:410:58: error: use of undeclared identifier 'O_PATH'

From: kernel test robot
Date: Sun May 19 2024 - 21:24:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b377b4868ef17b040065bd468668c707d2477a5
commit: c1457d9aad5ee2feafcf85aa9a58ab50500159d2 selftests/cgroup: Drop define _GNU_SOURCE
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce: linux/tools/testing/selftests/cgroup$ make

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <yujie.liu@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202405181620.zh4EErMk-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> cgroup_util.c:410:58: error: use of undeclared identifier 'O_PATH'
410 | return open(dir, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW | O_PATH);
| ^
>> cgroup_util.c:468:19: error: use of undeclared identifier 'O_TMPFILE'
468 | return open(".", O_TMPFILE | O_RDWR | O_EXCL);
| ^
2 errors generated.
--
>> test_core.c:804:8: error: call to undeclared function 'clone'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
804 | pid = clone(lesser_ns_open_thread_fn, stack + sizeof(stack),
| ^
test_core.c:804:8: note: did you mean 'close'?
/usr/include/unistd.h:358:12: note: 'close' declared here
358 | extern int close (int __fd);
| ^
1 error generated.
>> cgroup_util.c:410:58: error: use of undeclared identifier 'O_PATH'
410 | return open(dir, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW | O_PATH);
| ^
>> cgroup_util.c:468:19: error: use of undeclared identifier 'O_TMPFILE'
468 | return open(".", O_TMPFILE | O_RDWR | O_EXCL);
| ^
2 errors generated.


vim +/O_PATH +410 tools/testing/selftests/cgroup/cgroup_util.c

9bd5910d7f3db2 Christian Brauner 2020-02-05 407
9bd5910d7f3db2 Christian Brauner 2020-02-05 408 int dirfd_open_opath(const char *dir)
9bd5910d7f3db2 Christian Brauner 2020-02-05 409 {
9bd5910d7f3db2 Christian Brauner 2020-02-05 @410 return open(dir, O_DIRECTORY | O_CLOEXEC | O_NOFOLLOW | O_PATH);
9bd5910d7f3db2 Christian Brauner 2020-02-05 411 }
9bd5910d7f3db2 Christian Brauner 2020-02-05 412

:::::: The code at line 410 was first introduced by commit
:::::: 9bd5910d7f3db2f65be139d2679dd9daa4a3419a selftests/cgroup: add tests for cloning into cgroups

:::::: TO: Christian Brauner <christian.brauner@xxxxxxxxxx>
:::::: CC: Tejun Heo <tj@xxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki