FreeNOS
RecoveryClient.cpp
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#include <ChannelClient.h>
19#include "RecoveryMessage.h"
20#include "RecoveryClient.h"
21
23 : m_pid(pid)
24{
25}
26
28{
29 if (ChannelClient::instance()->syncSendReceive(&msg, sizeof(msg), m_pid) == ChannelClient::Success)
30 {
31 return msg.result;
32 }
33 else
34 {
35 return Recovery::IpcError;
36 }
37}
38
40{
44 msg.pid = pid;
45
46 return request(msg);
47}
Type type
Message type is either a request or response.
RecoveryClient(const ProcessID pid=RECOVERY_PID)
Class constructor function.
Recovery::Result restartProcess(const ProcessID pid) const
Restart a process.
const ProcessID m_pid
ProcessID of the RecoveryServer.
Recovery::Result request(RecoveryMessage &msg) const
Send an IPC request to the RecoveryServer.
static ChannelClient * instance()
Retrieve the instance.
Definition Singleton.h:53
u32 ProcessID
Process Identification Number.
Definition Types.h:140
Result
Result codes.
Definition Recovery.h:43
@ IpcError
Definition Recovery.h:48
@ RestartProcess
Definition Recovery.h:36
Recovery IPC message.
ProcessID pid
Process identifier of target process.
Recovery::Result result
Result of action.
Recovery::Action action
Action to perform.