Message ID | 20240827120237.25805-2-chrubis@suse.cz |
---|---|
State | Accepted |
Headers | show |
Series | Shell test library v3 | expand |
Hi Cyril, > The problem is that on musl sched.h exposes clone() when _GNU_SOURCE is > defined and at the same time sched.h does not get pulled before > tst_clone.h gets included, which means that the macro from tst_clone.h > that rewrites clone() functions actually rewrites the function > declaration in the system header. BTW glibc guards clone() with #ifdef __USE_GNU, which should have the same effect as _GNU_SOURCE. I wonder why only musl got broken. > We remove the tst_clone.h from the old library because the newly > included sched.h causes conflicts in the cpuset/cpuset_lib/ directory > and the tst_clone.h header is used only in a single old library test > i.e. clone02.c. > This commit is needed in order to avoid build failures in the next > commits that add support for the shell test library. Thanks for fixing this! Reported-by: Petr Vorel <pvorel@suse.cz> Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr
Hi! > BTW glibc guards clone() with #ifdef __USE_GNU, which should have the same > effect as _GNU_SOURCE. I wonder why only musl got broken. I guess that the definitions gets pulled from other header indirectly in glibc which happens before we define the macro.
diff --git a/include/old/test.h b/include/old/test.h index 0e210e4ef..306868fb5 100644 --- a/include/old/test.h +++ b/include/old/test.h @@ -31,7 +31,6 @@ #include "tst_pid.h" #include "tst_cmd.h" #include "tst_cpu.h" -#include "tst_clone.h" #include "old_device.h" #include "old_tmpdir.h" #include "tst_minmax.h" diff --git a/include/tst_clone.h b/include/tst_clone.h index 56f23142d..a57d761ca 100644 --- a/include/tst_clone.h +++ b/include/tst_clone.h @@ -5,6 +5,8 @@ #ifndef TST_CLONE_H__ #define TST_CLONE_H__ +#include <sched.h> + #ifdef TST_TEST_H__ /* The parts of clone3's clone_args we support */ diff --git a/testcases/kernel/syscalls/clone/clone02.c b/testcases/kernel/syscalls/clone/clone02.c index 821adc2d9..fd3ee1aed 100644 --- a/testcases/kernel/syscalls/clone/clone02.c +++ b/testcases/kernel/syscalls/clone/clone02.c @@ -59,6 +59,7 @@ #include <sched.h> #include "test.h" #include "safe_macros.h" +#include "tst_clone.h" #define FLAG_ALL (CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD) #define FLAG_NONE SIGCHLD
The problem is that on musl sched.h exposes clone() when _GNU_SOURCE is defined and at the same time sched.h does not get pulled before tst_clone.h gets included, which means that the macro from tst_clone.h that rewrites clone() functions actually rewrites the function declaration in the system header. We remove the tst_clone.h from the old library because the newly included sched.h causes conflicts in the cpuset/cpuset_lib/ directory and the tst_clone.h header is used only in a single old library test i.e. clone02.c. This commit is needed in order to avoid build failures in the next commits that add support for the shell test library. Signed-off-by: Cyril Hrubis <chrubis@suse.cz> --- include/old/test.h | 1 - include/tst_clone.h | 2 ++ testcases/kernel/syscalls/clone/clone02.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)