unix: stop generating sparc termbits from the generic header - #288
unix: stop generating sparc termbits from the generic header#288shalseth wants to merge 1 commit into
Conversation
|
This PR (HEAD: d775441) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/820180. Important tips:
|
|
Message from Ian Lance Taylor: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/820180. |
mkerrors.sh takes the generic termbits header on sparc rather than the architecture's own: #if defined(__sparc__) #include <asm-generic/termbits.h> #else #include <asm/termbits.h> #endif sparc's termbits differs from the generic one, so the constants it produces for that architecture are wrong. VMIN is the clearest case: sparc defines it as an alias, #define VMIN VEOF with VEOF 4, where the generic header defines a literal 6. Raw mode is termios.Cc[unix.VMIN] = 1 in moby/term, containerd/console and x/term alike, so with 6 the assignment lands in a slot nothing reads, the real VMIN keeps its default of 4, and reads on a terminal block until four bytes arrive. On sparc64 that made interactive docker run -it deliver stdin in 4-byte groups. It is not only VMIN. Switching to the architecture's header changes 25 constants. The baud rates are the most visible: B1000000 is 0x100c on sparc but 0x1008 is generated, and B2500000, B3000000, B3500000 and B4000000 do not exist on sparc while B76800, B153600, B307200 and B614400 do and are absent. FLUSHO, WRAP, VDSUSP, TIOCM_LOOP, TIOCM_OUT1, TIOCM_OUT2, TIOCSER_TEMT, VEOL and VEOL2 are also affected. The comment justifies the workaround by a struct redefinition clashing with glibc, but that cannot arise here: the include block is used in exactly one place, the $CC -x c - -E -dM pass, which only preprocesses. Feeding it both <termios.h> and <asm/termbits.h> on sparc64 emits every macro with empty stderr. No other architecture is affected, since they already took the #else branch. Verified by running mkerrors.sh on an UltraSPARC T4-1: unmodified it reproduces the checked-in VMIN=0x6, VEOL=0xb, VEOL2=0x10, and with this change it produces 0x4, 0x5, 0x6. zerrors_linux_sparc64.go still needs regenerating through the Docker pipeline to pick these up; this CL only corrects the generator. Updates golang/go#55000 Change-Id: I75880b535aac0b76e7ff6ab85c1db3af7c993770
d775441 to
7ed5963
Compare
|
This PR (HEAD: 7ed5963) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/sys/+/820180. Important tips:
|
|
Message from Stian Halseth: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/820180. |
|
Message from Ian Lance Taylor: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/820180. |
|
Message from Stian Halseth: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/820180. |
|
Message from Ian Lance Taylor: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/820180. |
mkerrors.sh takes the generic termbits header on sparc rather than the
architecture's own:
sparc's termbits differs from the generic one, so the constants it produces
for that architecture are wrong. VMIN is the clearest case: sparc defines it
as an alias, #define VMIN VEOF with VEOF 4, where the generic header defines
a literal 6. Raw mode is termios.Cc[unix.VMIN] = 1 in moby/term,
containerd/console and x/term alike, so with 6 the assignment lands in a
slot nothing reads, the real VMIN keeps its default of 4, and reads on a
terminal block until four bytes arrive. On sparc64 that made interactive
docker run -it deliver stdin in 4-byte groups.
It is not only VMIN. Switching to the architecture's header changes 25
constants. The baud rates are the most visible: B1000000 is 0x100c on
sparc but 0x1008 is generated, and B2500000, B3000000, B3500000 and
B4000000 do not exist on sparc while B76800, B153600, B307200 and B614400
do and are absent. FLUSHO, WRAP, VDSUSP, TIOCM_LOOP, TIOCM_OUT1,
TIOCM_OUT2, TIOCSER_TEMT, VEOL and VEOL2 are also affected.
The comment justifies the workaround by a struct redefinition clashing with
glibc, but that cannot arise here: the include block is used in exactly one
place, the $CC -x c - -E -dM pass, which only preprocesses. Feeding it both
<termios.h> and <asm/termbits.h> on sparc64 emits every macro with empty
stderr.
No other architecture is affected, since they already took the #else branch.
Verified by running mkerrors.sh on an UltraSPARC T4-1: unmodified it
reproduces the checked-in VMIN=0x6, VEOL=0xb, VEOL2=0x10, and with this
change it produces 0x4, 0x5, 0x6.
zerrors_linux_sparc64.go still needs regenerating through the Docker
pipeline to pick these up; this CL only corrects the generator.
Updates golang/go#55000