From 7dc38fb350b1d71383eed149e73acb7bae231ddb Mon Sep 17 00:00:00 2001 From: Keith Rarick Date: Wed, 30 Jan 2019 17:10:33 -0800 Subject: [PATCH] remove deprecated nomenclature The words "master" and "slave" in this context are both harmful and, as a technical matter, confusing and misleading. It was never my intention to use those terms in this library, but they snuck in while I wasn't paying attention. This change replaces them with "pty" and "tty", respectively, to be consistent with the other files in this package and with the device names on BSD platforms. These terms are not harmful (to the best of my knowledge) and they're more specific. In editing the comment in pty_linux.go, this patch also corrects a factual error. The ioctl argument is not "zero valued", it is a nonzero pointer to the number 0. --- pty_linux.go | 2 +- pty_openbsd.go | 2 +- util.go | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pty_linux.go b/pty_linux.go index 296dd21..4a833de 100644 --- a/pty_linux.go +++ b/pty_linux.go @@ -46,6 +46,6 @@ func ptsname(f *os.File) (string, error) { func unlockpt(f *os.File) error { var u _C_int - // use TIOCSPTLCK with a zero valued arg to clear the slave pty lock + // use TIOCSPTLCK with a pointer to zero to clear the lock return ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u))) } diff --git a/pty_openbsd.go b/pty_openbsd.go index 6e7aeae..a6a35d1 100644 --- a/pty_openbsd.go +++ b/pty_openbsd.go @@ -11,7 +11,7 @@ func open() (pty, tty *os.File, err error) { * from ptm(4): * The PTMGET command allocates a free pseudo terminal, changes its * ownership to the caller, revokes the access privileges for all previous - * users, opens the file descriptors for the master and slave devices and + * users, opens the file descriptors for the pty and tty devices and * returns them to the caller in struct ptmget. */ diff --git a/util.go b/util.go index 68a8584..2fa741c 100644 --- a/util.go +++ b/util.go @@ -8,15 +8,15 @@ import ( "unsafe" ) -// InheritSize applies the terminal size of master to slave. This should be run -// in a signal handler for syscall.SIGWINCH to automatically resize the slave when -// the master receives a window size change notification. -func InheritSize(master, slave *os.File) error { - size, err := GetsizeFull(master) +// InheritSize applies the terminal size of pty to tty. This should be run +// in a signal handler for syscall.SIGWINCH to automatically resize the tty when +// the pty receives a window size change notification. +func InheritSize(pty, tty *os.File) error { + size, err := GetsizeFull(pty) if err != nil { return err } - err = Setsize(slave, size) + err = Setsize(tty, size) if err != nil { return err }