[Lldb-commits] [PATCH] D113687: [lldb][NFC] Inclusive language: replace master/slave names for ptys

2021-11-12 Thread Quinn Pham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52a3ed5b93ca: [lldb][NFC] Inclusive language: replace 
master/slave names for ptys (authored by quinnp).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113687/new/

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 _editline_sp;
 
   PseudoTerminal _pty;
-  int _pty_master_fd;
+  int _pty_primary_fd;
   int _pty_secondary_fd;
 
   std::unique_ptr _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, 

[Lldb-commits] [PATCH] D113687: [lldb][NFC] Inclusive language: replace master/slave names for ptys

2021-11-11 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113687/new/

https://reviews.llvm.org/D113687

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D113687: [lldb][NFC] Inclusive language: replace master/slave names for ptys

2021-11-11 Thread Quinn Pham via Phabricator via lldb-commits
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 _editline_sp;
 
   PseudoTerminal _pty;
-  int _pty_master_fd;
+  int _pty_primary_fd;
   int _pty_secondary_fd;
 
   std::unique_ptr _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 @@