Skip to content

Commit

Permalink
remove deprecated nomenclature
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kr committed Jan 31, 2019
1 parent 3825892 commit 7dc38fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pty_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
2 changes: 1 addition & 1 deletion pty_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/

Expand Down
12 changes: 6 additions & 6 deletions util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7dc38fb

Please sign in to comment.