1 /* This file is part of the KDE project
3 Copyright (C) 2007 John Tapsell <tapsell@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef PROCESSES_REMOTE_P_H_
22 #define PROCESSES_REMOTE_P_H_
24 #include "processes_base_p.h"
30 * This is used to connect to a remote host
32 class ProcessesRemote
: public AbstractProcesses
{
35 ProcessesRemote(const QString
&hostname
);
36 virtual ~ProcessesRemote();
37 virtual QSet
<long> getAllPids();
38 virtual long getParentPid(long pid
);
39 virtual bool updateProcessInfo(long pid
, Process
*process
);
40 virtual bool sendSignal(long pid
, int sig
);
41 virtual bool setNiceness(long pid
, int priority
);
42 virtual bool setScheduler(long pid
, int priorityClass
, int priority
);
43 virtual long long totalPhysicalMemory();
44 virtual bool setIoNiceness(long pid
, int priorityClass
, int priority
);
45 virtual bool supportsIoNiceness();
46 virtual long numberProcessorCores();
47 virtual void updateAllProcesses();
51 /** For a remote machine, we rely on being able to communicate with ksysguardd.
52 * This must be dealt with by the program including this widget. It must listen to our
53 * 'runCommand' signal, and run the given command, with the given id. */
54 void runCommand(const QString
&command
, int id
);
57 /** For a remote machine, we rely on being able to communicate with ksysguardd.
58 * The programming using this must call this slot when an answer is received from ksysguardd,
59 * in response to a runCommand request. The id identifies the answer */
60 void answerReceived( int id
, const QList
<QByteArray
>& answer
);
61 /** Called soon after */
65 enum { PsInfo
, Ps
, UsedMemory
, FreeMemory
, Kill
, Renice
, Ionice
};
69 * You can use this for whatever data you want. Be careful about preserving state in between getParentPid and updateProcessInfo calls
70 * if you chose to do that. getParentPid may be called several times for different pids before the relevant updateProcessInfo calls are made.
71 * This is because the tree structure has to be sorted out first.