diff --git a/ksgrd/SensorShellAgent.cpp b/ksgrd/SensorShellAgent.cpp index 95209ed..0c3c1d3 100644 --- a/ksgrd/SensorShellAgent.cpp +++ b/ksgrd/SensorShellAgent.cpp @@ -1,149 +1,149 @@ /* KSysGuard, the KDE System Guard Copyright (c) 1999 - 2001 Chris Schlaeger This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License or (at your option) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include "ksgrd_debug.h" #include "SensorManager.h" #include "SensorShellAgent.h" using namespace KSGRD; SensorShellAgent::SensorShellAgent( SensorManager *sm ) : SensorAgent( sm ), mDaemon( nullptr ) { } SensorShellAgent::~SensorShellAgent() { if ( mDaemon ) { mDaemon->write( "quit\n", sizeof( "quit\n" )-1 ); mDaemon->disconnect(); mDaemon->waitForFinished(); delete mDaemon; mDaemon = nullptr; } } bool SensorShellAgent::start( const QString &host, const QString &shell, const QString &command, int ) { mDaemon = new KProcess(); mDaemon->setOutputChannelMode( KProcess::SeparateChannels ); mRetryCount=3; setHostName( host ); mShell = shell; mCommand = command; connect( mDaemon, SIGNAL(error(QProcess::ProcessError)), SLOT(daemonError(QProcess::ProcessError)) ); connect( mDaemon, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(daemonExited(int,QProcess::ExitStatus)) ); connect( mDaemon.data(), &QProcess::readyReadStandardOutput, this, &SensorShellAgent::msgRcvd ); connect( mDaemon.data(), &QProcess::readyReadStandardError, this, &SensorShellAgent::errMsgRcvd ); if ( !command.isEmpty() ) { *mDaemon << KShell::splitArgs(command); } else *mDaemon << mShell << hostName() << QStringLiteral("ksysguardd"); mDaemon->start(); return true; } void SensorShellAgent::hostInfo( QString &shell, QString &command, int &port) const { shell = mShell; command = mCommand; port = -1; } void SensorShellAgent::msgRcvd( ) { QByteArray buffer = mDaemon->readAllStandardOutput(); mRetryCount = 3; //we received an answer, so reset our retry count back to 3 processAnswer( buffer.constData(), buffer.size()); } void SensorShellAgent::errMsgRcvd( ) { const QByteArray buffer = mDaemon->readAllStandardOutput(); // Because we read the error buffer in chunks, we may not have a proper utf8 string. // We should never get input over stderr anyway, so no need to worry too much about it. // But if this is extended, we will need to handle this better const QString buf = QString::fromUtf8( buffer ); qCDebug(LIBKSYSGUARD_KSGRD) << "SensorShellAgent: Warning, received text over stderr!" << endl << buf << endl; } void SensorShellAgent::daemonExited( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitCode); qCDebug(LIBKSYSGUARD_KSGRD) << "daemon exited, exit status " << exitStatus; if ( mRetryCount-- <= 0 || (mDaemon->start(), !mDaemon->waitForStarted()) ) { setDaemonOnLine( false ); if(sensorManager()) { sensorManager()->disengage( this ); //delete ourselves } } } void SensorShellAgent::daemonError( QProcess::ProcessError errorStatus ) { QString error; switch(errorStatus) { case QProcess::FailedToStart: - qCDebug(LIBKSYSGUARD_KSGRD) << "failed to run" << mDaemon->program().join(QStringLiteral(" ")); + qCDebug(LIBKSYSGUARD_KSGRD) << "failed to run" << mDaemon->program().join(QLatin1String(" ")); error = i18n("Could not run daemon program '%1'.", mDaemon->program().join(" ")); break; case QProcess::Crashed: case QProcess::Timedout: case QProcess::WriteError: case QProcess::ReadError: default: error = i18n("The daemon program '%1' failed.", mDaemon->program().join(" ")); } setReasonForOffline(error); qCDebug(LIBKSYSGUARD_KSGRD) << "Error received " << error << "(" << errorStatus << ")"; setDaemonOnLine( false ); if(sensorManager()) sensorManager()->disengage( this ); //delete ourselves } bool SensorShellAgent::writeMsg( const char *msg, int len ) { //write returns -1 on error, in which case we should return false. true otherwise. return mDaemon->write( msg, len ) != -1; } diff --git a/processcore/helper.cpp b/processcore/helper.cpp index 92bc2e0..2f360c3 100644 --- a/processcore/helper.cpp +++ b/processcore/helper.cpp @@ -1,127 +1,127 @@ /* KSysGuard, the KDE System Guard Copyright (c) 2009 John Tapsell This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "helper.h" #include "processes_local_p.h" using namespace KAuth; KSysGuardProcessListHelper::KSysGuardProcessListHelper() { qRegisterMetaType >(); } /* The functions here run as ROOT. So be careful. DO NOT TRUST THE INPUTS TO BE SANE. */ #define GET_PID(i) parameters.value(QStringLiteral("pid%1").arg(i), -1).toULongLong(); if(pid < 0) return ActionReply(ActionReply::HelperErrorType); ActionReply KSysGuardProcessListHelper::sendsignal(const QVariantMap ¶meters) { ActionReply reply(ActionReply::HelperErrorType); - if(!parameters.contains(QStringLiteral("signal"))) { + if(!parameters.contains(QLatin1String("signal"))) { reply.setErrorDescription(QStringLiteral("Internal error - no signal parameter was passed to the helper")); reply.setErrorCode(static_cast(KSysGuard::Processes::InvalidPid)); return reply; } - if(!parameters.contains(QStringLiteral("pidcount"))) { + if(!parameters.contains(QLatin1String("pidcount"))) { reply.setErrorDescription(QStringLiteral("Internal error - no pidcount parameter was passed to the helper")); reply.setErrorCode(static_cast(KSysGuard::Processes::InvalidParameter)); return reply; } KSysGuard::ProcessesLocal processes; int signal = qvariant_cast(parameters.value(QStringLiteral("signal"))); bool success = true; int numProcesses = parameters.value(QStringLiteral("pidcount")).toInt(); QStringList errorList; for (int i = 0; i < numProcesses; ++i) { qlonglong pid = GET_PID(i); bool successForThisPid = processes.sendSignal(pid, signal); if (!successForThisPid) errorList << QString::number(pid); success = successForThisPid && success; } if(success) { return ActionReply::SuccessReply(); } else { - reply.setErrorDescription(QStringLiteral("Could not send signal to: ") + errorList.join(QStringLiteral(", "))); + reply.setErrorDescription(QStringLiteral("Could not send signal to: ") + errorList.join(QLatin1String(", "))); reply.setErrorCode(static_cast(KSysGuard::Processes::Unknown)); return reply; } } ActionReply KSysGuardProcessListHelper::renice(const QVariantMap ¶meters) { - if(!parameters.contains(QStringLiteral("nicevalue")) || !parameters.contains(QStringLiteral("pidcount"))) + if(!parameters.contains(QLatin1String("nicevalue")) || !parameters.contains(QLatin1String("pidcount"))) return ActionReply(ActionReply::HelperErrorType); KSysGuard::ProcessesLocal processes; int niceValue = qvariant_cast(parameters.value(QStringLiteral("nicevalue"))); bool success = true; int numProcesses = parameters.value(QStringLiteral("pidcount")).toInt(); for (int i = 0; i < numProcesses; ++i) { qlonglong pid = GET_PID(i); success = processes.setNiceness(pid, niceValue) && success; } if(success) return ActionReply::SuccessReply(); else return ActionReply(ActionReply::HelperErrorType); } ActionReply KSysGuardProcessListHelper::changeioscheduler(const QVariantMap ¶meters) { - if(!parameters.contains(QStringLiteral("ioScheduler")) || !parameters.contains(QStringLiteral("ioSchedulerPriority")) || !parameters.contains(QStringLiteral("pidcount"))) + if(!parameters.contains(QLatin1String("ioScheduler")) || !parameters.contains(QLatin1String("ioSchedulerPriority")) || !parameters.contains(QLatin1String("pidcount"))) return ActionReply(ActionReply::HelperErrorType); KSysGuard::ProcessesLocal processes; int ioScheduler = qvariant_cast(parameters.value(QStringLiteral("ioScheduler"))); int ioSchedulerPriority = qvariant_cast(parameters.value(QStringLiteral("ioSchedulerPriority"))); bool success = true; const int numProcesses = parameters.value(QStringLiteral("pidcount")).toInt(); for (int i = 0; i < numProcesses; ++i) { qlonglong pid = GET_PID(i); success = processes.setIoNiceness(pid, ioScheduler, ioSchedulerPriority) && success; } if(success) return ActionReply::SuccessReply(); else return ActionReply(ActionReply::HelperErrorType); } ActionReply KSysGuardProcessListHelper::changecpuscheduler(const QVariantMap ¶meters) { - if(!parameters.contains(QStringLiteral("cpuScheduler")) || !parameters.contains(QStringLiteral("cpuSchedulerPriority")) || !parameters.contains(QStringLiteral("pidcount"))) + if(!parameters.contains(QLatin1String("cpuScheduler")) || !parameters.contains(QLatin1String("cpuSchedulerPriority")) || !parameters.contains(QLatin1String("pidcount"))) return ActionReply(ActionReply::HelperErrorType); KSysGuard::ProcessesLocal processes; int cpuScheduler = qvariant_cast(parameters.value(QStringLiteral("cpuScheduler"))); int cpuSchedulerPriority = qvariant_cast(parameters.value(QStringLiteral("cpuSchedulerPriority"))); bool success = true; const int numProcesses = parameters.value(QStringLiteral("pidcount")).toInt(); for (int i = 0; i < numProcesses; ++i) { qlonglong pid = GET_PID(i); success = processes.setScheduler(pid, cpuScheduler, cpuSchedulerPriority) && success; } if(success) return ActionReply::SuccessReply(); else return ActionReply(ActionReply::HelperErrorType); } KAUTH_HELPER_MAIN("org.kde.ksysguard.processlisthelper", KSysGuardProcessListHelper) diff --git a/processcore/processes_dragonfly_p.cpp b/processcore/processes_dragonfly_p.cpp index 9f1d979..f6e434b 100644 --- a/processcore/processes_dragonfly_p.cpp +++ b/processcore/processes_dragonfly_p.cpp @@ -1,274 +1,274 @@ /* This file is part of the KDE project Copyright (C) 2007 Manolo Valdes Copyright (C) 2010 Alex Hornung This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "processes_local_p.h" #include "process.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #define PP(pp, field) ((pp)->kp_ ## field) #define LP(pp, field) ((pp)->kp_lwp.kl_ ## field) #define VP(pp, field) ((pp)->kp_vm_ ## field) namespace KSysGuard { class ProcessesLocal::Private { public: Private() {} ~Private() {} inline bool readProc(long pid, struct kinfo_proc *p); inline void readProcStatus(struct kinfo_proc *p, Process *process); inline void readProcStat(struct kinfo_proc *p, Process *process); inline void readProcStatm(struct kinfo_proc *p, Process *process); inline bool readProcCmdline(long pid, Process *process); }; bool ProcessesLocal::Private::readProc(long pid, struct kinfo_proc *p) { int mib[4]; size_t len; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = pid; len = sizeof (struct kinfo_proc); if (sysctl(mib, 4, p, &len, NULL, 0) == -1 || !len) return false; return true; } void ProcessesLocal::Private::readProcStatus(struct kinfo_proc *p, Process *process) { process->setUid(0); process->setGid(0); process->setTracerpid(-1); process->setEuid(PP(p, uid)); process->setUid(PP(p, ruid)); process->setEgid(PP(p, svgid)); process->setGid(PP(p, rgid)); process->setName(QString(PP(p, comm))); } void ProcessesLocal::Private::readProcStat(struct kinfo_proc *p, Process *ps) { ps->setUserTime(LP(p, uticks) / 10000); ps->setSysTime((LP(p, sticks) + LP(p, iticks)) / 10000); ps->setNiceLevel(PP(p, nice)); ps->setVmSize(VP(p, map_size) / 1024); /* convert to KiB */ ps->setVmRSS(VP(p, prssize) * getpagesize() / 1024); /* convert to KiB */ // "idle","run","sleep","stop","zombie" switch( LP(p, stat) ) { case LSRUN: ps->setStatus(Process::Running); break; case LSSLEEP: ps->setStatus(Process::Sleeping); break; case LSSTOP: ps->setStatus(Process::Stopped); break; default: ps->setStatus(Process::OtherStatus); break; } if (PP(p, stat) == SZOMB) ps->setStatus(Process::Zombie); } void ProcessesLocal::Private::readProcStatm(struct kinfo_proc *p, Process *process) { process->setVmURSS(-1); } bool ProcessesLocal::Private::readProcCmdline(long pid, Process *process) { int mib[4]; size_t buflen = 256; char buf[256]; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_ARGS; mib[3] = pid; if (sysctl(mib, 4, buf, &buflen, NULL, 0) == -1 || (buflen == 0)) return false; QString command = QString(buf); //cmdline separates parameters with the NULL character - command = command.replace('\0', ' '); + command.replace('\0', ' '); process->setCommand(command.trimmed()); return true; } ProcessesLocal::ProcessesLocal() : d(new Private()) { } long ProcessesLocal::getParentPid(long pid) { long long ppid = -1; struct kinfo_proc p; if(d->readProc(pid, &p)) ppid = PP(&p, ppid); return ppid; } bool ProcessesLocal::updateProcessInfo( long pid, Process *process) { struct kinfo_proc p; if(!d->readProc(pid, &p)) { return false; } d->readProcStat(&p, process); d->readProcStatus(&p, process); d->readProcStatm(&p, process); if(!d->readProcCmdline(pid, process)) { return false; } return true; } QSet ProcessesLocal::getAllPids( ) { QSet pids; int mib[3]; size_t len; size_t num; struct kinfo_proc *p; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_ALL; if (sysctl(mib, 3, NULL, &len, NULL, 0) == -1) return pids; if ((p = (kinfo_proc *) malloc(len)) == NULL) return pids; if (sysctl(mib, 3, p, &len, NULL, 0) == -1) { free(p); return pids; } for (num = 0; num < len / sizeof(struct kinfo_proc); num++) { long pid = PP((&p[num]), pid); long long ppid = PP((&p[num]), ppid); //skip all process with parent id = 0 but init if(ppid <= 0 && pid != 1) continue; pids.insert(pid); } free(p); return pids; } bool ProcessesLocal::sendSignal(long pid, int sig) { if ( kill( (pid_t)pid, sig ) ) { //Kill failed return false; } return true; } bool ProcessesLocal::setNiceness(long pid, int priority) { if ( setpriority( PRIO_PROCESS, pid, priority ) ) { //set niceness failed return false; } return true; } bool ProcessesLocal::setScheduler(long pid, int priorityClass, int priority) { if(priorityClass == KSysGuard::Process::Other || priorityClass == KSysGuard::Process::Batch) priority = 0; if(pid <= 0) return false; // check the parameters struct sched_param params; params.sched_priority = priority; switch(priorityClass) { case (KSysGuard::Process::Other): return (sched_setscheduler( pid, SCHED_OTHER, ¶ms) == 0); case (KSysGuard::Process::RoundRobin): return (sched_setscheduler( pid, SCHED_RR, ¶ms) == 0); case (KSysGuard::Process::Fifo): return (sched_setscheduler( pid, SCHED_FIFO, ¶ms) == 0); #ifdef SCHED_BATCH case (KSysGuard::Process::Batch): return (sched_setscheduler( pid, SCHED_BATCH, ¶ms) == 0); #endif default: return false; } } bool ProcessesLocal::setIoNiceness(long pid, int priorityClass, int priority) { return false; //Not yet supported } bool ProcessesLocal::supportsIoNiceness() { return false; } long long ProcessesLocal::totalPhysicalMemory() { size_t Total; size_t len; len = sizeof (Total); if (sysctlbyname("hw.physmem", &Total, &len, NULL, 0) == -1) return 0; Total *= getpagesize() / 1024; return Total; } ProcessesLocal::~ProcessesLocal() { delete d; } } diff --git a/processcore/processes_freebsd_p.cpp b/processcore/processes_freebsd_p.cpp index f1dbca2..55a9352 100644 --- a/processcore/processes_freebsd_p.cpp +++ b/processcore/processes_freebsd_p.cpp @@ -1,270 +1,270 @@ /* This file is part of the KDE project Copyright (C) 2007 Manolo Valdes This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "processes_local_p.h" #include "process.h" #include #include #include #include #include #include #include #include #include #include #include namespace KSysGuard { class ProcessesLocal::Private { public: Private() {;} ~Private() {;} inline bool readProc(long pid, struct kinfo_proc *p); inline void readProcStatus(struct kinfo_proc *p, Process *process); inline void readProcStat(struct kinfo_proc *p, Process *process); inline void readProcStatm(struct kinfo_proc *p, Process *process); inline bool readProcCmdline(long pid, Process *process); }; bool ProcessesLocal::Private::readProc(long pid, struct kinfo_proc *p) { int mib[4]; size_t len; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PID; mib[3] = pid; len = sizeof (struct kinfo_proc); if (sysctl(mib, 4, p, &len, NULL, 0) == -1 || !len) return false; return true; } void ProcessesLocal::Private::readProcStatus(struct kinfo_proc *p, Process *process) { process->setUid(0); process->setGid(0); process->setTracerpid(-1); process->setEuid(p->ki_uid); process->setUid(p->ki_ruid); process->setEgid(p->ki_svgid); process->setGid(p->ki_rgid); process->setName(QString::fromUtf8(p->ki_comm ? p->ki_comm : "????")); } void ProcessesLocal::Private::readProcStat(struct kinfo_proc *p, Process *ps) { int status; struct rusage pru; ps->setUserTime(p->ki_rusage.ru_utime.tv_sec * 100 + p->ki_rusage.ru_utime.tv_usec / 10000); ps->setSysTime(p->ki_rusage.ru_stime.tv_sec * 100 + p->ki_rusage.ru_stime.tv_usec / 10000); ps->setNiceLevel(p->ki_nice); ps->setVmSize(p->ki_size / 1024); ps->setVmRSS(p->ki_rssize * getpagesize() / 1024); status = p->ki_stat; // "idle","run","sleep","stop","zombie" switch( status ) { case SRUN: ps->setStatus(Process::Running); break; case SSLEEP: case SWAIT: case SLOCK: ps->setStatus(Process::Sleeping); break; case SSTOP: ps->setStatus(Process::Stopped); break; case SZOMB: ps->setStatus(Process::Zombie); break; default: ps->setStatus(Process::OtherStatus); break; } } void ProcessesLocal::Private::readProcStatm(struct kinfo_proc *p, Process *process) { process->setVmURSS(-1); } bool ProcessesLocal::Private::readProcCmdline(long pid, Process *process) { int mib[4]; struct kinfo_proc p; size_t buflen = 256; char buf[256]; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_ARGS; mib[3] = pid; if (sysctl(mib, 4, buf, &buflen, NULL, 0) == -1 || !buflen) return false; QString command = QString::fromUtf8(buf); //cmdline separates parameters with the NULL character - command = command.replace(QLatin1Char('\0'), QLatin1Char(' ')); + command.replace(QLatin1Char('\0'), QLatin1Char(' ')); process->setCommand(command.trimmed()); return true; } ProcessesLocal::ProcessesLocal() : d(new Private()) { } long ProcessesLocal::getParentPid(long pid) { long long ppid = 0; struct kinfo_proc p; if(d->readProc(pid, &p)) { ppid = p.ki_ppid; } return ppid; } bool ProcessesLocal::updateProcessInfo( long pid, Process *process) { struct kinfo_proc p; if(!d->readProc(pid, &p)) return false; d->readProcStat(&p, process); d->readProcStatus(&p, process); d->readProcStatm(&p, process); if(!d->readProcCmdline(pid, process)) return false; return true; } QSet ProcessesLocal::getAllPids( ) { QSet pids; int mib[3]; size_t len; size_t num; struct kinfo_proc *p; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_ALL; if (sysctl(mib, 3, NULL, &len, NULL, 0) == -1) return pids; if ((p = (kinfo_proc *) malloc(len)) == NULL) return pids; if (sysctl(mib, 3, p, &len, NULL, 0) == -1) { free(p); return pids; } for (num = 0; num < len / sizeof(struct kinfo_proc); num++) { long pid = p[num].ki_pid; long long ppid = p[num].ki_ppid; //skip all process with parent id = 0 but init if(ppid <= 0 && pid != 1) continue; pids.insert(pid); } free(p); return pids; } bool ProcessesLocal::sendSignal(long pid, int sig) { if ( kill( (pid_t)pid, sig ) ) { //Kill failed return false; } return true; } bool ProcessesLocal::setNiceness(long pid, int priority) { if ( setpriority( PRIO_PROCESS, pid, priority ) ) { //set niceness failed return false; } return true; } bool ProcessesLocal::setScheduler(long pid, int priorityClass, int priority) { if(priorityClass == KSysGuard::Process::Other || priorityClass == KSysGuard::Process::Batch) priority = 0; if(pid <= 0) return false; // check the parameters struct sched_param params; params.sched_priority = priority; switch(priorityClass) { case (KSysGuard::Process::Other): return (sched_setscheduler( pid, SCHED_OTHER, ¶ms) == 0); case (KSysGuard::Process::RoundRobin): return (sched_setscheduler( pid, SCHED_RR, ¶ms) == 0); case (KSysGuard::Process::Fifo): return (sched_setscheduler( pid, SCHED_FIFO, ¶ms) == 0); #ifdef SCHED_BATCH case (KSysGuard::Process::Batch): return (sched_setscheduler( pid, SCHED_BATCH, ¶ms) == 0); #endif default: return false; } } bool ProcessesLocal::setIoNiceness(long pid, int priorityClass, int priority) { return false; //Not yet supported } bool ProcessesLocal::supportsIoNiceness() { return false; } long long ProcessesLocal::totalPhysicalMemory() { size_t Total; size_t len; len = sizeof (Total); if (sysctlbyname("hw.physmem", &Total, &len, NULL, 0) == -1) return 0; return Total /= 1024; } ProcessesLocal::~ProcessesLocal() { delete d; } }