FreeNOS
ProcessClient.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2020 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __LIB_LIBRUNTIME_PROCESSCLIENT_H
19 #define __LIB_LIBRUNTIME_PROCESSCLIENT_H
20 
21 #include <FreeNOS/User.h>
22 #include <FreeNOS/ProcessManager.h>
23 #include <Types.h>
24 #include <String.h>
25 
40 {
41  public:
42 
45 
49  enum Result
50  {
54  };
55 
59  typedef struct Info
60  {
63 
66 
69  }
70  Info;
71 
72  public:
73 
79  ProcessID getProcessID() const;
80 
86  ProcessID getParentID() const;
87 
96  Result processInfo(const ProcessID pid, Info &info) const;
97 
109  Result processInfo(const String program, Info &info) const;
110 
122  ProcessID findProcess(const String program) const;
123 
124  private:
125 
127  static const ProcessID m_pid;
128 
130  static const ProcessID m_parent;
131 };
132 
138 #endif /* __LIB_LIBRUNTIME_PROCESSCLIENT_H */
ProcessInfo
Process information structure, used for Info.
Definition: ProcessCtl.h:63
Types.h
ProcessClient::processInfo
Result processInfo(const ProcessID pid, Info &info) const
Get process information by its ID.
Definition: ProcessClient.cpp:37
String
Abstraction of strings.
Definition: String.h:41
ProcessClient::Success
@ Success
Definition: ProcessClient.h:51
ProcessClient::getParentID
ProcessID getParentID() const
Get parent process identifier.
Definition: ProcessClient.cpp:32
ProcessClient
ProcessClient provides information about all processes on the local core.
Definition: ProcessClient.h:39
ProcessID
u32 ProcessID
Process Identification Number.
Definition: Types.h:140
ProcessClient::getProcessID
ProcessID getProcessID() const
Get current process identifier.
Definition: ProcessClient.cpp:27
ProcessClient::MaximumProcesses
static const Size MaximumProcesses
Maximum number of processes.
Definition: ProcessClient.h:44
ProcessClient::Info::command
String command
Full command including program path.
Definition: ProcessClient.h:65
MAX_PROCS
#define MAX_PROCS
Maximum number of processes.
Definition: ProcessManager.h:39
ProcessClient::Info::textState
String textState
Textual state of the process.
Definition: ProcessClient.h:68
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
ProcessClient::Info::kernelState
ProcessInfo kernelState
Process state retrieved from the kernel.
Definition: ProcessClient.h:62
ProcessClient::m_pid
static const ProcessID m_pid
Our own process identifier.
Definition: ProcessClient.h:127
ProcessClient::findProcess
ProcessID findProcess(const String program) const
Find a process by its program name.
Definition: ProcessClient.cpp:92
ProcessClient::Result
Result
Result codes.
Definition: ProcessClient.h:49
ProcessClient::NotFound
@ NotFound
Definition: ProcessClient.h:52
ProcessClient::Info
Process information.
Definition: ProcessClient.h:59
ProcessClient::m_parent
static const ProcessID m_parent
Our parent process identifier.
Definition: ProcessClient.h:130
String.h
ProcessClient::Info
struct ProcessClient::Info Info
Process information.
ProcessClient::IOError
@ IOError
Definition: ProcessClient.h:53