[LTP] [PATCH] ioctl02: Use correct termios structure
Petr Vorel
petr.vorel@gmail.com
Wed Jan 29 22:42:19 CET 2025
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"
More information about the ltp
mailing list