Skip to content

Commit 30fb5e1

Browse files
paulmckrcushuahkh
authored andcommitted
selftests/pidfd: Fix duplicate-symbol warnings for SCHED_ CPP symbols
The pidfd selftests run in userspace and include both userspace and kernel header files. On some distros (for example, CentOS), this results in duplicate-symbol warnings in allmodconfig builds, while on other distros (for example, Ubuntu) it does not. Therefore, use #undef to get rid of the userspace definitions in favor of the kernel definitions. Other ways of handling this include splitting up the selftest code so that the userspace definitions go into one translation unit and the kernel definitions into another (which might or might not be feasible) or to adjust compiler command-line options to suppress the warnings (which might or might not be desirable). [ paulmck: Apply Shuah Khan feedback. ] Link: https://lore.kernel.org/r/cc7e4fe7-299f-4bf3-af46-df6551d61997@paulmck-laptop Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Cc: Christian Brauner <brauner@kernel.org> Cc: <linux-kselftest@vger.kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 2138790 commit 30fb5e1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • tools/testing/selftests/pidfd

tools/testing/selftests/pidfd/pidfd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
#include <sys/types.h>
1717
#include <sys/wait.h>
1818

19+
/*
20+
* Remove the userspace definitions of the following preprocessor symbols
21+
* to avoid duplicate-definition warnings from the subsequent in-kernel
22+
* definitions.
23+
*/
24+
#undef SCHED_NORMAL
25+
#undef SCHED_FLAG_KEEP_ALL
26+
#undef SCHED_FLAG_UTIL_CLAMP
27+
1928
#include "../kselftest.h"
2029
#include "../clone3/clone3_selftests.h"
2130

0 commit comments

Comments
 (0)