quinnp created this revision.
quinnp requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
[NFC] This patch replaces master and slave with primary and secondary
respectively when referening to pseudoterminals/file descriptors.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D113687
Files:
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/test/API/functionalities/gdb_remote_client/TestPty.py
lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
lldb/test/API/tools/lldb-server/TestPtyServer.py
lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
lldb/unittests/Editline/EditlineTest.cpp
Index: lldb/unittests/Editline/EditlineTest.cpp
===================================================================
--- lldb/unittests/Editline/EditlineTest.cpp
+++ lldb/unittests/Editline/EditlineTest.cpp
@@ -87,24 +87,24 @@
std::unique_ptr<lldb_private::Editline> _editline_sp;
PseudoTerminal _pty;
- int _pty_master_fd;
+ int _pty_primary_fd;
int _pty_secondary_fd;
std::unique_ptr<FilePointer> _el_secondary_file;
};
EditlineAdapter::EditlineAdapter()
- : _editline_sp(), _pty(), _pty_master_fd(-1), _pty_secondary_fd(-1),
+ : _editline_sp(), _pty(), _pty_primary_fd(-1), _pty_secondary_fd(-1),
_el_secondary_file() {
lldb_private::Status error;
- // Open the first master pty available.
+ // Open the first primary pty available.
EXPECT_THAT_ERROR(_pty.OpenFirstAvailablePrimary(O_RDWR), llvm::Succeeded());
- // Grab the master fd. This is a file descriptor we will:
+ // Grab the primary fd. This is a file descriptor we will:
// (1) write to when we want to send input to editline.
// (2) read from when we want to see what editline sends back.
- _pty_master_fd = _pty.GetPrimaryFileDescriptor();
+ _pty_primary_fd = _pty.GetPrimaryFileDescriptor();
// Open the corresponding secondary pty.
EXPECT_THAT_ERROR(_pty.OpenSecondary(O_RDWR), llvm::Succeeded());
@@ -140,13 +140,13 @@
// Write the line out to the pipe connected to editline's input.
ssize_t input_bytes_written =
- ::write(_pty_master_fd, line.c_str(),
+ ::write(_pty_primary_fd, line.c_str(),
line.length() * sizeof(std::string::value_type));
const char *eoln = "\n";
const size_t eoln_length = strlen(eoln);
input_bytes_written =
- ::write(_pty_master_fd, eoln, eoln_length * sizeof(char));
+ ::write(_pty_primary_fd, eoln, eoln_length * sizeof(char));
EXPECT_NE(-1, input_bytes_written) << strerror(errno);
EXPECT_EQ(eoln_length * sizeof(char), size_t(input_bytes_written));
@@ -205,7 +205,7 @@
}
void EditlineAdapter::ConsumeAllOutput() {
- FilePointer output_file(fdopen(_pty_master_fd, "r"));
+ FilePointer output_file(fdopen(_pty_primary_fd, "r"));
int ch;
while ((ch = fgetc(output_file)) != EOF) {
Index: lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
===================================================================
--- lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
+++ lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py
@@ -229,7 +229,7 @@
pid, fd = _fork_pty.fork_pty()
# Some platforms must call setwinsize() and setecho() from the
- # child process, and others from the master process. We do both,
+ # child process, and others from the primary process. We do both,
# allowing IOError for either.
if pid == CHILD:
Index: lldb/test/API/tools/lldb-server/TestPtyServer.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestPtyServer.py
+++ lldb/test/API/tools/lldb-server/TestPtyServer.py
@@ -15,10 +15,10 @@
super().setUp()
import pty
import tty
- master, slave = pty.openpty()
- tty.setraw(master)
- self._master = io.FileIO(master, 'r+b')
- self._slave = io.FileIO(slave, 'r+b')
+ primary, secondary = pty.openpty()
+ tty.setraw(primary)
+ self._primary = io.FileIO(primary, 'r+b')
+ self._secondary = io.FileIO(secondary, 'r+b')
def get_debug_monitor_command_line_args(self, attach_pid=None):
commandline_args = self.debug_monitor_extra_args
@@ -28,7 +28,7 @@
libc = ctypes.CDLL(None)
libc.ptsname.argtypes = (ctypes.c_int,)
libc.ptsname.restype = ctypes.c_char_p
- pty_path = libc.ptsname(self._master.fileno()).decode()
+ pty_path = libc.ptsname(self._primary.fileno()).decode()
commandline_args += ["serial://%s" % (pty_path,)]
return commandline_args
@@ -48,7 +48,7 @@
def recv(self, count):
return self.fd.read(count)
- self.sock = FakeSocket(self._master)
+ self.sock = FakeSocket(self._primary)
self._server = Server(self.sock, server)
return server
Index: lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
+++ lldb/test/API/functionalities/gdb_remote_client/gdbclientutils.py
@@ -420,27 +420,27 @@
def __init__(self):
import pty
import tty
- master, slave = pty.openpty()
- tty.setraw(master)
- self._master = io.FileIO(master, 'r+b')
- self._slave = io.FileIO(slave, 'r+b')
+ primary, secondary = pty.openpty()
+ tty.setraw(primary)
+ self._primary = io.FileIO(primary, 'r+b')
+ self._secondary = io.FileIO(secondary, 'r+b')
def get_connect_address(self):
libc = ctypes.CDLL(None)
libc.ptsname.argtypes = (ctypes.c_int,)
libc.ptsname.restype = ctypes.c_char_p
- return libc.ptsname(self._master.fileno()).decode()
+ return libc.ptsname(self._primary.fileno()).decode()
def get_connect_url(self):
return "serial://" + self.get_connect_address()
def close_server(self):
- self._slave.close()
- self._master.close()
+ self._secondary.close()
+ self._primary.close()
def recv(self):
try:
- return self._master.read(4096)
+ return self._primary.read(4096)
except OSError as e:
# closing the pty results in EIO on Linux, convert it to EOF
if e.errno == errno.EIO:
@@ -448,7 +448,7 @@
raise
def sendall(self, data):
- return self._master.write(data)
+ return self._primary.write(data)
class MockGDBServer:
Index: lldb/test/API/functionalities/gdb_remote_client/TestPty.py
===================================================================
--- lldb/test/API/functionalities/gdb_remote_client/TestPty.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestPty.py
@@ -11,7 +11,7 @@
def get_term_attrs(self):
import termios
- return termios.tcgetattr(self.server._socket._slave)
+ return termios.tcgetattr(self.server._socket._secondary)
def setUp(self):
super().setUp()
Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -4465,7 +4465,7 @@
protected:
Process *m_process;
NativeFile m_read_file; // Read from this file (usually actual STDIN for LLDB
- NativeFile m_write_file; // Write to this file (usually the master pty for
+ NativeFile m_write_file; // Write to this file (usually the primary pty for
// getting io to debuggee)
Pipe m_pipe;
std::atomic<bool> m_is_running{false};
Index: lldb/source/Target/Platform.cpp
===================================================================
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -1110,7 +1110,7 @@
// If we didn't have any file actions, the pseudo terminal might have
// been used where the secondary side was given as the file to open for
- // stdin/out/err after we have already opened the master so we can
+ // stdin/out/err after we have already opened the primary so we can
// read/write stdin/out/err.
int pty_fd = launch_info.GetPTY().ReleasePrimaryFileDescriptor();
if (pty_fd != PseudoTerminal::invalid_fd) {
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -286,7 +286,7 @@
if (should_forward_stdio) {
// nullptr means it's not redirected to file or pty (in case of LLGS local)
// at least one of stdio will be transferred pty<->gdb-remote we need to
- // give the pty master handle to this object to read and/or write
+ // give the pty primary handle to this object to read and/or write
LLDB_LOG(log,
"pid = {0}: setting up stdout/stderr redirection via $O "
"gdb-remote commands",
Index: lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
===================================================================
--- lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
+++ lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
@@ -621,7 +621,7 @@
lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
MainLoop &mainloop) const {
Error E = Error::success();
- // Set pty master fd invalid since it is not available.
+ // Set pty primary fd invalid since it is not available.
auto process_up = std::unique_ptr<NativeProcessWindows>(
new NativeProcessWindows(pid, -1, native_delegate, E));
if (E)
Index: lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
===================================================================
--- lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
+++ lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm
@@ -399,8 +399,8 @@
case FileAction::eFileActionOpen: {
FileSpec file_spec = file_action->GetFileSpec();
if (file_spec) {
- const int master_fd = launch_info.GetPTY().GetPrimaryFileDescriptor();
- if (master_fd != PseudoTerminal::invalid_fd) {
+ const int primary_fd = launch_info.GetPTY().GetPrimaryFileDescriptor();
+ if (primary_fd != PseudoTerminal::invalid_fd) {
// Check in case our file action open wants to open the secondary
FileSpec secondary_spec(launch_info.GetPTY().GetSecondaryName());
if (file_spec == secondary_spec) {
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits