summaryrefslogtreecommitdiffstats
path: root/ksysguard/ksysguardd/NetBSD/ProcessList.c
diff options
context:
space:
mode:
authorDaniel Collins <[email protected]>2023-05-27 17:39:13 +0100
committerDaniel Collins <[email protected]>2023-05-29 23:12:40 +0100
commitf885561fda56d3b6eb47b1979a547b49a00954a2 (patch)
tree7dd89f473a71a7809c0d197c258d76dd4467d856 /ksysguard/ksysguardd/NetBSD/ProcessList.c
parent31335a04ed9bc01fd3ede33afde40d6f3359f2e9 (diff)
downloadtdebase-f885561fda56d3b6eb47b1979a547b49a00954a2.tar.gz
tdebase-f885561fda56d3b6eb47b1979a547b49a00954a2.zip
[ksysguardd] Use size_t for storing process memory usage.
Avoids the process memory usage rolling over at 4GiB on 64-bit systems. Signed-off-by: Daniel Collins <[email protected]>
Diffstat (limited to 'ksysguard/ksysguardd/NetBSD/ProcessList.c')
-rw-r--r--ksysguard/ksysguardd/NetBSD/ProcessList.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/ksysguard/ksysguardd/NetBSD/ProcessList.c b/ksysguard/ksysguardd/NetBSD/ProcessList.c
index 13c65053d..a23af4cf3 100644
--- a/ksysguard/ksysguardd/NetBSD/ProcessList.c
+++ b/ksysguard/ksysguardd/NetBSD/ProcessList.c
@@ -91,18 +91,12 @@ typedef struct
* The total amount of memory the process uses. This includes shared and
* swapped memory.
*/
- unsigned int vmSize;
+ size_t vmSize;
/*
* The amount of physical memory the process currently uses.
*/
- unsigned int vmRss;
-
- /*
- * The amount of memory (shared/swapped/etc) the process shares with
- * other processes.
- */
- unsigned int vmLib;
+ size_t vmRss;
/*
* The number of 1/100 of a second the process has spend in user space.
@@ -200,10 +194,10 @@ updateProcess(int pid, struct kinfo_proc2 *p)
ps->userName[sizeof(ps->userName)-1]='\0';
ps->userLoad = 100.0 * ((double)(p->p_pctcpu) /FSCALE);
- ps->vmSize = (p->p_vm_tsize +
- p->p_vm_dsize +
- p->p_vm_ssize) * getpagesize();
- ps->vmRss = p->p_vm_rssize * getpagesize();
+ ps->vmSize = ((size_t)(p->p_vm_tsize) +
+ (size_t)(p->p_vm_dsize) +
+ (size_t)(p->p_vm_ssize)) * (size_t)(getpagesize());
+ ps->vmRss = (size_t)(p->p_vm_rssize) * (size_t)(getpagesize());
strlcpy(ps->name,p->p_comm ? p->p_comm : "????", sizeof(ps->name));
strlcpy(ps->status,(p->p_stat<=7)? statuses[p->p_stat]:"????", sizeof(ps->status));
@@ -316,7 +310,7 @@ printProcessList(const char* cmd)
ps = first_ctnr(ProcessList); /* skip 'kernel' entry */
for (ps = next_ctnr(ProcessList); ps; ps = next_ctnr(ProcessList))
{
- fprintf(CurrentClient, "%s\t%ld\t%ld\t%ld\t%ld\t%s\t%.2f\t%d\t%d\t%d\t%d\t%s\t%s\n",
+ fprintf(CurrentClient, "%s\t%ld\t%ld\t%ld\t%ld\t%s\t%.2f\t%d\t%d\t%zu\t%zu\t%s\t%s\n",
ps->name, (long)ps->pid, (long)ps->ppid,
(long)ps->uid, (long)ps->gid, ps->status,
ps->userLoad, ps->priority, ps->niceLevel,