forked from OSchip/llvm-project
[lldb/debugserver] Rename Master/Slave to Primary/Secondary (NFC)
This commit is contained in:
parent
6752786d65
commit
0965b59bf4
|
@ -1154,7 +1154,7 @@
|
||||||
2008-02-14 Jason Molenda (jmolenda@apple.com)
|
2008-02-14 Jason Molenda (jmolenda@apple.com)
|
||||||
|
|
||||||
* MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
|
* MachProcess.cpp: (MachProcess::SBForkChildForPTraceDebugging):
|
||||||
Set mode bits on slave side of pty.
|
Set mode bits on secondary side of pty.
|
||||||
|
|
||||||
2008-02-12 Greg Clayton <gclayton@apple.com>
|
2008-02-12 Greg Clayton <gclayton@apple.com>
|
||||||
|
|
||||||
|
|
|
@ -3255,9 +3255,9 @@ pid_t MachProcess::PosixSpawnChildForPTraceDebugging(
|
||||||
if (file_actions_valid) {
|
if (file_actions_valid) {
|
||||||
if (stdin_path == NULL && stdout_path == NULL && stderr_path == NULL &&
|
if (stdin_path == NULL && stdout_path == NULL && stderr_path == NULL &&
|
||||||
!no_stdio) {
|
!no_stdio) {
|
||||||
pty_error = pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY);
|
pty_error = pty.OpenFirstAvailablePrimary(O_RDWR | O_NOCTTY);
|
||||||
if (pty_error == PseudoTerminal::success) {
|
if (pty_error == PseudoTerminal::success) {
|
||||||
stdin_path = stdout_path = stderr_path = pty.SlaveName();
|
stdin_path = stdout_path = stderr_path = pty.SecondaryName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3332,8 +3332,8 @@ pid_t MachProcess::PosixSpawnChildForPTraceDebugging(
|
||||||
|
|
||||||
if (pty_error == 0) {
|
if (pty_error == 0) {
|
||||||
if (process != NULL) {
|
if (process != NULL) {
|
||||||
int master_fd = pty.ReleaseMasterFD();
|
int primary_fd = pty.ReleasePrimaryFD();
|
||||||
process->SetChildFileDescriptors(master_fd, master_fd, master_fd);
|
process->SetChildFileDescriptors(primary_fd, primary_fd, primary_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::posix_spawnattr_destroy(&attr);
|
::posix_spawnattr_destroy(&attr);
|
||||||
|
@ -3430,10 +3430,10 @@ pid_t MachProcess::ForkChildForPTraceDebugging(const char *path,
|
||||||
::setpgid(pid, pid); // Set the child process group to match its pid
|
::setpgid(pid, pid); // Set the child process group to match its pid
|
||||||
|
|
||||||
if (process != NULL) {
|
if (process != NULL) {
|
||||||
// Release our master pty file descriptor so the pty class doesn't
|
// Release our primary pty file descriptor so the pty class doesn't
|
||||||
// close it and so we can continue to use it in our STDIO thread
|
// close it and so we can continue to use it in our STDIO thread
|
||||||
int master_fd = pty.ReleaseMasterFD();
|
int primary_fd = pty.ReleasePrimaryFD();
|
||||||
process->SetChildFileDescriptors(master_fd, master_fd, master_fd);
|
process->SetChildFileDescriptors(primary_fd, primary_fd, primary_fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pid;
|
return pid;
|
||||||
|
@ -3606,15 +3606,15 @@ pid_t MachProcess::SBForkChildForPTraceDebugging(
|
||||||
PseudoTerminal pty;
|
PseudoTerminal pty;
|
||||||
if (!no_stdio) {
|
if (!no_stdio) {
|
||||||
PseudoTerminal::Status pty_err =
|
PseudoTerminal::Status pty_err =
|
||||||
pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY);
|
pty.OpenFirstAvailablePrimary(O_RDWR | O_NOCTTY);
|
||||||
if (pty_err == PseudoTerminal::success) {
|
if (pty_err == PseudoTerminal::success) {
|
||||||
const char *slave_name = pty.SlaveName();
|
const char *secondary_name = pty.SecondaryName();
|
||||||
DNBLogThreadedIf(LOG_PROCESS,
|
DNBLogThreadedIf(LOG_PROCESS,
|
||||||
"%s() successfully opened master pty, slave is %s",
|
"%s() successfully opened primary pty, secondary is %s",
|
||||||
__FUNCTION__, slave_name);
|
__FUNCTION__, secondary_name);
|
||||||
if (slave_name && slave_name[0]) {
|
if (secondary_name && secondary_name[0]) {
|
||||||
::chmod(slave_name, S_IRWXU | S_IRWXG | S_IRWXO);
|
::chmod(secondary_name, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
stdio_path.SetFileSystemRepresentation(slave_name);
|
stdio_path.SetFileSystemRepresentation(secondary_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3671,10 +3671,10 @@ pid_t MachProcess::SBForkChildForPTraceDebugging(
|
||||||
CFRelease(bundleIDCFStr);
|
CFRelease(bundleIDCFStr);
|
||||||
if (pid_found) {
|
if (pid_found) {
|
||||||
if (process != NULL) {
|
if (process != NULL) {
|
||||||
// Release our master pty file descriptor so the pty class doesn't
|
// Release our primary pty file descriptor so the pty class doesn't
|
||||||
// close it and so we can continue to use it in our STDIO thread
|
// close it and so we can continue to use it in our STDIO thread
|
||||||
int master_fd = pty.ReleaseMasterFD();
|
int primary_fd = pty.ReleasePrimaryFD();
|
||||||
process->SetChildFileDescriptors(master_fd, master_fd, master_fd);
|
process->SetChildFileDescriptors(primary_fd, primary_fd, primary_fd);
|
||||||
}
|
}
|
||||||
DNBLogThreadedIf(LOG_PROCESS, "%s() => pid = %4.4x", __FUNCTION__, pid);
|
DNBLogThreadedIf(LOG_PROCESS, "%s() => pid = %4.4x", __FUNCTION__, pid);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3807,17 +3807,17 @@ pid_t MachProcess::BoardServiceForkChildForPTraceDebugging(
|
||||||
PseudoTerminal pty;
|
PseudoTerminal pty;
|
||||||
if (!no_stdio) {
|
if (!no_stdio) {
|
||||||
PseudoTerminal::Status pty_err =
|
PseudoTerminal::Status pty_err =
|
||||||
pty.OpenFirstAvailableMaster(O_RDWR | O_NOCTTY);
|
pty.OpenFirstAvailablePrimary(O_RDWR | O_NOCTTY);
|
||||||
if (pty_err == PseudoTerminal::success) {
|
if (pty_err == PseudoTerminal::success) {
|
||||||
const char *slave_name = pty.SlaveName();
|
const char *secondary_name = pty.SecondaryName();
|
||||||
DNBLogThreadedIf(LOG_PROCESS,
|
DNBLogThreadedIf(LOG_PROCESS,
|
||||||
"%s() successfully opened master pty, slave is %s",
|
"%s() successfully opened primary pty, secondary is %s",
|
||||||
__FUNCTION__, slave_name);
|
__FUNCTION__, secondary_name);
|
||||||
if (slave_name && slave_name[0]) {
|
if (secondary_name && secondary_name[0]) {
|
||||||
::chmod(slave_name, S_IRWXU | S_IRWXG | S_IRWXO);
|
::chmod(secondary_name, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
stdio_path = [file_manager
|
stdio_path = [file_manager
|
||||||
stringWithFileSystemRepresentation:slave_name
|
stringWithFileSystemRepresentation:secondary_name
|
||||||
length:strlen(slave_name)];
|
length:strlen(secondary_name)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3866,8 +3866,8 @@ pid_t MachProcess::BoardServiceForkChildForPTraceDebugging(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
int master_fd = pty.ReleaseMasterFD();
|
int primary_fd = pty.ReleasePrimaryFD();
|
||||||
SetChildFileDescriptors(master_fd, master_fd, master_fd);
|
SetChildFileDescriptors(primary_fd, primary_fd, primary_fd);
|
||||||
CFString::UTF8(bundleIDCFStr, m_bundle_id);
|
CFString::UTF8(bundleIDCFStr, m_bundle_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,119 +17,119 @@
|
||||||
|
|
||||||
// PseudoTerminal constructor
|
// PseudoTerminal constructor
|
||||||
PseudoTerminal::PseudoTerminal()
|
PseudoTerminal::PseudoTerminal()
|
||||||
: m_master_fd(invalid_fd), m_slave_fd(invalid_fd) {}
|
: m_primary_fd(invalid_fd), m_secondary_fd(invalid_fd) {}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
// The master and slave file descriptors will get closed if they are
|
// The primary and secondary file descriptors will get closed if they are
|
||||||
// valid. Call the ReleaseMasterFD()/ReleaseSlaveFD() member functions
|
// valid. Call the ReleasePrimaryFD()/ReleaseSecondaryFD() member functions
|
||||||
// to release any file descriptors that are needed beyond the lifespan
|
// to release any file descriptors that are needed beyond the lifespan
|
||||||
// of this object.
|
// of this object.
|
||||||
PseudoTerminal::~PseudoTerminal() {
|
PseudoTerminal::~PseudoTerminal() {
|
||||||
CloseMaster();
|
ClosePrimary();
|
||||||
CloseSlave();
|
CloseSecondary();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the master file descriptor if it is valid.
|
// Close the primary file descriptor if it is valid.
|
||||||
void PseudoTerminal::CloseMaster() {
|
void PseudoTerminal::ClosePrimary() {
|
||||||
if (m_master_fd > 0) {
|
if (m_primary_fd > 0) {
|
||||||
::close(m_master_fd);
|
::close(m_primary_fd);
|
||||||
m_master_fd = invalid_fd;
|
m_primary_fd = invalid_fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the slave file descriptor if it is valid.
|
// Close the secondary file descriptor if it is valid.
|
||||||
void PseudoTerminal::CloseSlave() {
|
void PseudoTerminal::CloseSecondary() {
|
||||||
if (m_slave_fd > 0) {
|
if (m_secondary_fd > 0) {
|
||||||
::close(m_slave_fd);
|
::close(m_secondary_fd);
|
||||||
m_slave_fd = invalid_fd;
|
m_secondary_fd = invalid_fd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the first available pseudo terminal with OFLAG as the
|
// Open the first available pseudo terminal with OFLAG as the
|
||||||
// permissions. The file descriptor is store in the m_master_fd member
|
// permissions. The file descriptor is store in the m_primary_fd member
|
||||||
// variable and can be accessed via the MasterFD() or ReleaseMasterFD()
|
// variable and can be accessed via the PrimaryFD() or ReleasePrimaryFD()
|
||||||
// accessors.
|
// accessors.
|
||||||
//
|
//
|
||||||
// Suggested value for oflag is O_RDWR|O_NOCTTY
|
// Suggested value for oflag is O_RDWR|O_NOCTTY
|
||||||
//
|
//
|
||||||
// RETURNS:
|
// RETURNS:
|
||||||
// Zero when successful, non-zero indicating an error occurred.
|
// Zero when successful, non-zero indicating an error occurred.
|
||||||
PseudoTerminal::Status PseudoTerminal::OpenFirstAvailableMaster(int oflag) {
|
PseudoTerminal::Status PseudoTerminal::OpenFirstAvailablePrimary(int oflag) {
|
||||||
// Open the master side of a pseudo terminal
|
// Open the primary side of a pseudo terminal
|
||||||
m_master_fd = ::posix_openpt(oflag);
|
m_primary_fd = ::posix_openpt(oflag);
|
||||||
if (m_master_fd < 0) {
|
if (m_primary_fd < 0) {
|
||||||
return err_posix_openpt_failed;
|
return err_posix_openpt_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant access to the slave pseudo terminal
|
// Grant access to the secondary pseudo terminal
|
||||||
if (::grantpt(m_master_fd) < 0) {
|
if (::grantpt(m_primary_fd) < 0) {
|
||||||
CloseMaster();
|
ClosePrimary();
|
||||||
return err_grantpt_failed;
|
return err_grantpt_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the lock flag on the slave pseudo terminal
|
// Clear the lock flag on the secondary pseudo terminal
|
||||||
if (::unlockpt(m_master_fd) < 0) {
|
if (::unlockpt(m_primary_fd) < 0) {
|
||||||
CloseMaster();
|
ClosePrimary();
|
||||||
return err_unlockpt_failed;
|
return err_unlockpt_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the slave pseudo terminal for the current master pseudo
|
// Open the secondary pseudo terminal for the current primary pseudo
|
||||||
// terminal. A master pseudo terminal should already be valid prior to
|
// terminal. A primary pseudo terminal should already be valid prior to
|
||||||
// calling this function (see PseudoTerminal::OpenFirstAvailableMaster()).
|
// calling this function (see PseudoTerminal::OpenFirstAvailablePrimary()).
|
||||||
// The file descriptor is stored in the m_slave_fd member variable and
|
// The file descriptor is stored in the m_secondary_fd member variable and
|
||||||
// can be accessed via the SlaveFD() or ReleaseSlaveFD() accessors.
|
// can be accessed via the SecondaryFD() or ReleaseSecondaryFD() accessors.
|
||||||
//
|
//
|
||||||
// RETURNS:
|
// RETURNS:
|
||||||
// Zero when successful, non-zero indicating an error occurred.
|
// Zero when successful, non-zero indicating an error occurred.
|
||||||
PseudoTerminal::Status PseudoTerminal::OpenSlave(int oflag) {
|
PseudoTerminal::Status PseudoTerminal::OpenSecondary(int oflag) {
|
||||||
CloseSlave();
|
CloseSecondary();
|
||||||
|
|
||||||
// Open the master side of a pseudo terminal
|
// Open the primary side of a pseudo terminal
|
||||||
const char *slave_name = SlaveName();
|
const char *secondary_name = SecondaryName();
|
||||||
|
|
||||||
if (slave_name == NULL)
|
if (secondary_name == NULL)
|
||||||
return err_ptsname_failed;
|
return err_ptsname_failed;
|
||||||
|
|
||||||
m_slave_fd = ::open(slave_name, oflag);
|
m_secondary_fd = ::open(secondary_name, oflag);
|
||||||
|
|
||||||
if (m_slave_fd < 0)
|
if (m_secondary_fd < 0)
|
||||||
return err_open_slave_failed;
|
return err_open_secondary_failed;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the name of the slave pseudo terminal. A master pseudo terminal
|
// Get the name of the secondary pseudo terminal. A primary pseudo terminal
|
||||||
// should already be valid prior to calling this function (see
|
// should already be valid prior to calling this function (see
|
||||||
// PseudoTerminal::OpenFirstAvailableMaster()).
|
// PseudoTerminal::OpenFirstAvailablePrimary()).
|
||||||
//
|
//
|
||||||
// RETURNS:
|
// RETURNS:
|
||||||
// NULL if no valid master pseudo terminal or if ptsname() fails.
|
// NULL if no valid primary pseudo terminal or if ptsname() fails.
|
||||||
// The name of the slave pseudo terminal as a NULL terminated C string
|
// The name of the secondary pseudo terminal as a NULL terminated C string
|
||||||
// that comes from static memory, so a copy of the string should be
|
// that comes from static memory, so a copy of the string should be
|
||||||
// made as subsequent calls can change this value.
|
// made as subsequent calls can change this value.
|
||||||
const char *PseudoTerminal::SlaveName() const {
|
const char *PseudoTerminal::SecondaryName() const {
|
||||||
if (m_master_fd < 0)
|
if (m_primary_fd < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
return ::ptsname(m_master_fd);
|
return ::ptsname(m_primary_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fork a child process that and have its stdio routed to a pseudo
|
// Fork a child process that and have its stdio routed to a pseudo
|
||||||
// terminal.
|
// terminal.
|
||||||
//
|
//
|
||||||
// In the parent process when a valid pid is returned, the master file
|
// In the parent process when a valid pid is returned, the primary file
|
||||||
// descriptor can be used as a read/write access to stdio of the
|
// descriptor can be used as a read/write access to stdio of the
|
||||||
// child process.
|
// child process.
|
||||||
//
|
//
|
||||||
// In the child process the stdin/stdout/stderr will already be routed
|
// In the child process the stdin/stdout/stderr will already be routed
|
||||||
// to the slave pseudo terminal and the master file descriptor will be
|
// to the secondary pseudo terminal and the primary file descriptor will be
|
||||||
// closed as it is no longer needed by the child process.
|
// closed as it is no longer needed by the child process.
|
||||||
//
|
//
|
||||||
// This class will close the file descriptors for the master/slave
|
// This class will close the file descriptors for the primary/secondary
|
||||||
// when the destructor is called, so be sure to call ReleaseMasterFD()
|
// when the destructor is called, so be sure to call ReleasePrimaryFD()
|
||||||
// or ReleaseSlaveFD() if any file descriptors are going to be used
|
// or ReleaseSecondaryFD() if any file descriptors are going to be used
|
||||||
// past the lifespan of this object.
|
// past the lifespan of this object.
|
||||||
//
|
//
|
||||||
// RETURNS:
|
// RETURNS:
|
||||||
|
@ -138,10 +138,10 @@ const char *PseudoTerminal::SlaveName() const {
|
||||||
|
|
||||||
pid_t PseudoTerminal::Fork(PseudoTerminal::Status &error) {
|
pid_t PseudoTerminal::Fork(PseudoTerminal::Status &error) {
|
||||||
pid_t pid = invalid_pid;
|
pid_t pid = invalid_pid;
|
||||||
error = OpenFirstAvailableMaster(O_RDWR | O_NOCTTY);
|
error = OpenFirstAvailablePrimary(O_RDWR | O_NOCTTY);
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
// Successfully opened our master pseudo terminal
|
// Successfully opened our primary pseudo terminal
|
||||||
|
|
||||||
pid = ::fork();
|
pid = ::fork();
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
|
@ -151,23 +151,23 @@ pid_t PseudoTerminal::Fork(PseudoTerminal::Status &error) {
|
||||||
// Child Process
|
// Child Process
|
||||||
::setsid();
|
::setsid();
|
||||||
|
|
||||||
error = OpenSlave(O_RDWR);
|
error = OpenSecondary(O_RDWR);
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
// Successfully opened slave
|
// Successfully opened secondary
|
||||||
// We are done with the master in the child process so lets close it
|
// We are done with the primary in the child process so lets close it
|
||||||
CloseMaster();
|
ClosePrimary();
|
||||||
|
|
||||||
#if defined(TIOCSCTTY)
|
#if defined(TIOCSCTTY)
|
||||||
// Acquire the controlling terminal
|
// Acquire the controlling terminal
|
||||||
if (::ioctl(m_slave_fd, TIOCSCTTY, (char *)0) < 0)
|
if (::ioctl(m_secondary_fd, TIOCSCTTY, (char *)0) < 0)
|
||||||
error = err_failed_to_acquire_controlling_terminal;
|
error = err_failed_to_acquire_controlling_terminal;
|
||||||
#endif
|
#endif
|
||||||
// Duplicate all stdio file descriptors to the slave pseudo terminal
|
// Duplicate all stdio file descriptors to the secondary pseudo terminal
|
||||||
if (::dup2(m_slave_fd, STDIN_FILENO) != STDIN_FILENO)
|
if (::dup2(m_secondary_fd, STDIN_FILENO) != STDIN_FILENO)
|
||||||
error = error ? error : err_dup2_failed_on_stdin;
|
error = error ? error : err_dup2_failed_on_stdin;
|
||||||
if (::dup2(m_slave_fd, STDOUT_FILENO) != STDOUT_FILENO)
|
if (::dup2(m_secondary_fd, STDOUT_FILENO) != STDOUT_FILENO)
|
||||||
error = error ? error : err_dup2_failed_on_stdout;
|
error = error ? error : err_dup2_failed_on_stdout;
|
||||||
if (::dup2(m_slave_fd, STDERR_FILENO) != STDERR_FILENO)
|
if (::dup2(m_secondary_fd, STDERR_FILENO) != STDERR_FILENO)
|
||||||
error = error ? error : err_dup2_failed_on_stderr;
|
error = error ? error : err_dup2_failed_on_stderr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
err_grantpt_failed = -3,
|
err_grantpt_failed = -3,
|
||||||
err_unlockpt_failed = -4,
|
err_unlockpt_failed = -4,
|
||||||
err_ptsname_failed = -5,
|
err_ptsname_failed = -5,
|
||||||
err_open_slave_failed = -6,
|
err_open_secondary_failed = -6,
|
||||||
err_fork_failed = -7,
|
err_fork_failed = -7,
|
||||||
err_setsid_failed = -8,
|
err_setsid_failed = -8,
|
||||||
err_failed_to_acquire_controlling_terminal = -9,
|
err_failed_to_acquire_controlling_terminal = -9,
|
||||||
|
@ -39,37 +39,37 @@ public:
|
||||||
PseudoTerminal();
|
PseudoTerminal();
|
||||||
~PseudoTerminal();
|
~PseudoTerminal();
|
||||||
|
|
||||||
void CloseMaster();
|
void ClosePrimary();
|
||||||
void CloseSlave();
|
void CloseSecondary();
|
||||||
Status OpenFirstAvailableMaster(int oflag);
|
Status OpenFirstAvailablePrimary(int oflag);
|
||||||
Status OpenSlave(int oflag);
|
Status OpenSecondary(int oflag);
|
||||||
int MasterFD() const { return m_master_fd; }
|
int PrimaryFD() const { return m_primary_fd; }
|
||||||
int SlaveFD() const { return m_slave_fd; }
|
int SecondaryFD() const { return m_secondary_fd; }
|
||||||
int ReleaseMasterFD() {
|
int ReleasePrimaryFD() {
|
||||||
// Release ownership of the master pseudo terminal file
|
// Release ownership of the primary pseudo terminal file
|
||||||
// descriptor without closing it. (the destructor for this
|
// descriptor without closing it. (the destructor for this
|
||||||
// class will close it otherwise!)
|
// class will close it otherwise!)
|
||||||
int fd = m_master_fd;
|
int fd = m_primary_fd;
|
||||||
m_master_fd = invalid_fd;
|
m_primary_fd = invalid_fd;
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
int ReleaseSlaveFD() {
|
int ReleaseSecondaryFD() {
|
||||||
// Release ownership of the slave pseudo terminal file
|
// Release ownership of the secondary pseudo terminal file
|
||||||
// descriptor without closing it (the destructor for this
|
// descriptor without closing it (the destructor for this
|
||||||
// class will close it otherwise!)
|
// class will close it otherwise!)
|
||||||
int fd = m_slave_fd;
|
int fd = m_secondary_fd;
|
||||||
m_slave_fd = invalid_fd;
|
m_secondary_fd = invalid_fd;
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *SlaveName() const;
|
const char *SecondaryName() const;
|
||||||
|
|
||||||
pid_t Fork(Status &error);
|
pid_t Fork(Status &error);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Classes that inherit from PseudoTerminal can see and modify these
|
// Classes that inherit from PseudoTerminal can see and modify these
|
||||||
int m_master_fd;
|
int m_primary_fd;
|
||||||
int m_slave_fd;
|
int m_secondary_fd;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PseudoTerminal(const PseudoTerminal &rhs) = delete;
|
PseudoTerminal(const PseudoTerminal &rhs) = delete;
|
||||||
|
|
Loading…
Reference in New Issue