SIGN IN SIGN UP

unix: stop generating sparc termbits from the generic header

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.

TIOCSER_TEMT moves to zerrors_linux.go: sparc64 now agrees with every
other architecture, so mkmerge hoists it.

Updates golang/go#55000

Change-Id: I53fb230b3b341f10c88e633cac2c4a7c6718a210
GitHub-Last-Rev: 3e111d14b58ce443cf04c730ce15fc62855cf54a
GitHub-Pull-Request: golang/sys#288
Reviewed-on: https://go-review.googlesource.com/c/sys/+/820180
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
S
Stian Halseth committed
d429e20367b198593bc9d6e1babac786eafb5434
Parent: bd3bddf
Committed by Gopher Robot <gobot@golang.org> on 8/26/2026, 5:28:52 PM