Make unsupported run

This commit is contained in:
David Hunt
2015-07-12 11:26:33 -05:00
committed by Hisham Muhammad
parent 5e602f18d5
commit feb7a01fd3
6 changed files with 159 additions and 31 deletions

View File

@ -6,22 +6,18 @@ in the source distribution for its full text.
*/
#include "ProcessList.h"
#include "UnsupportedProcess.h"
#include <stdlib.h>
#include <string.h>
/*{
}*/
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList, uid_t userId) {
ProcessList* this = calloc(1, sizeof(ProcessList));
ProcessList_init(this, usersTable, pidWhiteList);
// Update CPU count:
this->cpuCount = 1;
this->cpus = calloc(1, sizeof(CPUData));
this->cpus[0].totalTime = 1;
this->cpus[0].totalPeriod = 1;
ProcessList_init(this, Class(Process), usersTable, pidWhiteList, userId);
return this;
}
@ -31,7 +27,49 @@ void ProcessList_delete(ProcessList* this) {
free(this);
}
void ProcessList_scan(ProcessList* this) {
void ProcessList_goThroughEntries(ProcessList* super) {
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;
proc->comm = "<unsupported architecture>";
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->flags = 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;
strncpy(proc->starttime_show, "Jun 01 ", sizeof(proc->starttime_show));
proc->starttime_ctime = 1433116800; // Jun 01, 2015
proc->m_size = 100;
proc->m_resident = 100;
proc->minflt = 20;
proc->majflt = 20;
}
void UnsupportedProcessList_scan(ProcessList* this) {
(void) this;
// stub!
}