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.
22 #ifndef PROCESSES_LOCAL_H_
23 #define PROCESSES_LOCAL_H_
25 #include "processes_base_p.h"
26 #include <unistd.h> //For sysconf
36 * This is the OS specific code to get process information for the local host.
38 class ProcessesLocal
: public AbstractProcesses
{
41 virtual ~ProcessesLocal();
42 virtual QSet
<long> getAllPids();
43 virtual long getParentPid(long pid
);
44 virtual bool updateProcessInfo(long pid
, Process
*process
);
45 virtual bool sendSignal(long pid
, int sig
);
46 virtual bool setNiceness(long pid
, int priority
);
47 virtual bool setScheduler(long pid
, int priorityClass
, int priority
);
48 virtual long long totalPhysicalMemory();
49 virtual bool setIoNiceness(long pid
, int priorityClass
, int priority
);
50 virtual bool supportsIoNiceness();
51 virtual long numberProcessorCores()
52 #ifdef _SC_NPROCESSORS_ONLN
53 { return sysconf(_SC_NPROCESSORS_ONLN
); } // Should work on any recent posix system
57 virtual void updateAllProcesses() { emit
processesUpdated(); } //For local machine, there is no delay
61 * You can use this for whatever data you want. Be careful about preserving state in between getParentPid and updateProcessInfo calls
62 * if you chose to do that. getParentPid may be called several times for different pids before the relevant updateProcessInfo calls are made.
63 * This is because the tree structure has to be sorted out first.