linux-user: support for termios2 required after glibc 2.42 upgrade
PATCH 1/1 linux-user: support for termios2 required after glibc 2.42 upgrade
I'm re-sending a patch series here collected by @dramforever, see
https://gitlab.com/qemu-project/qemu/-/issues/3065#note_2969046870
https://github.com/qemu/qemu/compare/v10.1.2...dramforever:add-termios2
With glibc-2.42 several architectures switch to termios2 for default terminal control, that however so far fails badly at the moment since the ioctls are unsupported. This series fixes that.
While I have not authored any of this, I have reviewed it and have tested it extensively on alpha and (o32 be) mips. In both cases a Gentoo installation stage successfully rebuilt itself in a systemd-nspawn.
Please consider for inclusion.
PATCH 1/8 Add termios2 support to linux-user
From: Luca Bonissi <[email protected]>
--- linux-user/ioctls.h | 6 +++ linux-user/strace.c | 69 ++++++++++++++++++++++++++++++ linux-user/syscall.c | 84 +++++++++++++++++++++++++++++++++++++ linux-user/syscall_types.h | 3 ++ linux-user/user-internals.h | 3 ++ 5 files changed, 165 insertions(+)
linux-user/ioctls.h +6 -0
@@ -1,5 +1,11 @@/* emulated ioctl list */ +#ifdef TARGET_TCGETS2 + IOCTL(TCGETS2, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios2))) + IOCTL(TCSETS2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2))) + IOCTL(TCSETSW2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2))) + IOCTL(TCSETSF2, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios2))) +#endif IOCTL(TCGETS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_termios))) IOCTL(TCSETS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_termios)))IOCTL (TCSETSF ,IOC_W ,MK_PTR (MK_STRUCT (STRUCT_termios)))
linux-user/strace.c +69 -0
75 lines not on this page · raw message
linux-user/syscall.c +84 -0
96 lines not on this page · raw message
linux-user/syscall_types.h +3 -0
@@ -1,4 +1,7 @@ STRUCT_SPECIAL(termios) +#ifdef TARGET_TCGETS2 +STRUCT_SPECIAL(termios2) +#endif STRUCT (winsize,TYPE_SHORT ,TYPE_SHORT ,TYPE_SHORT ,TYPE_SHORT )
linux-user/user-internals.h +3 -0
@@ -129,6 +129,9 @@ static inline uint64_t target_offset64(uint64_t word0, uint64_t word1)#endif /* TARGET_ABI_BITS != 32 */ void print_termios (void *arg); +#ifdef TARGET_TCGETS2 +void print_termios2 (void *arg); +#endif /* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */ #ifdef TARGET_ARM
Signature · 1 line
2.52.0
Re: [PATCH 1/8] Add termios2 support to linux-user
Quoted 11 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Signed-off-by Luca Bonissi <[email protected]>--- linux-user/ioctls.h | 6 +++ linux-user/strace.c | 69 ++++++++++++++++++++++++++++++ linux-user/syscall.c | 84 +++++++++++++++++++++++++++++++++++++ linux-user/syscall_types.h | 3 ++ linux-user/user-internals.h | 3 ++ 5 files changed, 165 insertions(+)
PATCH 2/8 Add termios2 support to alpha target
In reply to Andreas K. HüttelFrom: Luca Bonissi <[email protected]>
--- linux-user/alpha/termbits.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
linux-user/alpha/termbits.h +29 -0
@@ -17,6 +17,29 @@ struct target_termios {target_speed_t c_ospeed;/* output speed */ }; +struct target_termios2 { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_cc_t c_line;/* line discipline (== c_cc[19]) */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +struct target_ktermios { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_cc_t c_line;/* line discipline (== c_cc[19]) */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +/* c_cc characters */ #define TARGET_VEOF 0#define TARGET_VEOL 1
@@ -247,6 +270,12 @@ struct target_termios {#define TARGET_TIOCSBRK 0x5427/* BSD compatibility */ #define TARGET_TIOCCBRK 0x5428/* BSD compatibility */ #define TARGET_TIOCGSID 0x5429/* Return the session ID of FD */ +#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2) +#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2) +#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2) +#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2) +#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485) +#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int)/* Lock/unlock Pty */ #define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)/* Safely open the slave */
Signature · 1 line
2.52.0
Re: [PATCH 2/8] Add termios2 support to alpha target
Quoted 7 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Signed-off-by Luca Bonissi <[email protected]>--- linux-user/alpha/termbits.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
PATCH 3/8 Add termios2 support to hppa target
In reply to Andreas K. HüttelFrom: Luca Bonissi <[email protected]>
--- linux-user/hppa/termbits.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
linux-user/hppa/termbits.h +29 -0
@@ -18,6 +18,29 @@ struct target_termios {target_cc_t c_cc[TARGET_NCCS ];/* control characters */ }; +struct target_termios2 { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +struct target_ktermios { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +/* c_iflag bits */ #define TARGET_IGNBRK 0000001#define TARGET_BRKINT 0000002
@@ -190,6 +213,12 @@ struct target_termios {#define TARGET_TIOCSBRK 0x5427/* BSD compatibility */ #define TARGET_TIOCCBRK 0x5428/* BSD compatibility */ #define TARGET_TIOCGSID TARGET_IOR('T', 20, int) +#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2) +#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2) +#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2) +#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2) +#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485) +#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)#define TARGET_TIOCGPTN TARGET_IOR('T', 0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TARGET_TIOCSPTLCK TARGET_IOW('T', 0x31, int)
Signature · 1 line
2.52.0
Re: [PATCH 3/8] Add termios2 support to hppa target
Quoted 3 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Signed-off-by Luca Bonissi <[email protected]>
Quoted 4 lines
--- linux-user/hppa/termbits.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
PATCH 4/8 Add termios2 support to mips target
In reply to Andreas K. HüttelFrom: Luca Bonissi <[email protected]>
--- linux-user/mips/termbits.h | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
linux-user/mips/termbits.h +27 -4
@@ -18,6 +18,29 @@ struct target_termios {target_cc_t c_cc[TARGET_NCCS ];/* control characters */ }; +struct target_termios2 { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +struct target_ktermios { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +/* c_iflag bits */ #define TARGET_IGNBRK 0000001#define TARGET_BRKINT 0000002
@@ -227,10 +250,10 @@ struct target_termios {#define TARGET_TIOCSBRK 0x5427/* BSD compatibility */ #define TARGET_TIOCCBRK 0x5428/* BSD compatibility */ #define TARGET_TIOCGSID 0x7416/* Return the session ID of FD */ -#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct termios2) -#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct termios2) -#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct termios2) -#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct termios2) +#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2) +#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2) +#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2) +#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2)#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485)#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485)#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-mux device) */
Signature · 1 line
2.52.0
Re: [PATCH 4/8] Add termios2 support to mips target
Quoted 7 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Signed-off-by Luca Bonissi <[email protected]>--- linux-user/mips/termbits.h | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-)
PATCH 5/8 Add termios2 support to sh4 target
In reply to Andreas K. HüttelFrom: Luca Bonissi <[email protected]>
--- linux-user/sh4/termbits.h | 46 +++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-)
linux-user/sh4/termbits.h +34 -12
@@ -18,6 +18,28 @@ struct target_termios {target_cc_t c_cc[TARGET_NCCS ];/* control characters */ }; +struct target_termios2 { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +struct target_ktermios { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; +/* c_cc characters */ #define TARGET_VINTR 0
@@ -251,14 +273,17 @@ struct target_termios {#define TARGET_TIOCNOTTY TARGET_IO('T', 34)/* 0x5422 */ #define TARGET_TIOCSETD TARGET_IOW('T', 35, int)/* 0x5423 */ #define TARGET_TIOCGETD TARGET_IOR('T', 36, int)/* 0x5424 */ -#define TARGET_TCSBRKP TARGET_IOW('T', 37, int)/* 0x5425 */ /* Needed for POSIX tcse -ndbreak() */ +#define TARGET_TCSBRKP TARGET_IOW('T', 37, int)/* 0x5425 */ /* Needed for POSIX tcsendbreak() */ #define TARGET_TIOCSBRK TARGET_IO('T', 39)/* 0x5427 */ /* BSD compatibility */ #define TARGET_TIOCCBRK TARGET_IO('T', 40)/* 0x5428 */ /* BSD compatibility */ -#define TARGET_TIOCGSID TARGET_IOR('T', 41, pid_t)/* 0x5429 */ /* Return the session -ID of FD */ -#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-m -ux device) */ +#define TARGET_TIOCGSID TARGET_IOR('T', 41, pid_t)/* 0x5429 */ /* Return the session ID of FD */ +#define TARGET_TCGETS2 TARGET_IOR('T', 0x2A, struct target_termios2) +#define TARGET_TCSETS2 TARGET_IOW('T', 0x2B, struct target_termios2) +#define TARGET_TCSETSW2 TARGET_IOW('T', 0x2C, struct target_termios2) +#define TARGET_TCSETSF2 TARGET_IOW('T', 0x2D, struct target_termios2) +#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x2E, struct serial_rs485) +#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x2F, struct serial_rs485) +#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int)/* Get Pty Number (of pty-mux device) */ #define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int)/* Lock/unlock Pty */ #define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41)/* Safely open the slave */
@@ -270,8 +295,7 @@ ux device) */#define TARGET_TIOCSLCKTRMIOS 0x5457#define TARGET_TIOCSERGSTRUCT TARGET_IOR('T', 88, int)/* 0x5458 */ /* For d ebugging only */ -#define TARGET_TIOCSERGETLSR TARGET_IOR('T', 89, unsigned int)/* 0x5459 */ /* Get line sta -tus register */ +#define TARGET_TIOCSERGETLSR TARGET_IOR('T', 89, unsigned int)/* 0x5459 */ /* Get line status register */ /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ # define TARGET_TIOCSER_TEMT 0x01/* Transmitter physically empty */ #define TARGET_TIOCSERGETMULTI TARGET_IOR('T', 90, int)/* 0x545A
@@ -279,9 +303,7 @@ tus register */#define TARGET_TIOCSERSETMULTI TARGET_IOW('T', 91, int)/* 0x545B */ /* Set multiport config */ -#define TARGET_TIOCMIWAIT TARGET_IO('T', 92)/* 0x545C */ /* wait for a change on -serial input line(s) */ -#define TARGET_TIOCGICOUNT TARGET_IOR('T', 93, int)/* 0x545D */ /* read -serial port inline interrupt counts */ +#define TARGET_TIOCMIWAIT TARGET_IO('T', 92)/* 0x545C */ /* wait for a change on serial input line(s) */ +#define TARGET_TIOCGICOUNT TARGET_IOR('T', 93, int)/* 0x545D */ /* read serial port inline interrupt counts */ #endif
Signature · 1 line
2.52.0
Re: [PATCH 5/8] Add termios2 support to sh4 target
Quoted 7 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Signed-off-by Luca Bonissi <[email protected]>--- linux-user/sh4/termbits.h | 46 +++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-)
PATCH 6/8 Add termios2 support to sparc target
In reply to Andreas K. HüttelFrom: Luca Bonissi <[email protected]>
--- linux-user/sparc/termbits.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
linux-user/sparc/termbits.h +28 -0
@@ -18,6 +18,28 @@ struct target_termios {target_cc_t c_cc[TARGET_NCCS ];/* control characters */ }; +struct target_termios2 { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; + +struct target_ktermios { +target_tcflag_t c_iflag;/* input mode flags */ +target_tcflag_t c_oflag;/* output mode flags */ +target_tcflag_t c_cflag;/* control mode flags */ +target_tcflag_t c_lflag;/* local mode flags */ +target_cc_t c_line;/* line discipline */ +target_cc_t c_cc[TARGET_NCCS ];/* control characters */ +target_speed_t c_ispeed;/* input speed */ +target_speed_t c_ospeed;/* output speed */ +}; +/* c_cc characters */ #define TARGET_VINTR 0
@@ -251,6 +273,12 @@ struct target_termios {#define TARGET_TIOCGPGRP TARGET_IOR('t', 131, int)#define TARGET_TIOCSCTTY TARGET_IO('t', 132)#define TARGET_TIOCGSID TARGET_IOR('t', 133, int) +#define TARGET_TCGETS2 TARGET_IOR('T', 12, struct target_termios2) +#define TARGET_TCSETS2 TARGET_IOW('T', 13, struct target_termios2) +#define TARGET_TCSETSW2 TARGET_IOW('T', 14, struct target_termios2) +#define TARGET_TCSETSF2 TARGET_IOW('T', 15, struct target_termios2) +#define TARGET_TIOCGRS485 TARGET_IOR('T', 0x41, struct serial_rs485) +#define TARGET_TIOCSRS485 TARGET_IOWR('T', 0x42, struct serial_rs485)/* Get minor device of a pty master's FD -- Solaris equiv is ISPTM */ #define TARGET_TIOCGPTN TARGET_IOR('t', 134, unsigned int)/* Get Pty Number */ #define TARGET_TIOCSPTLCK TARGET_IOW('t', 135, int)/* Lock/unlock PTY */
Signature · 1 line
2.52.0
Re: [PATCH 6/8] Add termios2 support to sparc target
Quoted 4 lines · Andreas K. Hüttel
From: Luca Bonissi <[email protected]>
Quoted 3 lines
--- linux-user/sparc/termbits.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
PATCH 7/8 linux-user: Add missing termios baud rates
In reply to Andreas K. HüttelFrom: Vivian Wang <[email protected]>
Add several missing baud rates and inputs baud rates in cflag_tbl.
Add these missing definitions in termbits.h:
- TARGET_BOTHER for alpha, hppa, ppc, sh4, sparc
- TARGET_IBSHIFT for hppa, mips, ppc, sh4, sparc
- Missing standard baud rates for hppa
These are required for the glibc test tst-termios-linux.
--- linux-user/alpha/termbits.h | 1 + linux-user/generic/termbits.h | 2 +- linux-user/hppa/termbits.h | 16 ++++++- linux-user/mips/termbits.h | 4 +- linux-user/ppc/termbits.h | 1 + linux-user/sh4/termbits.h | 5 ++- linux-user/sparc/termbits.h | 5 ++- linux-user/syscall.c | 83 ++++++++++++++++++++++++++--------- 8 files changed, 92 insertions(+), 25 deletions(-)
linux-user/alpha/termbits.h +1 -0
@@ -149,6 +149,7 @@ struct target_ktermios {#define TARGET_B3000000 00034#define TARGET_B3500000 00035#define TARGET_B4000000 00036 +#define TARGET_BOTHER 00037#define TARGET_CSIZE 00001400#define TARGET_CS5 00000000
linux-user/generic/termbits.h +1 -1
@@ -157,7 +157,7 @@ struct target_ktermios {#define TARGET_B3000000 0010015#define TARGET_B3500000 0010016#define TARGET_B4000000 0010017 -#define TARGET_CIBAUD 002003600000/* input baud rate (not used) */ +#define TARGET_CIBAUD 002003600000/* input baud rate */ #define TARGET_CMSPAR 010000000000/* mark or space (stick) parity */ #define TARGET_CRTSCTS 020000000000/* flow control */
linux-user/hppa/termbits.h +15 -1
@@ -123,14 +123,28 @@ struct target_ktermios {#define TARGET_HUPCL 0002000#define TARGET_CLOCAL 0004000#define TARGET_CBAUDEX 0010000 +#define TARGET_BOTHER 0010000#define TARGET_B57600 0010001#define TARGET_B115200 0010002#define TARGET_B230400 0010003#define TARGET_B460800 0010004 -#define TARGET_CIBAUD 002003600000/* input baud rate (not used) */ +#define TARGET_B500000 0010005 +#define TARGET_B576000 0010006 +#define TARGET_B921600 0010007 +#define TARGET_B1000000 0010010 +#define TARGET_B1152000 0010011 +#define TARGET_B1500000 0010012 +#define TARGET_B2000000 0010013 +#define TARGET_B2500000 0010014 +#define TARGET_B3000000 0010015 +#define TARGET_B3500000 0010016 +#define TARGET_B4000000 0010017 +#define TARGET_CIBAUD 002003600000/* input baud rate */ #define TARGET_CMSPAR 010000000000/* mark or space (stick) parity */ #define TARGET_CRTSCTS 020000000000/* flow control */ +#define TARGET_IBSHIFT 16/* Shift from CBAUD to CIBAUD */ +/* c_lflag bits */ #define TARGET_ISIG 0000001#define TARGET_ICANON 0000002
linux-user/mips/termbits.h +3 -1
@@ -139,10 +139,12 @@ struct target_ktermios {#define TARGET_B3000000 0010015#define TARGET_B3500000 0010016#define TARGET_B4000000 0010017 -#define TARGET_CIBAUD 002003600000/* input baud rate (not used) */ +#define TARGET_CIBAUD 002003600000/* input baud rate */ #define TARGET_CMSPAR 010000000000/* mark or space (stick) parity */ #define TARGET_CRTSCTS 020000000000/* flow control */ +#define TARGET_IBSHIFT 16/* Shift from CBAUD to CIBAUD */ +/* c_lflag bits */ #define TARGET_ISIG 0000001#define TARGET_ICANON 0000002
linux-user/ppc/termbits.h +1 -0
@@ -129,6 +129,7 @@ struct target_termios {#define TARGET_B3000000 00034#define TARGET_B3500000 00035#define TARGET_B4000000 00036 +#define TARGET_BOTHER 00037#define TARGET_CSIZE 00001400#define TARGET_CS5 00000000
linux-user/sh4/termbits.h +4 -1
@@ -142,6 +142,7 @@ struct target_ktermios {#define TARGET_HUPCL 0002000#define TARGET_CLOCAL 0004000#define TARGET_CBAUDEX 0010000 +#define TARGET_BOTHER 0010000#define TARGET_B57600 0010001#define TARGET_B115200 0010002#define TARGET_B230400 0010003
@@ -157,10 +158,12 @@ struct target_ktermios {#define TARGET_B3000000 0010015#define TARGET_B3500000 0010016#define TARGET_B4000000 0010017 -#define TARGET_CIBAUD 002003600000/* input baud rate (not used) */ +#define TARGET_CIBAUD 002003600000/* input baud rate */ #define TARGET_CMSPAR 010000000000/* mark or space (stick) parity */ #define TARGET_CRTSCTS 020000000000/* flow control */ +#define TARGET_IBSHIFT 16/* Shift from CBAUD to CIBAUD */ +/* c_lflag bits */ #define TARGET_ISIG 0000001#define TARGET_ICANON 0000002
linux-user/sparc/termbits.h +4 -1
@@ -150,6 +150,7 @@ struct target_ktermios {#define TARGET_HUPCL 0x00000400#define TARGET_CLOCAL 0x00000800#define TARGET_CBAUDEX 0x00001000 +#define TARGET_BOTHER 0x00001000/* We'll never see these speeds with the Zilogs, but for completeness... */ #define TARGET_B57600 0x00001001#define TARGET_B115200 0x00001002
@@ -176,10 +177,12 @@ struct target_ktermios {#define B3000000 0x00001011 #define B3500000 0x00001012 #define B4000000 0x00001013 */ -#define TARGET_CIBAUD 0x100f0000/* input baud rate (not used) */ +#define TARGET_CIBAUD 0x100f0000/* input baud rate */ #define TARGET_CMSPAR 0x40000000/* mark or space (stick) parity */ #define TARGET_CRTSCTS 0x80000000/* flow control */ +#define TARGET_IBSHIFT 16/* Shift from CBAUD to CIBAUD */ +/* c_lflag bits */ #define TARGET_ISIG 0x00000001#define TARGET_ICANON 0x00000002
linux-user/syscall.c +63 -20
90 lines not on this page · raw message
Signature · 1 line
2.52.0
Re: [PATCH 7/8] linux-user: Add missing termios baud rates
Quoted 14 lines · Andreas K. Hüttel
From: Vivian Wang <[email protected]>
Add several missing baud rates and inputs baud rates in
cflag_tbl.Add these missing definitions in
termbits.h:-
TARGET_BOTHERfor alpha, hppa, ppc, sh4, sparc
-TARGET_IBSHIFTfor hppa, mips, ppc, sh4, sparc
- Missing standard baud rates for hppaThese are required for the glibc test tst-termios-linux.
Quoted 10 lines
--- linux-user/alpha/termbits.h | 1 + linux-user/generic/termbits.h | 2 +- linux-user/hppa/termbits.h | 16 ++++++- linux-user/mips/termbits.h | 4 +- linux-user/ppc/termbits.h | 1 + linux-user/sh4/termbits.h | 5 ++- linux-user/sparc/termbits.h | 5 ++- linux-user/syscall.c | 83 ++++++++++++++++++++++++++--------- 8 files changed, 92 insertions(+), 25 deletions(-)
Re: [PATCH 7/8] linux-user: Add missing termios baud rates
In reply to Andreas K. HüttelQuoted 6 lines · Andreas K. Hüttel
From: Vivian Wang <[email protected]>
Add several missing baud rates and inputs baud rates in
cflag_tbl.Add these missing definitions in
termbits.h:
Quoted 8 lines
-
TARGET_BOTHERfor alpha, hppa, ppc, sh4, sparc
-TARGET_IBSHIFTfor hppa, mips, ppc, sh4, sparc
- Missing standard baud rates for hppaThese are required for the glibc test tst-termios-linux.
I'm not sure how this kind of situations usually goes, but in case this
matters: I am OK with my patch being here.
PATCH 8/8 linux-user: fixup termios2 related things on PowerPC
In reply to Andreas K. HüttelFrom: Icenowy Zheng <[email protected]>
The termios things on PowerPC equal to termios2 things otherwhere.
Use some simple #define's to allow both termios and termios2 to map to termios on PowerPC.
--- linux-user/syscall.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
linux-user/syscall.c +15 -0
@@ -148,6 +148,21 @@#include "fd-trans.h" #include "user/cpu_loop.h" +#if defined(__powerpc__) +/* +* On PowerPC termios2 is lacking and termios along with ioctls w/o 2 +* behaves like termios2 and things with 2 on other architectures. +* +* Just define termios2-related things to be the same with termios-related +* ones to support PowerPC. +*/ +#define host_termios2 host_termios +#define TCGETS2 TCGETS +#define TCSETS2 TCSETS +#define TCSETSW2 TCSETSW +#define TCSETSF2 TCSETSF +#endif +#ifndef CLONE_IO #define CLONE_IO 0x80000000/* Clone io context */ #endif
Signature · 1 line
2.52.0
Re: [PATCH 8/8] linux-user: fixup termios2 related things on PowerPC
Quoted 7 lines · Andreas K. Hüttel
From: Icenowy Zheng <[email protected]>
The termios things on PowerPC equal to termios2 things otherwhere.
Use some simple #define's to allow both termios and termios2 to map to termios on PowerPC.
Quoted 6 lines
Signed-off-by Icenowy Zheng <[email protected]>--- linux-user/syscall.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Re: [PATCH 8/8] linux-user: fixup termios2 related things on PowerPC
In reply to Andreas K. HüttelQuoted 8 lines · 在 2026-01-03星期六的 16:25 +0100,Andreas K. Hüttel写道:
From: Icenowy Zheng <[email protected]>
The termios things on PowerPC equal to termios2 things otherwhere.
Use some simple #define's to allow both termios and termios2 to map to
termios on PowerPC.
Quoted 5 lines
Signed-off-by Icenowy Zheng <[email protected]>Link:
https://github.com/AOSC-Dev/aosc-os-abbs/blob/8d77eeaa76e9b159c3f35adaf73c875751aa7d17/app-virtualization/qemu/01-shared/patches/0005-AOSCOS-linux-user-fixup-termios2-related-things-on-P.patch
Link:
https://lore.kernel.org/qemu-devel/[email protected]
To be honest, for better bisectibility, it might be more proper to put this patch as the first (before implementing termios2 in syscall.c), otherwise when bisecting on PowerPC host the commits between them are unbuildable.
Quoted 33 lines
---
linux-user/syscall.c | 15 +++++++++++++++1 file changed, 15 insertions(+)linux-user/syscall.c +0
-0@@ -148,6 +148,21 @@ #include "fd-trans.h" #include "user/cpu_loop.h"linux-user/syscall.c +3
-0+#if defined(__powerpc__) +/* +* On PowerPC termios2 is lacking and termios along with ioctls w/o 2
+ * behaves like termios2 and things with 2 on other architectures.
+ *
+ * Just define termios2-related things to be the same with termios- related
+ * ones to support PowerPC.
+ */linux-user/syscall.c +7
-0+#define host_termios2 host_termios +#define TCGETS2 TCGETS +#define TCSETS2 TCSETS +#define TCSETSW2 TCSETSW +#define TCSETSF2 TCSETSF +#endif +#ifndef
CLONE_IO
#define CLONE_IO 0x80000000 /* Clone io context */
#endif