-
Notifications
You must be signed in to change notification settings - Fork 18k
x/sys/unix: add portable speed accessor methods to Termios #18866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think your code should use build tags if you want to set these fields. |
These two fields aren't standard. An excerpt from http://man7.org/linux/man-pages/man3/termios.3.html:
Looking at glibc's sysdeps/unix/sysv/linux/speed.c, you might want to use something like:
(didn't see Cherry's comment.) |
I don't think there is much we can do here. The structs really are different on different architectures. Changing the structs would mean that they would no longer work with the relevant ioctls. In the golang.org/x/sys repo we could add accessor methods for these fields. That is probably our best available approach going forward. I'll repurpose this issue for that. |
@cherrymui, @vstefanovic, @ianlancetaylor thank you for your prompt and useful feedback. I didn't realize the intricacies of POSIX termios; this is actually the first platform I've had issues with! But I now have enough to move on! Thanks. |
In current master I see:
(same for Ospeed) They were added by https://golang.org/cl/17185, but only for 386, amd64, arm, arm64, ppc64 and ppc64le. When https://golang.org/cl/37943 regenerated all go files from unified sources, they were added |
Sounds like the answer is to use golang.org/x/sys/unix then. Closing this, but let me know if that doesn't work. |
Attempting to use the
Ispeed
andOspeed
members ofsyscall.Termios
on mipsle fails with a compile error using go1.8rc3, compiling on Darwin:Using this example program:
However compilation is successful for arm, ppc64le and darwin using the same toolchain.
If I comment out the
Ispeed
andOspeed
initializers compile and run on a mipsle platform (an Omega2 from Onion), the program produces the following output:Compared to this on darwin:
For reference, this is the output of
go1.8rc3 env
:The text was updated successfully, but these errors were encountered: