FreeNOS
Public Member Functions | Private Member Functions
SysControl Class Reference

Control program for various system services. More...

#include <SysControl.h>

Inheritance diagram for SysControl:
POSIXApplication Application

Public Member Functions

 SysControl (int argc, char **argv)
 Constructor. More...
 
virtual ~SysControl ()
 Destructor. More...
 
virtual Result exec ()
 Execute the application. More...
 
- Public Member Functions inherited from POSIXApplication
 POSIXApplication (int argc, char **argv)
 Class constructor. More...
 
virtual ~POSIXApplication ()
 Class destructor. More...
 
- Public Member Functions inherited from Application
 Application (int argc, char **argv)
 Class constructor. More...
 
virtual ~Application ()
 Class destructor. More...
 
virtual int run ()
 Run the application. More...
 

Private Member Functions

Result stopProcess (const ProcessID pid) const
 Stop the given process by its ID. More...
 
Result resumeProcess (const ProcessID pid) const
 Resume the given process by its ID. More...
 
Result restartProcess (const ProcessID pid) const
 Restart the given process by its ID. More...
 

Additional Inherited Members

- Public Types inherited from Application
enum  Result {
  Success, NotFound, IOError, InvalidArgument,
  ShowUsage, TimedOut, OutOfMemory
}
 Result codes. More...
 
- Protected Member Functions inherited from POSIXApplication
virtual Result output (const char *string) const
 Print text to output. More...
 
int runProgram (const char *path, const char **argv)
 Runs an external program. More...
 
- Protected Member Functions inherited from Application
virtual Result initialize ()
 Initialize the application. More...
 
virtual Result output (String &string) const
 Print string to output. More...
 
ArgumentParserparser ()
 Get program arguments parser. More...
 
const ArgumentParserparser () const
 Get constant program arguments parser. More...
 
const ArgumentContainerarguments () const
 Get program arguments. More...
 
void setVersion (const String &version)
 Set program version. More...
 
- Protected Attributes inherited from Application
int m_argc
 Input argument count. More...
 
char ** m_argv
 Input argument values. More...
 

Detailed Description

Control program for various system services.

Definition at line 32 of file SysControl.h.

Constructor & Destructor Documentation

◆ SysControl()

SysControl::SysControl ( int  argc,
char **  argv 
)

Constructor.

Parameters
argcArgument count
argvArgument values

Definition at line 23 of file SysControl.cpp.

References Application::parser(), ArgumentParser::registerFlag(), ArgumentParser::registerPositional(), and ArgumentParser::setDescription().

◆ ~SysControl()

SysControl::~SysControl ( )
virtual

Destructor.

Definition at line 33 of file SysControl.cpp.

Member Function Documentation

◆ exec()

SysControl::Result SysControl::exec ( )
virtual

◆ restartProcess()

SysControl::Result SysControl::restartProcess ( const ProcessID  pid) const
private

Restart the given process by its ID.

Parameters
pidProcess ID
Returns
Result code

Definition at line 108 of file SysControl.cpp.

References DEBUG, ERROR, Application::IOError, RecoveryClient::restartProcess(), Recovery::Success, and Application::Success.

Referenced by exec().

◆ resumeProcess()

SysControl::Result SysControl::resumeProcess ( const ProcessID  pid) const
private

Resume the given process by its ID.

Parameters
pidProcess ID
Returns
Result code

Definition at line 94 of file SysControl.cpp.

References DEBUG, ERROR, Application::IOError, ProcessCtl(), Resume, Application::Success, and API::Success.

Referenced by exec().

◆ stopProcess()

SysControl::Result SysControl::stopProcess ( const ProcessID  pid) const
private

Stop the given process by its ID.

Parameters
pidProcess ID
Returns
Result code

Definition at line 80 of file SysControl.cpp.

References DEBUG, ERROR, Application::IOError, ProcessCtl(), Stop, Application::Success, and API::Success.

Referenced by exec().


The documentation for this class was generated from the following files: