htop/unsupported/UnsupportedProcessList.c

80 lines
1.8 KiB
C
Raw Normal View History

/*
htop - UnsupportedProcessList.c
(C) 2014 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
2021-01-28 17:19:38 +00:00
#include "UnsupportedProcessList.h"
#include <stdlib.h>
2015-07-12 16:26:33 +00:00
#include <string.h>
2021-01-28 17:19:38 +00:00
#include "ProcessList.h"
#include "UnsupportedProcess.h"
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
2016-02-02 14:53:02 +00:00
ProcessList* this = xCalloc(1, sizeof(ProcessList));
ProcessList_init(this, Class(Process), usersTable, pidMatchList, userId);
2019-10-31 16:39:12 +00:00
2021-01-28 17:19:38 +00:00
this->cpuCount = 1;
return this;
}
void ProcessList_delete(ProcessList* this) {
ProcessList_done(this);
free(this);
}
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
// in pause mode only gather global data for meters (CPU/memory/...)
2020-11-01 00:09:51 +00:00
if (pauseProcessUpdate) {
return;
2020-11-01 00:09:51 +00:00
}
2020-10-31 21:14:27 +00:00
bool preExisting = true;
Process* proc;
proc = ProcessList_getProcess(super, 1, &preExisting, UnsupportedProcess_new);
/* Empty values */
proc->time = proc->time + 10;
proc->pid = 1;
proc->ppid = 1;
proc->tgid = 0;
2021-01-28 17:19:38 +00:00
free_and_xStrdup(&proc->comm, "<unsupported architecture>");
2020-10-31 21:14:27 +00:00
proc->basenameOffset = 0;
proc->updated = true;
proc->state = 'R';
proc->show = true; /* Reflected in proc->settings-> "hideXXX" really */
proc->pgrp = 0;
proc->session = 0;
proc->tty_nr = 0;
proc->tpgid = 0;
proc->st_uid = 0;
proc->processor = 0;
proc->percent_cpu = 2.5;
proc->percent_mem = 2.5;
proc->user = "nobody";
proc->priority = 0;
proc->nice = 0;
proc->nlwp = 1;
proc->starttime_ctime = 1433116800; // Jun 01, 2015
Process_fillStarttimeBuffer(proc);
proc->m_virt = 100;
2020-10-31 21:14:27 +00:00
proc->m_resident = 100;
proc->minflt = 20;
proc->majflt = 20;
2021-01-28 17:19:38 +00:00
if (!preExisting)
ProcessList_add(super, proc);
2015-07-12 16:26:33 +00:00
}