diff options
Diffstat (limited to 'include/lldb/Host/PseudoTerminal.h')
-rw-r--r-- | include/lldb/Host/PseudoTerminal.h | 87 |
1 files changed, 29 insertions, 58 deletions
diff --git a/include/lldb/Host/PseudoTerminal.h b/include/lldb/Host/PseudoTerminal.h index 858bd35f73a6..8b27890ddeeb 100644 --- a/include/lldb/Host/PseudoTerminal.h +++ b/include/lldb/Host/PseudoTerminal.h @@ -1,9 +1,8 @@ //===-- PseudoTerminal.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,47 +16,36 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" +/// \class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" /// A pseudo terminal helper class. /// /// The pseudo terminal class abstracts the use of pseudo terminals on the /// host system. -//---------------------------------------------------------------------- class PseudoTerminal { public: enum { invalid_fd = -1 ///< Invalid file descriptor value }; - //------------------------------------------------------------------ /// Default constructor /// /// Constructs this object with invalid master and slave file descriptors. - //------------------------------------------------------------------ PseudoTerminal(); - //------------------------------------------------------------------ /// Destructor /// /// The destructor will close the master and slave file descriptors if they /// are valid and ownership has not been released using one of: @li /// PseudoTerminal::ReleaseMasterFileDescriptor() @li /// PseudoTerminal::ReleaseSaveFileDescriptor() - //------------------------------------------------------------------ ~PseudoTerminal(); - //------------------------------------------------------------------ /// Close the master file descriptor if it is valid. - //------------------------------------------------------------------ void CloseMasterFileDescriptor(); - //------------------------------------------------------------------ /// Close the slave file descriptor if it is valid. - //------------------------------------------------------------------ void CloseSlaveFileDescriptor(); - //------------------------------------------------------------------ /// Fork a child process that uses pseudo terminals for its stdio. /// /// In the parent process, a call to this function results in a pid being @@ -73,18 +61,16 @@ public: /// PseudoTerminal::ReleaseMasterFileDescriptor() @li /// PseudoTerminal::ReleaseSaveFileDescriptor() /// - /// @param[out] error + /// \param[out] error /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// - /// @return - /// @li \b Parent process: a child process ID that is greater + /// \return + /// \li \b Parent process: a child process ID that is greater /// than zero, or -1 if the fork fails. - /// @li \b Child process: zero. - //------------------------------------------------------------------ + /// \li \b Child process: zero. lldb::pid_t Fork(char *error_str, size_t error_len); - //------------------------------------------------------------------ /// The master file descriptor accessor. /// /// This object retains ownership of the master file descriptor when this @@ -92,15 +78,13 @@ public: /// PseudoTerminal::ReleaseMasterFileDescriptor() if this object should /// release ownership of the slave file descriptor. /// - /// @return + /// \return /// The master file descriptor, or PseudoTerminal::invalid_fd /// if the master file descriptor is not currently valid. /// - /// @see PseudoTerminal::ReleaseMasterFileDescriptor() - //------------------------------------------------------------------ + /// \see PseudoTerminal::ReleaseMasterFileDescriptor() int GetMasterFileDescriptor() const; - //------------------------------------------------------------------ /// The slave file descriptor accessor. /// /// This object retains ownership of the slave file descriptor when this @@ -108,25 +92,23 @@ public: /// PseudoTerminal::ReleaseSlaveFileDescriptor() if this object should /// release ownership of the slave file descriptor. /// - /// @return + /// \return /// The slave file descriptor, or PseudoTerminal::invalid_fd /// if the slave file descriptor is not currently valid. /// - /// @see PseudoTerminal::ReleaseSlaveFileDescriptor() - //------------------------------------------------------------------ + /// \see PseudoTerminal::ReleaseSlaveFileDescriptor() int GetSlaveFileDescriptor() const; - //------------------------------------------------------------------ /// Get the name of the slave pseudo terminal. /// /// A master pseudo terminal should already be valid prior to /// calling this function. /// - /// @param[out] error + /// \param[out] error /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// - /// @return + /// \return /// The name of the slave pseudo terminal as a NULL terminated /// C. This string that comes from static memory, so a copy of /// the string should be made as subsequent calls can change @@ -134,11 +116,9 @@ public: /// a valid master pseudo terminal opened or if the call to /// \c ptsname() fails. /// - /// @see PseudoTerminal::OpenFirstAvailableMaster() - //------------------------------------------------------------------ + /// \see PseudoTerminal::OpenFirstAvailableMaster() const char *GetSlaveName(char *error_str, size_t error_len) const; - //------------------------------------------------------------------ /// Open the first available pseudo terminal. /// /// Opens the first available pseudo terminal with \a oflag as the @@ -152,25 +132,23 @@ public: /// If this object still has a valid master file descriptor when its /// destructor is called, it will close it. /// - /// @param[in] oflag + /// \param[in] oflag /// Flags to use when calling \c posix_openpt(\a oflag). /// A value of "O_RDWR|O_NOCTTY" is suggested. /// - /// @param[out] error + /// \param[out] error /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// - /// @return - /// @li \b true when the master files descriptor is + /// \return + /// \li \b true when the master files descriptor is /// successfully opened. - /// @li \b false if anything goes wrong. + /// \li \b false if anything goes wrong. /// - /// @see PseudoTerminal::GetMasterFileDescriptor() @see + /// \see PseudoTerminal::GetMasterFileDescriptor() @see /// PseudoTerminal::ReleaseMasterFileDescriptor() - //------------------------------------------------------------------ bool OpenFirstAvailableMaster(int oflag, char *error_str, size_t error_len); - //------------------------------------------------------------------ /// Open the slave for the current master pseudo terminal. /// /// A master pseudo terminal should already be valid prior to @@ -184,25 +162,23 @@ public: /// If this object still has a valid slave file descriptor when its /// destructor is called, it will close it. /// - /// @param[in] oflag + /// \param[in] oflag /// Flags to use when calling \c open(\a oflag). /// - /// @param[out] error + /// \param[out] error /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// - /// @return - /// @li \b true when the master files descriptor is + /// \return + /// \li \b true when the master files descriptor is /// successfully opened. - /// @li \b false if anything goes wrong. + /// \li \b false if anything goes wrong. /// - /// @see PseudoTerminal::OpenFirstAvailableMaster() @see + /// \see PseudoTerminal::OpenFirstAvailableMaster() @see /// PseudoTerminal::GetSlaveFileDescriptor() @see /// PseudoTerminal::ReleaseSlaveFileDescriptor() - //------------------------------------------------------------------ bool OpenSlave(int oflag, char *error_str, size_t error_len); - //------------------------------------------------------------------ /// Release the master file descriptor. /// /// Releases ownership of the master pseudo terminal file descriptor without @@ -210,13 +186,11 @@ public: /// descriptor if the ownership isn't released using this call and the /// master file descriptor has been opened. /// - /// @return + /// \return /// The master file descriptor, or PseudoTerminal::invalid_fd /// if the mast file descriptor is not currently valid. - //------------------------------------------------------------------ int ReleaseMasterFileDescriptor(); - //------------------------------------------------------------------ /// Release the slave file descriptor. /// /// Release ownership of the slave pseudo terminal file descriptor without @@ -224,16 +198,13 @@ public: /// descriptor if the ownership isn't released using this call and the slave /// file descriptor has been opened. /// - /// @return + /// \return /// The slave file descriptor, or PseudoTerminal::invalid_fd /// if the slave file descriptor is not currently valid. - //------------------------------------------------------------------ int ReleaseSlaveFileDescriptor(); protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ int m_master_fd; ///< The file descriptor for the master. int m_slave_fd; ///< The file descriptor for the slave. |