James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 2 | From: PJ Reiniger <pj.reiniger@gmail.com> |
| 3 | Date: Tue, 26 Apr 2022 15:24:47 -0400 |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 4 | Subject: [PATCH 05/10] Cleanup problematic language |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 5 | |
| 6 | --- |
| 7 | src/unix/tty.c | 21 +++++++++++---------- |
| 8 | 1 file changed, 11 insertions(+), 10 deletions(-) |
| 9 | |
| 10 | diff --git a/src/unix/tty.c b/src/unix/tty.c |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 11 | index d099bdb3b677212d21e06ac7bb1031c8e5386499..1bd217b5a15eed13a8349c479b53471dd36ca216 100644 |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 12 | --- a/src/unix/tty.c |
| 13 | +++ b/src/unix/tty.c |
| 14 | @@ -79,7 +79,7 @@ int uv__tcsetattr(int fd, int how, const struct termios *term) { |
| 15 | return 0; |
| 16 | } |
| 17 | |
| 18 | -static int uv__tty_is_slave(const int fd) { |
| 19 | +static int uv__tty_is_peripheral(const int fd) { |
| 20 | int result; |
James Kuszmaul | b13e13f | 2023-11-22 20:44:04 -0800 | [diff] [blame^] | 21 | #if defined(__linux__) || defined(__FreeBSD__) |
James Kuszmaul | cf32412 | 2023-01-14 14:07:17 -0800 | [diff] [blame] | 22 | int dummy; |
| 23 | @@ -91,15 +91,16 @@ static int uv__tty_is_slave(const int fd) { |
| 24 | result = ioctl(fd, TIOCPTYGNAME, &dummy) != 0; |
| 25 | #elif defined(__NetBSD__) |
| 26 | /* |
| 27 | - * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the slave |
| 28 | - * device name for both descriptors, the master one and slave one. |
| 29 | + * NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the |
| 30 | + * peripheral device name for both descriptors, the controller one and |
| 31 | + * peripheral one. |
| 32 | * |
| 33 | * Implement function to compare major device number with pts devices. |
| 34 | * |
| 35 | * The major numbers are machine-dependent, on NetBSD/amd64 they are |
| 36 | * respectively: |
| 37 | - * - master tty: ptc - major 6 |
| 38 | - * - slave tty: pts - major 5 |
| 39 | + * - controller tty: ptc - major 6 |
| 40 | + * - peripheral tty: pts - major 5 |
| 41 | */ |
| 42 | |
| 43 | struct stat sb; |
| 44 | @@ -174,12 +175,12 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int unused) { |
| 45 | * other processes. |
| 46 | */ |
| 47 | if (type == UV_TTY) { |
| 48 | - /* Reopening a pty in master mode won't work either because the reopened |
| 49 | - * pty will be in slave mode (*BSD) or reopening will allocate a new |
| 50 | - * master/slave pair (Linux). Therefore check if the fd points to a |
| 51 | - * slave device. |
| 52 | + /* Reopening a pty in controller mode won't work either because the reopened |
| 53 | + * pty will be in peripheral mode (*BSD) or reopening will allocate a new |
| 54 | + * controller/peripheral pair (Linux). Therefore check if the fd points to a |
| 55 | + * peripheral device. |
| 56 | */ |
| 57 | - if (uv__tty_is_slave(fd) && ttyname_r(fd, path, sizeof(path)) == 0) |
| 58 | + if (uv__tty_is_peripheral(fd) && ttyname_r(fd, path, sizeof(path)) == 0) |
| 59 | r = uv__open_cloexec(path, mode | O_NOCTTY); |
| 60 | else |
| 61 | r = -1; |