* [LTP] [PATCH] ioctl02: Use correct termios structure
@ 2024-02-26 15:51 Martin Doucha
2024-02-28 13:44 ` Petr Vorel
2025-01-29 21:42 ` Petr Vorel
0 siblings, 2 replies; 4+ messages in thread
From: Martin Doucha @ 2024-02-26 15:51 UTC (permalink / raw)
To: ltp
The termios structure definition in <termios.h> is incompatible
with direct ioctl() calls. The correct definition is in <asm/termbits.h>
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
testcases/kernel/syscalls/ioctl/ioctl02.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/ioctl/ioctl02.c b/testcases/kernel/syscalls/ioctl/ioctl02.c
index aab80b251..f3bfb239a 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl02.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl02.c
@@ -26,7 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <termios.h>
+#include <asm/termbits.h>
#include "lapi/ioctl.h"
#include "tst_test.h"
--
2.42.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] ioctl02: Use correct termios structure
2024-02-26 15:51 [LTP] [PATCH] ioctl02: Use correct termios structure Martin Doucha
@ 2024-02-28 13:44 ` Petr Vorel
2025-01-29 21:42 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2024-02-28 13:44 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi Martin,
> The termios structure definition in <termios.h> is incompatible
> with direct ioctl() calls. The correct definition is in <asm/termbits.h>
Thanks, merged!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] ioctl02: Use correct termios structure
2024-02-26 15:51 [LTP] [PATCH] ioctl02: Use correct termios structure Martin Doucha
2024-02-28 13:44 ` Petr Vorel
@ 2025-01-29 21:42 ` Petr Vorel
2025-01-30 7:39 ` Andreas Larsson
1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2025-01-29 21:42 UTC (permalink / raw)
To: buildroot
Cc: Andreas Larsson, James Hilliard, Mike Gilbert, ltp, sparclinux,
Martin Doucha
Hi all,
FYI this LTP commit merged as 697a06a827 [1] which is needed to fix ioctl02.c
test on ppc64le on all kernel versions breaks compilation on Buildroot
bootlin-sparc64-glibc toolchain (gcc: 13.3.0, kernel headers: 4.19.255, glibc: 2.39):
In file included from br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/sys/ioctl.h:29,
from ../../../../include/lapi/ioctl.h:11,
from ioctl02.c:31:
br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/bits/ioctl-types.h:36:8: error: redefinition of ‘struct termio’
36 | struct termio
| ^~~~~~
In file included from ioctl02.c:29:
br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/asm/termbits.h:17:8: note: originally defined here
17 | struct termio {
The problem is with kernel <asm/termbits.h> incompatibility with glibc
<bits/ioctl-types.h> included via <sys/ioctl.h> which is needed by ioctl02.c
and also by LTP library include/safe_macros_fn.h.
This problem was fixed a year ago in kernel v6.10-rc1 in commit c32d18e7942d
("sparc: move struct termio to asm/termios.h") [2].
Because nobody noticed this change I suppose nobody uses LTP on sparc64
or people compile LTP on sparc64 with new kernel headers.
@Cyril @Martin FYI another example of conflicting glibc and kernel headers (not
listed in [3]). IMHO nothing to be done on LTP side unless we can magically put
back <termios.h> and have ppc64le working with it.
@Buildroot As I wrote, because LTP needs this fix for ppc64le (arch actually
tested by LTP developers), the only solution for Buildroot is to require
toolchain based on v6.10 kernel headers for sparc64 (quite a big limitation for
several cross compilation toolchain, some are based on 4.19 kernel headers,
5.11 requirement for musl effectively disables LTP on Buildroot on musl).
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/commit/697a06a827978887e4c88710dc7d31d6f3ee816a
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c32d18e7942d7589b62e301eb426b32623366565
[3] https://sourceware.org/glibc/wiki/Synchronizing_Headers
> The termios structure definition in <termios.h> is incompatible
> with direct ioctl() calls. The correct definition is in <asm/termbits.h>
> Signed-off-by: Martin Doucha <mdoucha@suse.cz>
> ---
> testcases/kernel/syscalls/ioctl/ioctl02.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl02.c b/testcases/kernel/syscalls/ioctl/ioctl02.c
> index aab80b251..f3bfb239a 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl02.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl02.c
> @@ -26,7 +26,7 @@
> #include <stdio.h>
> #include <stdlib.h>
> -#include <termios.h>
> +#include <asm/termbits.h>
> #include "lapi/ioctl.h"
> #include "tst_test.h"
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] ioctl02: Use correct termios structure
2025-01-29 21:42 ` Petr Vorel
@ 2025-01-30 7:39 ` Andreas Larsson
0 siblings, 0 replies; 4+ messages in thread
From: Andreas Larsson @ 2025-01-30 7:39 UTC (permalink / raw)
To: Petr Vorel, buildroot
Cc: James Hilliard, Mike Gilbert, ltp, sparclinux, Martin Doucha
On 2025-01-29 22:42, Petr Vorel wrote:
> Hi all,
>
> FYI this LTP commit merged as 697a06a827 [1] which is needed to fix ioctl02.c
> test on ppc64le on all kernel versions breaks compilation on Buildroot
> bootlin-sparc64-glibc toolchain (gcc: 13.3.0, kernel headers: 4.19.255, glibc: 2.39):
>
> In file included from br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/sys/ioctl.h:29,
> from ../../../../include/lapi/ioctl.h:11,
> from ioctl02.c:31:
> br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/bits/ioctl-types.h:36:8: error: redefinition of ‘struct termio’
> 36 | struct termio
> | ^~~~~~
> In file included from ioctl02.c:29:
> br-test-pkg/bootlin-sparc64-glibc/host/sparc64-buildroot-linux-gnu/sysroot/usr/include/asm/termbits.h:17:8: note: originally defined here
> 17 | struct termio {
>
> The problem is with kernel <asm/termbits.h> incompatibility with glibc
> <bits/ioctl-types.h> included via <sys/ioctl.h> which is needed by ioctl02.c
> and also by LTP library include/safe_macros_fn.h.
>
> This problem was fixed a year ago in kernel v6.10-rc1 in commit c32d18e7942d
> ("sparc: move struct termio to asm/termios.h") [2].
>
> Because nobody noticed this change I suppose nobody uses LTP on sparc64
> or people compile LTP on sparc64 with new kernel headers.
>
> @Cyril @Martin FYI another example of conflicting glibc and kernel headers (not
> listed in [3]). IMHO nothing to be done on LTP side unless we can magically put
> back <termios.h> and have ppc64le working with it.
>
> @Buildroot As I wrote, because LTP needs this fix for ppc64le (arch actually
> tested by LTP developers), the only solution for Buildroot is to require
> toolchain based on v6.10 kernel headers for sparc64 (quite a big limitation for
> several cross compilation toolchain, some are based on 4.19 kernel headers,
> 5.11 requirement for musl effectively disables LTP on Buildroot on musl).
>
> Kind regards,
> Petr
>
> [1] https://github.com/linux-test-project/ltp/commit/697a06a827978887e4c88710dc7d31d6f3ee816a
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c32d18e7942d7589b62e301eb426b32623366565
> [3] https://sourceware.org/glibc/wiki/Synchronizing_Headers
The patch in [2] was also applied to stable branches, so it is also
included in v6.6.74, v6.1.127, v5.15.177, v5.10.233, and v5.4.289
kernel versions that are currently used by Buildroot master.
For the 4.19 kernel it is in place since v4.19.316.
Cheers,
Andreas
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-01-30 12:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 15:51 [LTP] [PATCH] ioctl02: Use correct termios structure Martin Doucha
2024-02-28 13:44 ` Petr Vorel
2025-01-29 21:42 ` Petr Vorel
2025-01-30 7:39 ` Andreas Larsson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox