QList<qint64> ProcessInfo::pidsOf(const QString &processName) { QList<qint64> ret; QList<qint64> pids = allConcurrentPids(); for (QListIterator<qint64> it(pids); it.hasNext(); ) { ProcessInfo pi(it.next()); if (pi.processName() == processName) { ret << pi.pid(); } } return ret; }
QList<qint64> ProcessInfo::childProcessIds() const { QList<qint64> ids; QList<qint64> allPids = allConcurrentPids(); for (QListIterator<qint64> it(allPids); it.hasNext(); ) { qint64 p = it.next(); if (ProcessInfo(p).ppid() == pid()) { ids << p; } } return ids; }
bool ProcessInfo::exists() const { return allConcurrentPids().contains(processId); }