From d45e3a0228469f9aed37d339c432109ec8f14347 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 28 Jul 2017 14:36:07 +0200 Subject: [PATCH] ssh/terminal: use termios ioctl read/write constants from x/sys/unix Use the TCGETS/TCSETS and TIOCGETA/TIOCSETA definitions from x/sys/unix instead of manually declaring them or using the corresponding definitions from syscall. Change-Id: I37c2c8124d251eb47467b4184a7cc39781775f11 Reviewed-on: https://go-review.googlesource.com/51690 Reviewed-by: Matt Layher Reviewed-by: Brad Fitzpatrick Run-TryBot: Matt Layher TryBot-Result: Gobot Gobot --- util_bsd.go | 6 +++--- util_linux.go | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/util_bsd.go b/util_bsd.go index 9c1ffd1..cb23a59 100644 --- a/util_bsd.go +++ b/util_bsd.go @@ -6,7 +6,7 @@ package terminal -import "syscall" +import "golang.org/x/sys/unix" -const ioctlReadTermios = syscall.TIOCGETA -const ioctlWriteTermios = syscall.TIOCSETA +const ioctlReadTermios = unix.TIOCGETA +const ioctlWriteTermios = unix.TIOCSETA diff --git a/util_linux.go b/util_linux.go index 5883b22..5fadfe8 100644 --- a/util_linux.go +++ b/util_linux.go @@ -4,8 +4,7 @@ package terminal -// These constants are declared here, rather than importing -// them from the syscall package as some syscall packages, even -// on linux, for example gccgo, do not declare them. -const ioctlReadTermios = 0x5401 // syscall.TCGETS -const ioctlWriteTermios = 0x5402 // syscall.TCSETS +import "golang.org/x/sys/unix" + +const ioctlReadTermios = unix.TCGETS +const ioctlWriteTermios = unix.TCSETS