golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.31k stars 17.58k forks source link

x/sys/unix: If mips64le termios Ispeed and Ospeed can work #37208

Open Doorer opened 4 years ago

Doorer commented 4 years ago

In mips64le , The Termios struct doesn't has member Ospeed or Ispeed struct termios { tcflag_t c_iflag; / input mode flags / tcflag_t c_oflag; / output mode flags / tcflag_t c_cflag; / control mode flags / tcflag_t c_lflag; / local mode flags / cc_t c_line; / line discipline / cc_t c_cc[NCCS]; / control characters / };

In golang/sys/unix/ztypes_linux_mips64le.go, I found this define Termios struct { Iflag uint32 Oflag uint32 Cflag uint32 Lflag uint32 Line uint8 Cc [23]uint8 Ispeed uint32 Ospeed uint32 } Will the member Ispped and Ospeed can work ?

What version of Go are you using (go version)?

$ go version
go version go1.13.3 linux/mips64le

Does this issue reproduce with the latest release?

I think so

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="mips64le"
GOBIN=""
GOCACHE="/home/jlzhang/.cache/go-build"
GOENV="/home/jlzhang/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="mips64le"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jlzhang/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_mips64le"
GCCGO="gccgo"
GOMIPS64="hardfloat"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -mabi=64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build438676280=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I use termios ,but can not work. I found the diffrent between syscall and unix

no

What did you expect to see?

no

What did you see instead?

no

tklauser commented 4 years ago

On systems which have TCSETS2set, type Termios actually gets generated from struct termios2, which seems to be the case for mips64{,le}:

https://github.com/golang/sys/blob/12a6c2dcc1e4cb348b57847c73987099e261714b/unix/linux/types.go#L189-L194

The version in syscall was probably generated from struct termios which is why you don't see the [IO]speed members.

dmitshur commented 4 years ago

@Doorer Thanks for reporting, please let us know if @tklauser's comment helps you.

If not, this issue is hard to understand right now, which makes it hard to investigate. Can you please fill in the "What did you expect to see?" and "What did you see instead?" sections? Also, in the "What did you do?" section, can you show code that you've tried? Thanks!

Doorer commented 4 years ago

think you , I find the termios2 struct

Doorer commented 4 years ago

On systems which have TCSETS2set, type Termios actually gets generated from struct termios2, which seems to be the case for mips64{,le}:

https://github.com/golang/sys/blob/12a6c2dcc1e4cb348b57847c73987099e261714b/unix/linux/types.go#L189-L194

The version in syscall was probably generated from struct termios which is why you don't see the [IO]speed members.

think you , I find the termios2 struct will the golang/syscall use the termios which with Ispeed and Ospeed for mips

tklauser commented 4 years ago

There‘s currently no test case involving The [IO]speed members of Termios in x/sys/unix. Patches welcome.