2014-11-27 18:27:34 +00:00
|
|
|
#ifndef HEADER_FreeBSDProcessList
|
|
|
|
#define HEADER_FreeBSDProcessList
|
|
|
|
/*
|
2014-11-27 19:44:55 +00:00
|
|
|
htop - FreeBSDProcessList.h
|
2014-11-27 18:27:34 +00:00
|
|
|
(C) 2014 Hisham H. Muhammad
|
2020-10-05 07:51:32 +00:00
|
|
|
Released under the GNU GPLv2, see the COPYING file
|
2014-11-27 18:27:34 +00:00
|
|
|
in the source distribution for its full text.
|
|
|
|
*/
|
|
|
|
|
2014-11-27 19:44:55 +00:00
|
|
|
#include <kvm.h>
|
2015-10-19 19:22:54 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/jail.h>
|
|
|
|
#include <sys/uio.h>
|
2016-01-31 16:41:55 +00:00
|
|
|
#include <sys/resource.h>
|
2015-10-19 19:22:54 +00:00
|
|
|
|
2020-09-19 11:55:23 +00:00
|
|
|
#include "FreeBSDProcess.h"
|
|
|
|
#include "Hashtable.h"
|
|
|
|
#include "Process.h"
|
|
|
|
#include "ProcessList.h"
|
|
|
|
#include "UsersTable.h"
|
|
|
|
#include "zfs/ZfsArcStats.h"
|
|
|
|
|
|
|
|
|
2015-10-19 19:22:54 +00:00
|
|
|
#define JAIL_ERRMSGLEN 1024
|
2020-09-03 06:42:18 +00:00
|
|
|
extern char jail_errmsg[JAIL_ERRMSGLEN];
|
2014-11-27 19:44:55 +00:00
|
|
|
|
2015-03-16 06:13:42 +00:00
|
|
|
typedef struct CPUData_ {
|
2016-01-31 16:41:55 +00:00
|
|
|
double userPercent;
|
|
|
|
double nicePercent;
|
|
|
|
double systemPercent;
|
|
|
|
double irqPercent;
|
|
|
|
double idlePercent;
|
|
|
|
double systemAllPercent;
|
2015-03-16 06:13:42 +00:00
|
|
|
} CPUData;
|
|
|
|
|
2014-11-27 19:44:55 +00:00
|
|
|
typedef struct FreeBSDProcessList_ {
|
|
|
|
ProcessList super;
|
|
|
|
kvm_t* kd;
|
2015-03-16 06:13:42 +00:00
|
|
|
|
2016-01-31 16:41:55 +00:00
|
|
|
unsigned long long int memWire;
|
|
|
|
unsigned long long int memActive;
|
|
|
|
unsigned long long int memInactive;
|
|
|
|
unsigned long long int memFree;
|
2019-07-07 23:27:00 +00:00
|
|
|
|
|
|
|
ZfsArcStats zfs;
|
2016-01-31 16:41:55 +00:00
|
|
|
|
2015-03-16 06:13:42 +00:00
|
|
|
CPUData* cpus;
|
|
|
|
|
2016-01-31 16:41:55 +00:00
|
|
|
unsigned long *cp_time_o;
|
|
|
|
unsigned long *cp_time_n;
|
|
|
|
|
|
|
|
unsigned long *cp_times_o;
|
|
|
|
unsigned long *cp_times_n;
|
|
|
|
|
2014-11-27 19:44:55 +00:00
|
|
|
} FreeBSDProcessList;
|
|
|
|
|
2020-09-09 09:38:15 +00:00
|
|
|
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
|
2014-11-27 20:31:39 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
void ProcessList_delete(ProcessList* this);
|
2015-03-17 02:01:48 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
char* FreeBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
|
2015-10-19 19:22:54 +00:00
|
|
|
|
2020-09-02 07:38:44 +00:00
|
|
|
char* FreeBSDProcessList_readJailName(struct kinfo_proc* kproc);
|
2020-09-03 06:42:18 +00:00
|
|
|
|
2020-10-13 14:03:37 +00:00
|
|
|
void ProcessList_goThroughEntries(ProcessList* this, bool pauseProcessUpdate);
|
2014-11-27 18:27:34 +00:00
|
|
|
|
|
|
|
#endif
|