aboutsummaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /openbsd
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/Battery.c72
-rw-r--r--openbsd/Battery.h13
-rw-r--r--openbsd/OpenBSDCRT.c21
-rw-r--r--openbsd/OpenBSDCRT.h13
-rw-r--r--openbsd/OpenBSDProcess.c147
-rw-r--r--openbsd/OpenBSDProcess.h19
-rw-r--r--openbsd/OpenBSDProcessList.c210
-rw-r--r--openbsd/OpenBSDProcessList.h13
-rw-r--r--openbsd/Platform.c266
-rw-r--r--openbsd/Platform.h37
10 files changed, 410 insertions, 401 deletions
diff --git a/openbsd/Battery.c b/openbsd/Battery.c
deleted file mode 100644
index c215e41..0000000
--- a/openbsd/Battery.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-htop - openbsd/Battery.c
-(C) 2015 Hisham H. Muhammad
-(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
-in the source distribution for its full text.
-*/
-
-#include "BatteryMeter.h"
-#include <sys/sysctl.h>
-#include <sys/sensors.h>
-#include <errno.h>
-#include <string.h>
-
-static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, size_t* sdlen) {
- for (int devn = 0;; devn++) {
- mib[2] = devn;
- if (sysctl(mib, 3, snsrdev, sdlen, NULL, 0) == -1) {
- if (errno == ENXIO)
- continue;
- if (errno == ENOENT)
- return false;
- }
- if (strcmp(name, snsrdev->xname) == 0) {
- return true;
- }
- }
-}
-
-void Battery_getData(double* level, ACPresence* isOnAC) {
- static int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0};
- struct sensor s;
- size_t slen = sizeof(struct sensor);
- struct sensordev snsrdev;
- size_t sdlen = sizeof(struct sensordev);
-
- bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen);
-
- *level = -1;
- if (found) {
- /* last full capacity */
- mib[3] = 7;
- mib[4] = 0;
- double last_full_capacity = 0;
- if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
- last_full_capacity = s.value;
- }
- if (last_full_capacity > 0) {
- /* remaining capacity */
- mib[3] = 7;
- mib[4] = 3;
- if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
- double charge = s.value;
- *level = 100*(charge / last_full_capacity);
- if (charge >= last_full_capacity) {
- *level = 100;
- }
- }
- }
- }
-
- found = findDevice("acpiac0", mib, &snsrdev, &sdlen);
-
- *isOnAC = AC_ERROR;
- if (found) {
- mib[3] = 9;
- mib[4] = 0;
- if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
- *isOnAC = s.value;
- }
- }
-}
diff --git a/openbsd/Battery.h b/openbsd/Battery.h
deleted file mode 100644
index e858b15..0000000
--- a/openbsd/Battery.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef HEADER_Battery
-#define HEADER_Battery
-/*
-htop - openbsd/Battery.h
-(C) 2015 Hisham H. Muhammad
-(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
-in the source distribution for its full text.
-*/
-
-void Battery_getData(double* level, ACPresence* isOnAC);
-
-#endif
diff --git a/openbsd/OpenBSDCRT.c b/openbsd/OpenBSDCRT.c
deleted file mode 100644
index 233d30c..0000000
--- a/openbsd/OpenBSDCRT.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-htop - UnsupportedCRT.c
-(C) 2014 Hisham H. Muhammad
-(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
-in the source distribution for its full text.
-*/
-
-#include "config.h"
-#include "CRT.h"
-#include <stdio.h>
-#include <stdlib.h>
-
-void CRT_handleSIGSEGV(int sgn) {
- (void) sgn;
- CRT_done();
- fprintf(stderr, "\n\nhtop " VERSION " aborting.\n");
- fprintf(stderr, "\nUnfortunately, you seem to be using an unsupported platform!");
- fprintf(stderr, "\nPlease contact your platform package maintainer!\n\n");
- abort();
-}
diff --git a/openbsd/OpenBSDCRT.h b/openbsd/OpenBSDCRT.h
deleted file mode 100644
index 85860a9..0000000
--- a/openbsd/OpenBSDCRT.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef HEADER_OpenBSDCRT
-#define HEADER_OpenBSDCRT
-/*
-htop - UnsupportedCRT.h
-(C) 2014 Hisham H. Muhammad
-(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
-in the source distribution for its full text.
-*/
-
-void CRT_handleSIGSEGV(int sgn);
-
-#endif
diff --git a/openbsd/OpenBSDProcess.c b/openbsd/OpenBSDProcess.c
index 1a80784..df5002a 100644
--- a/openbsd/OpenBSDProcess.c
+++ b/openbsd/OpenBSDProcess.c
@@ -2,157 +2,177 @@
htop - OpenBSDProcess.c
(C) 2015 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include "Process.h"
-#include "ProcessList.h"
#include "OpenBSDProcess.h"
-#include "Platform.h"
-#include "CRT.h"
#include <stdlib.h>
-#include <unistd.h>
-#include <sys/syscall.h>
+#include "CRT.h"
+#include "Process.h"
+#include "RichString.h"
+#include "XUtils.h"
-ProcessClass OpenBSDProcess_class = {
- .super = {
- .extends = Class(Process),
- .display = Process_display,
- .delete = Process_delete,
- .compare = OpenBSDProcess_compare
- },
- .writeField = (Process_WriteField) OpenBSDProcess_writeField,
-};
ProcessFieldData Process_fields[] = {
[0] = {
.name = "",
.title = NULL,
.description = NULL,
- .flags = 0, },
+ .flags = 0,
+ },
[PID] = {
.name = "PID",
.title = " PID ",
.description = "Process/thread ID",
- .flags = 0, },
+ .flags = 0,
+ },
[COMM] = {
.name = "Command",
.title = "Command ",
.description = "Command line",
- .flags = 0, },
+ .flags = 0,
+ },
[STATE] = {
.name = "STATE",
.title = "S ",
.description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)",
- .flags = 0, },
+ .flags = 0,
+ },
[PPID] = {
.name = "PPID",
.title = " PPID ",
.description = "Parent process ID",
- .flags = 0, },
+ .flags = 0,
+ },
[PGRP] = {
.name = "PGRP",
.title = " PGRP ",
.description = "Process group ID",
- .flags = 0, },
+ .flags = 0,
+ },
[SESSION] = {
.name = "SESSION",
.title = " SESN ",
.description = "Process's session ID",
- .flags = 0, },
+ .flags = 0,
+ },
[TTY_NR] = {
.name = "TTY_NR",
.title = " TTY ",
.description = "Controlling terminal",
- .flags = 0, },
+ .flags = 0,
+ },
[TPGID] = {
.name = "TPGID",
.title = " TPGID ",
.description = "Process ID of the fg process group of the controlling terminal",
- .flags = 0, },
+ .flags = 0,
+ },
[MINFLT] = {
.name = "MINFLT",
.title = " MINFLT ",
.description = "Number of minor faults which have not required loading a memory page from disk",
- .flags = 0, },
+ .flags = 0,
+ },
[MAJFLT] = {
.name = "MAJFLT",
.title = " MAJFLT ",
.description = "Number of major faults which have required loading a memory page from disk",
- .flags = 0, },
+ .flags = 0,
+ },
[PRIORITY] = {
.name = "PRIORITY",
.title = "PRI ",
.description = "Kernel's internal priority for the process",
- .flags = 0, },
+ .flags = 0,
+ },
[NICE] = {
.name = "NICE",
.title = " NI ",
.description = "Nice value (the higher the value, the more it lets other processes take priority)",
- .flags = 0, },
+ .flags = 0,
+ },
[STARTTIME] = {
.name = "STARTTIME",
.title = "START ",
.description = "Time the process was started",
- .flags = 0, },
+ .flags = 0,
+ },
[PROCESSOR] = {
.name = "PROCESSOR",
.title = "CPU ",
.description = "Id of the CPU the process last executed on",
- .flags = 0, },
- [M_SIZE] = {
- .name = "M_SIZE",
+ .flags = 0,
+ },
+ [M_VIRT] = {
+ .name = "M_VIRT",
.title = " VIRT ",
.description = "Total program size in virtual memory",
- .flags = 0, },
+ .flags = 0,
+ },
[M_RESIDENT] = {
.name = "M_RESIDENT",
.title = " RES ",
.description = "Resident set size, size of the text and data sections, plus stack usage",
- .flags = 0, },
+ .flags = 0,
+ },
[ST_UID] = {
.name = "ST_UID",
.title = " UID ",
.description = "User ID of the process owner",
- .flags = 0, },
+ .flags = 0,
+ },
[PERCENT_CPU] = {
.name = "PERCENT_CPU",
.title = "CPU% ",
.description = "Percentage of the CPU time the process used in the last sampling",
- .flags = 0, },
+ .flags = 0,
+ },
+ [PERCENT_NORM_CPU] = {
+ .name = "PERCENT_NORM_CPU",
+ .title = "NCPU%",
+ .description = "Normalized percentage of the CPU time the process used in the last sampling (normalized by cpu count)",
+ .flags = 0,
+ },
[PERCENT_MEM] = {
.name = "PERCENT_MEM",
.title = "MEM% ",
.description = "Percentage of the memory the process is using, based on resident memory size",
- .flags = 0, },
+ .flags = 0,
+ },
[USER] = {
.name = "USER",
.title = "USER ",
.description = "Username of the process owner (or user ID if name cannot be determined)",
- .flags = 0, },
+ .flags = 0,
+ },
[TIME] = {
.name = "TIME",
.title = " TIME+ ",
.description = "Total time the process has spent in user and system time",
- .flags = 0, },
+ .flags = 0,
+ },
[NLWP] = {
.name = "NLWP",
.title = "NLWP ",
.description = "Number of threads in the process",
- .flags = 0, },
+ .flags = 0,
+ },
[TGID] = {
.name = "TGID",
.title = " TGID ",
.description = "Thread group ID (i.e. process ID)",
- .flags = 0, },
+ .flags = 0,
+ },
[LAST_PROCESSFIELD] = {
.name = "*** report bug! ***",
.title = NULL,
.description = NULL,
- .flags = 0, },
+ .flags = 0,
+ },
};
ProcessPidColumn Process_pidColumns[] = {
@@ -165,11 +185,11 @@ ProcessPidColumn Process_pidColumns[] = {
{ .id = 0, .label = NULL },
};
-OpenBSDProcess* OpenBSDProcess_new(Settings* settings) {
+Process* OpenBSDProcess_new(const Settings* settings) {
OpenBSDProcess* this = xCalloc(sizeof(OpenBSDProcess), 1);
Object_setClass(this, Class(OpenBSDProcess));
Process_init(&this->super, settings);
- return this;
+ return &this->super;
}
void Process_delete(Object* cast) {
@@ -178,8 +198,8 @@ void Process_delete(Object* cast) {
free(this);
}
-void OpenBSDProcess_writeField(Process* this, RichString* str, ProcessField field) {
- //OpenBSDProcess* fp = (OpenBSDProcess*) this;
+static void OpenBSDProcess_writeField(const Process* this, RichString* str, ProcessField field) {
+ //const OpenBSDProcess* op = (const OpenBSDProcess*) this;
char buffer[256]; buffer[255] = '\0';
int attr = CRT_colors[DEFAULT_COLOR];
//int n = sizeof(buffer) - 1;
@@ -192,16 +212,21 @@ void OpenBSDProcess_writeField(Process* this, RichString* str, ProcessField fiel
RichString_append(str, attr, buffer);
}
-long OpenBSDProcess_compare(const void* v1, const void* v2) {
- OpenBSDProcess *p1, *p2;
- Settings *settings = ((Process*)v1)->settings;
+static long OpenBSDProcess_compare(const void* v1, const void* v2) {
+ const OpenBSDProcess *p1, *p2;
+ const Settings *settings = ((const Process*)v1)->settings;
+
if (settings->direction == 1) {
- p1 = (OpenBSDProcess*)v1;
- p2 = (OpenBSDProcess*)v2;
+ p1 = (const OpenBSDProcess*)v1;
+ p2 = (const OpenBSDProcess*)v2;
} else {
- p2 = (OpenBSDProcess*)v1;
- p1 = (OpenBSDProcess*)v2;
+ p2 = (const OpenBSDProcess*)v1;
+ p1 = (const OpenBSDProcess*)v2;
}
+
+ // remove if actually used
+ (void)p1; (void)p2;
+
switch (settings->sortKey) {
// add OpenBSD-specific fields here
default:
@@ -209,6 +234,16 @@ long OpenBSDProcess_compare(const void* v1, const void* v2) {
}
}
-bool Process_isThread(Process* this) {
- return (Process_isKernelThread(this));
+const ProcessClass OpenBSDProcess_class = {
+ .super = {
+ .extends = Class(Process),
+ .display = Process_display,
+ .delete = Process_delete,
+ .compare = OpenBSDProcess_compare
+ },
+ .writeField = OpenBSDProcess_writeField,
+};
+
+bool Process_isThread(const Process* this) {
+ return Process_isKernelThread(this) || Process_isUserlandThread(this);
}
diff --git a/openbsd/OpenBSDProcess.h b/openbsd/OpenBSDProcess.h
index fede6f8..2d01513 100644
--- a/openbsd/OpenBSDProcess.h
+++ b/openbsd/OpenBSDProcess.h
@@ -4,10 +4,17 @@
htop - OpenBSDProcess.h
(C) 2015 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
+#include <stdbool.h>
+
+#include "Object.h"
+#include "Process.h"
+#include "Settings.h"
+
+
typedef enum OpenBSDProcessFields_ {
// Add platform-specific fields here, with ids >= 100
LAST_PROCESSFIELD = 100,
@@ -21,20 +28,16 @@ typedef struct OpenBSDProcess_ {
#define Process_isUserlandThread(_process) (_process->pid != _process->tgid)
-extern ProcessClass OpenBSDProcess_class;
+extern const ProcessClass OpenBSDProcess_class;
extern ProcessFieldData Process_fields[];
extern ProcessPidColumn Process_pidColumns[];
-OpenBSDProcess* OpenBSDProcess_new(Settings* settings);
+Process* OpenBSDProcess_new(const Settings* settings);
void Process_delete(Object* cast);
-void OpenBSDProcess_writeField(Process* this, RichString* str, ProcessField field);
-
-long OpenBSDProcess_compare(const void* v1, const void* v2);
-
-bool Process_isThread(Process* this);
+bool Process_isThread(const Process* this);
#endif
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index c5d79f5..5412030 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -2,49 +2,53 @@
htop - OpenBSDProcessList.c
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include "CRT.h"
-#include "ProcessList.h"
#include "OpenBSDProcessList.h"
-#include "OpenBSDProcess.h"
#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
+#include <kvm.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include <sys/mount.h>
#include <sys/param.h>
#include <sys/proc.h>
-#include <sys/resource.h>
#include <sys/sched.h>
+#include <sys/swap.h>
#include <sys/sysctl.h>
#include <sys/types.h>
-#include <sys/user.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
+#include <uvm/uvmexp.h>
+
+#include "CRT.h"
+#include "Macros.h"
+#include "Object.h"
+#include "OpenBSDProcess.h"
+#include "Process.h"
+#include "ProcessList.h"
+#include "Settings.h"
+#include "XUtils.h"
+
static long fscale;
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
- int mib[] = { CTL_HW, HW_NCPU };
- int fmib[] = { CTL_KERN, KERN_FSCALE };
- int i, e;
- OpenBSDProcessList* opl;
- ProcessList* pl;
+ const int mib[] = { CTL_HW, HW_NCPU };
+ const int fmib[] = { CTL_KERN, KERN_FSCALE };
+ int r;
size_t size;
char errbuf[_POSIX2_LINE_MAX];
- opl = xCalloc(1, sizeof(OpenBSDProcessList));
- pl = (ProcessList*) opl;
- size = sizeof(pl->cpuCount);
+ OpenBSDProcessList* opl = xCalloc(1, sizeof(OpenBSDProcessList));
+ ProcessList* pl = (ProcessList*) opl;
ProcessList_init(pl, Class(OpenBSDProcess), usersTable, pidMatchList, userId);
- e = sysctl(mib, 2, &pl->cpuCount, &size, NULL, 0);
- if (e == -1 || pl->cpuCount < 1) {
+ size = sizeof(pl->cpuCount);
+ r = sysctl(mib, 2, &pl->cpuCount, &size, NULL, 0);
+ if (r < 0 || pl->cpuCount < 1) {
pl->cpuCount = 1;
}
opl->cpus = xCalloc(pl->cpuCount + 1, sizeof(CPUData));
@@ -54,8 +58,8 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
err(1, "fscale sysctl call failed");
}
- for (i = 0; i <= pl->cpuCount; i++) {
- CPUData *d = opl->cpus + i;
+ for (int i = 0; i <= pl->cpuCount; i++) {
+ CPUData* d = opl->cpus + i;
d->totalTime = 1;
d->totalPeriod = 1;
}
@@ -69,7 +73,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
}
void ProcessList_delete(ProcessList* this) {
- const OpenBSDProcessList* opl = (OpenBSDProcessList*) this;
+ OpenBSDProcessList* opl = (OpenBSDProcessList*) this;
if (opl->kd) {
kvm_close(opl->kd);
@@ -81,8 +85,8 @@ void ProcessList_delete(ProcessList* this) {
free(this);
}
-static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
- static int uvmexp_mib[] = {CTL_VM, VM_UVMEXP};
+static void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
+ const int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
struct uvmexp uvmexp;
size_t size_uvmexp = sizeof(uvmexp);
@@ -90,10 +94,11 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
err(1, "uvmexp sysctl call failed");
}
- pl->totalMem = uvmexp.npages * PAGE_SIZE_KB;
+ pl->totalMem = uvmexp.npages * CRT_pageSizeKB;
+ pl->usedMem = (uvmexp.npages - uvmexp.free - uvmexp.paging) * CRT_pageSizeKB;
// Taken from OpenBSD systat/iostat.c, top/machine.c and uvm_sysctl(9)
- static int bcache_mib[] = {CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT};
+ const int bcache_mib[] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT };
struct bcachestats bcstats;
size_t size_bcstats = sizeof(bcstats);
@@ -101,56 +106,56 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
err(1, "cannot get vfs.bcachestat");
}
- pl->cachedMem = bcstats.numbufpages * PAGE_SIZE_KB;
- pl->freeMem = uvmexp.free * PAGE_SIZE_KB;
- pl->usedMem = (uvmexp.npages - uvmexp.free - uvmexp.paging) * PAGE_SIZE_KB;
+ pl->cachedMem = bcstats.numbufpages * CRT_pageSizeKB;
/*
- const OpenBSDProcessList* opl = (OpenBSDProcessList*) pl;
-
- size_t len = sizeof(pl->totalMem);
- sysctl(MIB_hw_physmem, 2, &(pl->totalMem), &len, NULL, 0);
- pl->totalMem /= 1024;
- sysctl(MIB_vm_stats_vm_v_wire_count, 4, &(pl->usedMem), &len, NULL, 0);
- pl->usedMem *= PAGE_SIZE_KB;
- pl->freeMem = pl->totalMem - pl->usedMem;
- sysctl(MIB_vm_stats_vm_v_cache_count, 4, &(pl->cachedMem), &len, NULL, 0);
- pl->cachedMem *= PAGE_SIZE_KB;
-
- struct kvm_swap swap[16];
- int nswap = kvm_getswapinfo(opl->kd, swap, sizeof(swap)/sizeof(swap[0]), 0);
- pl->totalSwap = 0;
- pl->usedSwap = 0;
- for (int i = 0; i < nswap; i++) {
- pl->totalSwap += swap[i].ksw_total;
- pl->usedSwap += swap[i].ksw_used;
- }
- pl->totalSwap *= PAGE_SIZE_KB;
- pl->usedSwap *= PAGE_SIZE_KB;
+ * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
+ * All rights reserved.
+ *
+ * Taken almost directly from OpenBSD's top(1)
+ *
+ * Originally released under a BSD-3 license
+ * Modified through htop developers applying GPL-2
+ */
+ int nswap = swapctl(SWAP_NSWAP, 0, 0);
+ if (nswap > 0) {
+ struct swapent swdev[nswap];
+ int rnswap = swapctl(SWAP_STATS, swdev, nswap);
+
+ /* Total things up */
+ unsigned long long int total = 0, used = 0;
+ for (int i = 0; i < rnswap; i++) {
+ if (swdev[i].se_flags & SWF_ENABLE) {
+ used += (swdev[i].se_inuse / (1024 / DEV_BSIZE));
+ total += (swdev[i].se_nblks / (1024 / DEV_BSIZE));
+ }
+ }
- pl->sharedMem = 0; // currently unused
- pl->buffersMem = 0; // not exposed to userspace
- */
+ pl->totalSwap = total;
+ pl->usedSwap = used;
+ } else {
+ pl->totalSwap = pl->usedSwap = 0;
+ }
}
-char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
- char *s, **arg;
- size_t len = 0, n;
- int i;
-
+static char* OpenBSDProcessList_readProcessName(kvm_t* kd, const struct kinfo_proc* kproc, int* basenameEnd) {
/*
* Like OpenBSD's top(1), we try to fall back to the command name
* (argv[0]) if we fail to construct the full command.
*/
- arg = kvm_getargv(kd, kproc, 500);
+ char** arg = kvm_getargv(kd, kproc, 500);
if (arg == NULL || *arg == NULL) {
*basenameEnd = strlen(kproc->p_comm);
return xStrdup(kproc->p_comm);
}
- for (i = 0; arg[i] != NULL; i++) {
+
+ size_t len = 0;
+ for (int i = 0; arg[i] != NULL; i++) {
len += strlen(arg[i]) + 1; /* room for arg and trailing space or NUL */
}
+
/* don't use xMalloc here - we want to handle huge argv's gracefully */
+ char* s;
if ((s = malloc(len)) == NULL) {
*basenameEnd = strlen(kproc->p_comm);
return xStrdup(kproc->p_comm);
@@ -158,11 +163,10 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
*s = '\0';
- for (i = 0; arg[i] != NULL; i++) {
- n = strlcat(s, arg[i], len);
+ for (int i = 0; arg[i] != NULL; i++) {
+ size_t n = strlcat(s, arg[i], len);
if (i == 0) {
- /* TODO: rename all basenameEnd to basenameLen, make size_t */
- *basenameEnd = MINIMUM(n, len-1);
+ *basenameEnd = MINIMUM(n, len - 1);
}
/* the trailing space should get truncated anyway */
strlcat(s, " ", len);
@@ -174,43 +178,29 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
/*
* Taken from OpenBSD's ps(1).
*/
-static double getpcpu(const struct kinfo_proc *kp) {
+static double getpcpu(const struct kinfo_proc* kp) {
if (fscale == 0)
- return (0.0);
+ return 0.0;
-#define fxtofl(fixpt) ((double)(fixpt) / fscale)
-
- return (100.0 * fxtofl(kp->p_pctcpu));
+ return 100.0 * (double)kp->p_pctcpu / fscale;
}
-static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
- Settings* settings = this->super.settings;
+static void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
+ const Settings* settings = this->super.settings;
bool hideKernelThreads = settings->hideKernelThreads;
bool hideUserlandThreads = settings->hideUserlandThreads;
- struct kinfo_proc* kproc;
- bool preExisting;
- Process* proc;
- OpenBSDProcess* fp;
- struct tm date;
- struct timeval tv;
int count = 0;
- int i;
-
- // use KERN_PROC_KTHREAD to also include kernel threads
- struct kinfo_proc* kprocs = kvm_getprocs(this->kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc), &count);
- //struct kinfo_proc* kprocs = getprocs(KERN_PROC_ALL, 0, &count);
- gettimeofday(&tv, NULL);
+ const struct kinfo_proc* kprocs = kvm_getprocs(this->kd, KERN_PROC_KTHREAD, 0, sizeof(struct kinfo_proc), &count);
- for (i = 0; i < count; i++) {
- kproc = &kprocs[i];
+ for (int i = 0; i < count; i++) {
+ const struct kinfo_proc* kproc = &kprocs[i];
- preExisting = false;
- proc = ProcessList_getProcess(&this->super, kproc->p_pid, &preExisting, (Process_New) OpenBSDProcess_new);
- fp = (OpenBSDProcess*) proc;
+ bool preExisting = false;
+ Process* proc = ProcessList_getProcess(&this->super, kproc->p_pid, &preExisting, OpenBSDProcess_new);
+ //OpenBSDProcess* fp = (OpenBSDProcess*) proc;
- proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc))
- || (hideUserlandThreads && Process_isUserlandThread(proc)));
+ proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
if (!preExisting) {
proc->ppid = kproc->p_ppid;
@@ -221,11 +211,10 @@ static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
proc->pgrp = kproc->p__pgid;
proc->st_uid = kproc->p_uid;
proc->starttime_ctime = kproc->p_ustart_sec;
+ Process_fillStarttimeBuffer(proc);
proc->user = UsersTable_getRef(this->super.usersTable, proc->st_uid);
ProcessList_add(&this->super, proc);
proc->comm = OpenBSDProcessList_readProcessName(this->kd, kproc, &proc->basenameOffset);
- (void) localtime_r((time_t*) &kproc->p_ustart_sec, &date);
- strftime(proc->starttime_show, 7, ((proc->starttime_ctime > tv.tv_sec - 86400) ? "%R " : "%b%d "), &date);
} else {
if (settings->updateProcessNames) {
free(proc->comm);
@@ -233,15 +222,13 @@ static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
}
}
- proc->m_size = kproc->p_vm_dsize;
+ proc->m_virt = kproc->p_vm_dsize;
proc->m_resident = kproc->p_vm_rssize;
- proc->percent_mem = (proc->m_resident * PAGE_SIZE_KB) / (double)(this->super.totalMem) * 100.0;
- proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount*100.0);
+ proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(this->super.totalMem) * 100.0;
+ proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount * 100.0);
//proc->nlwp = kproc->p_numthreads;
- //proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 10);
proc->nice = kproc->p_nice - 20;
- proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 1000000);
- proc->time *= 100;
+ proc->time = 100 * (kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 1000000));
proc->priority = kproc->p_priority - PZERO;
switch (kproc->p_stat) {
@@ -273,10 +260,9 @@ static unsigned long long saturatingSub(unsigned long long a, unsigned long long
}
static void getKernelCPUTimes(int cpuId, u_int64_t* times) {
- int mib[] = { CTL_KERN, KERN_CPTIME2, cpuId };
- size_t length = sizeof(u_int64_t) * CPUSTATES;
- if (sysctl(mib, 3, times, &length, NULL, 0) == -1 ||
- length != sizeof(u_int64_t) * CPUSTATES) {
+ const int mib[] = { CTL_KERN, KERN_CPTIME2, cpuId };
+ size_t length = sizeof(*times) * CPUSTATES;
+ if (sysctl(mib, 3, times, &length, NULL, 0) == -1 || length != sizeof(*times) * CPUSTATES) {
CRT_fatalError("sysctl kern.cp_time2 failed");
}
}
@@ -344,10 +330,16 @@ static void OpenBSDProcessList_scanCPUTime(OpenBSDProcessList* this) {
kernelCPUTimesToHtop(avg, this->cpus);
}
-void ProcessList_goThroughEntries(ProcessList* this) {
- OpenBSDProcessList* opl = (OpenBSDProcessList*) this;
+void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
+ OpenBSDProcessList* opl = (OpenBSDProcessList*) super;
- OpenBSDProcessList_scanMemoryInfo(this);
- OpenBSDProcessList_scanProcs(opl);
+ OpenBSDProcessList_scanMemoryInfo(super);
OpenBSDProcessList_scanCPUTime(opl);
+
+ // in pause mode only gather global data for meters (CPU/memory/...)
+ if (pauseProcessUpdate) {
+ return;
+ }
+
+ OpenBSDProcessList_scanProcs(opl);
}
diff --git a/openbsd/OpenBSDProcessList.h b/openbsd/OpenBSDProcessList.h
index 0d9defb..a6195a5 100644
--- a/openbsd/OpenBSDProcessList.h
+++ b/openbsd/OpenBSDProcessList.h
@@ -4,11 +4,18 @@
htop - OpenBSDProcessList.h
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include <kvm.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+#include "Hashtable.h"
+#include "ProcessList.h"
+#include "UsersTable.h"
+
typedef struct CPUData_ {
unsigned long long int totalTime;
@@ -43,8 +50,6 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
void ProcessList_delete(ProcessList* this);
-char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
-
-void ProcessList_goThroughEntries(ProcessList* this);
+void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
#endif
diff --git a/openbsd/Platform.c b/openbsd/Platform.c
index cb16207..dae8072 100644
--- a/openbsd/Platform.c
+++ b/openbsd/Platform.c
@@ -2,43 +2,47 @@
htop - openbsd/Platform.c
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
#include "Platform.h"
-#include "Meter.h"
+
+#include <errno.h>
+#include <kvm.h>
+#include <limits.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <sys/resource.h>
+#include <sys/sensors.h>
+#include <sys/sysctl.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <uvm/uvmexp.h>
+
#include "CPUMeter.h"
-#include "MemoryMeter.h"
-#include "SwapMeter.h"
-#include "TasksMeter.h"
-#include "LoadAverageMeter.h"
-#include "UptimeMeter.h"
#include "ClockMeter.h"
+#include "DateMeter.h"
+#include "DateTimeMeter.h"
#include "HostnameMeter.h"
-#include "SignalsPanel.h"
+#include "LoadAverageMeter.h"
+#include "Macros.h"
+#include "MemoryMeter.h"
+#include "Meter.h"
#include "OpenBSDProcess.h"
#include "OpenBSDProcessList.h"
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <sys/swap.h>
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <time.h>
-#include <fcntl.h>
-#include <kvm.h>
-#include <limits.h>
-#include <math.h>
+#include "ProcessList.h"
+#include "Settings.h"
+#include "SignalsPanel.h"
+#include "SwapMeter.h"
+#include "TasksMeter.h"
+#include "UptimeMeter.h"
+#include "XUtils.h"
-ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
+ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_VIRT, M_RESIDENT, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 };
int Platform_numberOfFields = LAST_PROCESSFIELD;
@@ -82,15 +86,13 @@ const SignalItem Platform_signals[] = {
{ .name = "32 SIGTHR", .number = 32 },
};
-const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
+const unsigned int Platform_numberOfSignals = ARRAYSIZE(Platform_signals);
-void Platform_setBindings(Htop_Action* keys) {
- (void) keys;
-}
-
-MeterClass* Platform_meterTypes[] = {
+const MeterClass* const Platform_meterTypes[] = {
&CPUMeter_class,
&ClockMeter_class,
+ &DateMeter_class,
+ &DateTimeMeter_class,
&LoadAverageMeter_class,
&LoadMeter_class,
&MemoryMeter_class,
@@ -101,18 +103,36 @@ MeterClass* Platform_meterTypes[] = {
&HostnameMeter_class,
&AllCPUsMeter_class,
&AllCPUs2Meter_class,
+ &AllCPUs4Meter_class,
+ &AllCPUs8Meter_class,
&LeftCPUsMeter_class,
&RightCPUsMeter_class,
&LeftCPUs2Meter_class,
&RightCPUs2Meter_class,
+ &LeftCPUs4Meter_class,
+ &RightCPUs4Meter_class,
+ &LeftCPUs8Meter_class,
+ &RightCPUs8Meter_class,
&BlankMeter_class,
NULL
};
-// preserved from FreeBSD port
+void Platform_init(void) {
+ /* no platform-specific setup needed */
+}
+
+void Platform_done(void) {
+ /* no platform-specific cleanup needed */
+}
+
+void Platform_setBindings(Htop_Action* keys) {
+ /* no platform-specific key bindings */
+ (void) keys;
+}
+
int Platform_getUptime() {
struct timeval bootTime, currTime;
- int mib[2] = { CTL_KERN, KERN_BOOTTIME };
+ const int mib[2] = { CTL_KERN, KERN_BOOTTIME };
size_t size = sizeof(bootTime);
int err = sysctl(mib, 2, &bootTime, &size, NULL, 0);
@@ -126,7 +146,7 @@ int Platform_getUptime() {
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
struct loadavg loadAverage;
- int mib[2] = { CTL_VM, VM_LOADAVG };
+ const int mib[2] = { CTL_VM, VM_LOADAVG };
size_t size = sizeof(loadAverage);
int err = sysctl(mib, 2, &loadAverage, &size, NULL, 0);
@@ -142,16 +162,16 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
}
int Platform_getMaxPid() {
- // this is hard-coded in sys/sys/proc.h - no sysctl exists
+ // this is hard-coded in sys/proc.h - no sysctl exists
return 99999;
}
double Platform_setCPUValues(Meter* this, int cpu) {
- const OpenBSDProcessList* pl = (OpenBSDProcessList*) this->pl;
+ const OpenBSDProcessList* pl = (const OpenBSDProcessList*) this->pl;
const CPUData* cpuData = &(pl->cpus[cpu]);
double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod;
double totalPercent;
- double *v = this->values;
+ double* v = this->values;
v[CPU_METER_NICE] = cpuData->nicePeriod / total * 100.0;
v[CPU_METER_NORMAL] = cpuData->userPeriod / total * 100.0;
@@ -162,23 +182,25 @@ double Platform_setCPUValues(Meter* this, int cpu) {
v[CPU_METER_STEAL] = 0.0;
v[CPU_METER_GUEST] = 0.0;
v[CPU_METER_IOWAIT] = 0.0;
- v[CPU_METER_FREQUENCY] = -1;
- Meter_setItems(this, 8);
- totalPercent = v[0]+v[1]+v[2]+v[3];
+ v[CPU_METER_FREQUENCY] = NAN;
+ this->curItems = 8;
+ totalPercent = v[0] + v[1] + v[2] + v[3];
} else {
v[2] = cpuData->sysAllPeriod / total * 100.0;
v[3] = 0.0; // No steal nor guest on OpenBSD
- totalPercent = v[0]+v[1]+v[2];
- Meter_setItems(this, 4);
+ totalPercent = v[0] + v[1] + v[2];
+ this->curItems = 4;
}
totalPercent = CLAMP(totalPercent, 0.0, 100.0);
- if (isnan(totalPercent)) totalPercent = 0.0;
+
+ v[CPU_METER_TEMPERATURE] = NAN;
+
return totalPercent;
}
void Platform_setMemoryValues(Meter* this) {
- ProcessList* pl = (ProcessList*) this->pl;
+ const ProcessList* pl = this->pl;
long int usedMem = pl->usedMem;
long int buffersMem = pl->buffersMem;
long int cachedMem = pl->cachedMem;
@@ -189,65 +211,27 @@ void Platform_setMemoryValues(Meter* this) {
this->values[2] = cachedMem;
}
-/*
- * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
- * All rights reserved.
- *
- * Taken almost directly from OpenBSD's top(1)
- */
void Platform_setSwapValues(Meter* this) {
- ProcessList* pl = (ProcessList*) this->pl;
- struct swapent *swdev;
- unsigned long long int total, used;
- int nswap, rnswap, i;
- nswap = swapctl(SWAP_NSWAP, 0, 0);
- if (nswap == 0) {
- return;
- }
-
- swdev = xCalloc(nswap, sizeof(*swdev));
-
- rnswap = swapctl(SWAP_STATS, swdev, nswap);
- if (rnswap == -1) {
- free(swdev);
- return;
- }
-
- // if rnswap != nswap, then what?
-
- /* Total things up */
- total = used = 0;
- for (i = 0; i < nswap; i++) {
- if (swdev[i].se_flags & SWF_ENABLE) {
- used += (swdev[i].se_inuse / (1024 / DEV_BSIZE));
- total += (swdev[i].se_nblks / (1024 / DEV_BSIZE));
- }
- }
-
- this->total = pl->totalSwap = total;
- this->values[0] = pl->usedSwap = used;
-
- free(swdev);
-}
-
-void Platform_setTasksValues(Meter* this) {
- // TODO
+ const ProcessList* pl = this->pl;
+ this->total = pl->totalSwap;
+ this->values[0] = pl->usedSwap;
}
char* Platform_getProcessEnv(pid_t pid) {
char errbuf[_POSIX2_LINE_MAX];
- char *env;
- char **ptr;
+ char* env;
+ char** ptr;
int count;
- kvm_t *kt;
- struct kinfo_proc *kproc;
+ kvm_t* kt;
+ struct kinfo_proc* kproc;
size_t capacity = 4096, size = 0;
- if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
+ if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL) {
return NULL;
+ }
if ((kproc = kvm_getprocs(kt, KERN_PROC_PID, pid,
- sizeof(struct kinfo_proc), &count)) == NULL) {\
+ sizeof(struct kinfo_proc), &count)) == NULL) {
(void) kvm_close(kt);
return NULL;
}
@@ -258,7 +242,7 @@ char* Platform_getProcessEnv(pid_t pid) {
}
env = xMalloc(capacity);
- for (char **p = ptr; *p; p++) {
+ for (char** p = ptr; *p; p++) {
size_t len = strlen(*p) + 1;
if (size + len > capacity) {
@@ -271,12 +255,98 @@ char* Platform_getProcessEnv(pid_t pid) {
}
if (size < 2 || env[size - 1] || env[size - 2]) {
- if (size + 2 < capacity)
- env = xRealloc(env, capacity + 2);
- env[size] = 0;
- env[size+1] = 0;
+ if (size + 2 < capacity)
+ env = xRealloc(env, capacity + 2);
+ env[size] = 0;
+ env[size + 1] = 0;
}
(void) kvm_close(kt);
return env;
}
+
+char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
+ (void)pid;
+ (void)inode;
+ return NULL;
+}
+
+FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
+ (void)pid;
+ return NULL;
+}
+
+bool Platform_getDiskIO(DiskIOData* data) {
+ // TODO
+ (void)data;
+ return false;
+}
+
+bool Platform_getNetworkIO(unsigned long int* bytesReceived,
+ unsigned long int* packetsReceived,
+ unsigned long int* bytesTransmitted,
+ unsigned long int* packetsTransmitted) {
+ // TODO
+ *bytesReceived = 0;
+ *packetsReceived = 0;
+ *bytesTransmitted = 0;
+ *packetsTransmitted = 0;
+ return false;
+}
+
+static bool findDevice(const char* name, int* mib, struct sensordev* snsrdev, size_t* sdlen) {
+ for (int devn = 0;; devn++) {
+ mib[2] = devn;
+ if (sysctl(mib, 3, snsrdev, sdlen, NULL, 0) == -1) {
+ if (errno == ENXIO)
+ continue;
+ if (errno == ENOENT)
+ return false;
+ }
+ if (strcmp(name, snsrdev->xname) == 0) {
+ return true;
+ }
+ }
+}
+
+void Platform_getBattery(double* percent, ACPresence* isOnAC) {
+ int mib[] = {CTL_HW, HW_SENSORS, 0, 0, 0};
+ struct sensor s;
+ size_t slen = sizeof(struct sensor);
+ struct sensordev snsrdev;
+ size_t sdlen = sizeof(struct sensordev);
+
+ bool found = findDevice("acpibat0", mib, &snsrdev, &sdlen);
+
+ *percent = NAN;
+ if (found) {
+ /* last full capacity */
+ mib[3] = 7;
+ mib[4] = 0;
+ double last_full_capacity = 0;
+ if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1)
+ last_full_capacity = s.value;
+ if (last_full_capacity > 0) {
+ /* remaining capacity */
+ mib[3] = 7;
+ mib[4] = 3;
+ if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
+ double charge = s.value;
+ *percent = 100 * (charge / last_full_capacity);
+ if (charge >= last_full_capacity) {
+ *percent = 100;
+ }
+ }
+ }
+ }
+
+ found = findDevice("acpiac0", mib, &snsrdev, &sdlen);
+
+ *isOnAC = AC_ERROR;
+ if (found) {
+ mib[3] = 9;
+ mib[4] = 0;
+ if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1)
+ *isOnAC = s.value;
+ }
+}
diff --git a/openbsd/Platform.h b/openbsd/Platform.h
index f51d6bc..0e2d435 100644
--- a/openbsd/Platform.h
+++ b/openbsd/Platform.h
@@ -4,14 +4,22 @@
htop - openbsd/Platform.h
(C) 2014 Hisham H. Muhammad
(C) 2015 Michael McConville
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
+#include <stdbool.h>
+#include <sys/types.h>
+
#include "Action.h"
#include "BatteryMeter.h"
+#include "DiskIOMeter.h"
+#include "Meter.h"
+#include "Process.h"
+#include "ProcessLocksScreen.h"
#include "SignalsPanel.h"
+
extern ProcessFieldData Process_fields[];
extern ProcessField Platform_defaultFields[];
@@ -23,15 +31,19 @@ extern const SignalItem Platform_signals[];
extern const unsigned int Platform_numberOfSignals;
-void Platform_setBindings(Htop_Action* keys);
+extern const MeterClass* const Platform_meterTypes[];
-extern MeterClass* Platform_meterTypes[];
+void Platform_init(void);
+
+void Platform_done(void);
+
+void Platform_setBindings(Htop_Action* keys);
-int Platform_getUptime();
+int Platform_getUptime(void);
void Platform_getLoadAverage(double* one, double* five, double* fifteen);
-int Platform_getMaxPid();
+int Platform_getMaxPid(void);
double Platform_setCPUValues(Meter* this, int cpu);
@@ -39,8 +51,19 @@ void Platform_setMemoryValues(Meter* this);
void Platform_setSwapValues(Meter* this);
-void Platform_setTasksValues(Meter* this);
-
char* Platform_getProcessEnv(pid_t pid);
+char* Platform_getInodeFilename(pid_t pid, ino_t inode);
+
+FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);
+
+bool Platform_getDiskIO(DiskIOData* data);
+
+bool Platform_getNetworkIO(unsigned long int* bytesReceived,
+ unsigned long int* packetsReceived,
+ unsigned long int* bytesTransmitted,
+ unsigned long int* packetsTransmitted);
+
+void Platform_getBattery(double* percent, ACPresence* isOnAC);
+
#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy