diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2020-09-01 14:41:54 -0700 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2020-09-09 17:53:10 -0700 |
commit | 4332affa833c6a11326aa5db366419ba7445cdaf (patch) | |
tree | 2aa053f1dae3f77fcf5a53ef49408d86eb7f23b3 /test/util | |
parent | 6b992edc8ab85070f50a6860b936b6cef82d48f8 (diff) |
Refactor tty codebase to use master-replica terminology.
Updates #2972
PiperOrigin-RevId: 329584905
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/pty_util.cc | 10 | ||||
-rw-r--r-- | test/util/pty_util.h | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/test/util/pty_util.cc b/test/util/pty_util.cc index 5fa622922..2cf0bea74 100644 --- a/test/util/pty_util.cc +++ b/test/util/pty_util.cc @@ -23,25 +23,25 @@ namespace gvisor { namespace testing { -PosixErrorOr<FileDescriptor> OpenReplica(const FileDescriptor& main) { - PosixErrorOr<int> n = ReplicaID(main); +PosixErrorOr<FileDescriptor> OpenReplica(const FileDescriptor& master) { + PosixErrorOr<int> n = ReplicaID(master); if (!n.ok()) { return PosixErrorOr<FileDescriptor>(n.error()); } return Open(absl::StrCat("/dev/pts/", n.ValueOrDie()), O_RDWR | O_NONBLOCK); } -PosixErrorOr<int> ReplicaID(const FileDescriptor& main) { +PosixErrorOr<int> ReplicaID(const FileDescriptor& master) { // Get pty index. int n; - int ret = ioctl(main.get(), TIOCGPTN, &n); + int ret = ioctl(master.get(), TIOCGPTN, &n); if (ret < 0) { return PosixError(errno, "ioctl(TIOCGPTN) failed"); } // Unlock pts. int unlock = 0; - ret = ioctl(main.get(), TIOCSPTLCK, &unlock); + ret = ioctl(master.get(), TIOCSPTLCK, &unlock); if (ret < 0) { return PosixError(errno, "ioctl(TIOSPTLCK) failed"); } diff --git a/test/util/pty_util.h b/test/util/pty_util.h index dff6adab5..ed7658868 100644 --- a/test/util/pty_util.h +++ b/test/util/pty_util.h @@ -21,11 +21,11 @@ namespace gvisor { namespace testing { -// Opens the replica end of the passed main as R/W and nonblocking. -PosixErrorOr<FileDescriptor> OpenReplica(const FileDescriptor& main); +// Opens the replica end of the passed master as R/W and nonblocking. +PosixErrorOr<FileDescriptor> OpenReplica(const FileDescriptor& master); -// Get the number of the replica end of the main. -PosixErrorOr<int> ReplicaID(const FileDescriptor& main); +// Get the number of the replica end of the master. +PosixErrorOr<int> ReplicaID(const FileDescriptor& master); } // namespace testing } // namespace gvisor |