Skip to contentSkip to conversation

selftests/liveupdate: include <termios.h> for TCGETS

PATCH In review Sasha Levin 3 participants 3 messages Dec 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/liveupdate: include <termios.h> for TCGETS

The unknown_ioctl_number test passes TCGETS to a session fd. On powerpc TCGETS is _IOR('t', 19, struct termios), and nothing that liveupdate.c includes declares struct termios, so the test does not build there:

liveupdate.c:560:37: error: invalid application of 'sizeof' to
incomplete type 'struct termios'

Include <termios.h>. The test only needs a command that is not a liveupdate ioctl, so it does not matter that glibc's struct termios is larger than the kernel's on powerpc.

Fixes 6f8be8fa8e6f ("selftests/liveupdate: Test ENOTTY for unknown ioctl numbers")

---
Based on the liveupdate-7.5 branch (6f8be8fa8e6f).

KernelCI hit this in the ppc64le_defconfig selftest builds of my all-next tree, with gcc 14 and gcc 15. next-20261203 does not have the commit yet.

Tested by compiling liveupdate.c for powerpc64le with clang 21, the powerpc UAPI headers of this tree and the glibc 2.43 headers: it fails with the error above before the patch and compiles with it. On x86_64 "make -C tools/testing/selftests TARGETS=liveupdate" still builds.

 tools/testing/selftests/liveupdate/liveupdate.c | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/liveupdate/liveupdate.c +1 -0
index e6ed7a4142ff3..3e5a29b070f55 100644
@@ -22,6 +22,7 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/ioctl.h>
+#include <termios.h>
 #include <unistd.h>
 
 #include <libliveupdate.h>

base-commit: 6f8be8fa8e6f98d30949762d4e73cedad280dbdb

Signature · 1 line
2.53.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 7 lines

The unknown_ioctl_number test passes TCGETS to a session fd. On powerpc TCGETS is _IOR('t', 19, struct termios), and nothing that liveupdate.c includes declares struct termios, so the test does not build there:

liveupdate.c:560:37: error: invalid application of 'sizeof' to
incomplete type 'struct termios'

Quoted 6 lines

Include <termios.h>. The test only needs a command that is not a liveupdate ioctl, so it does not matter that glibc's struct termios is larger than the kernel's on powerpc.

Fixes 6f8be8fa8e6f ("selftests/liveupdate: Test ENOTTY for unknown ioctl numbers")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Sasha Levin
Quoted 7 lines · Sasha Levin

The unknown_ioctl_number test passes TCGETS to a session fd. On powerpc TCGETS is _IOR('t', 19, struct termios), and nothing that liveupdate.c includes declares struct termios, so the test does not build there:

liveupdate.c:560:37: error: invalid application of 'sizeof' to
incomplete type 'struct termios'

Quoted 6 lines

Include <termios.h>. The test only needs a command that is not a liveupdate ioctl, so it does not matter that glibc's struct termios is larger than the kernel's on powerpc.

Fixes 6f8be8fa8e6f ("selftests/liveupdate: Test ENOTTY for unknown ioctl numbers")

[...]

Signature · 2 lines
Regards,
Pratyush Yadav