File indexing completed on 2024-05-12 05:46:51

0001 /**************************************************************************
0002 **
0003 ** This file is part of the KDE Frameworks
0004 **
0005 ** Copyright (c) 2019 Tobias C. Berner <tcberner@FreeBSD.org>
0006 **
0007 ** GNU Lesser General Public License Usage
0008 **
0009 ** This file may be used under the terms of the GNU Lesser General Public
0010 ** License version 2.1 as published by the Free Software Foundation and
0011 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
0012 ** Please review the following information to ensure the GNU Lesser General
0013 ** Public License version 2.1 requirements will be met:
0014 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
0015 **
0016 **************************************************************************/
0017 
0018 #include "kprocesslist.h"
0019 #include "kprocesslist_unix_procstat_p.h"
0020 
0021 #include <QProcess>
0022 #include <QDir>
0023 
0024 
0025 using namespace KProcessList;
0026 
0027 // Determine UNIX processes by using the procstat library
0028 KProcessInfoList KProcessList::processInfoList()
0029 {
0030     KProcessInfoList rc;
0031 
0032     ProcStat pstat;
0033     if (!pstat)
0034     {
0035         return rc;
0036     }
0037 
0038     ProcStatProcesses procs(pstat);
0039     for (const auto& process_info: procs)
0040     {
0041         rc.push_back(process_info);
0042     }
0043 
0044     return rc;
0045 }