summaryrefslogtreecommitdiffstats
path: root/ksysguard/ksysguardd
diff options
context:
space:
mode:
Diffstat (limited to 'ksysguard/ksysguardd')
-rw-r--r--ksysguard/ksysguardd/CMakeLists.txt2
-rw-r--r--ksysguard/ksysguardd/FreeBSD/ProcessList.c18
-rw-r--r--ksysguard/ksysguardd/Linux/ProcessList.c8
-rw-r--r--ksysguard/ksysguardd/NetBSD/ProcessList.c20
-rw-r--r--ksysguard/ksysguardd/OpenBSD/ProcessList.c20
-rw-r--r--ksysguard/ksysguardd/Porting-HOWTO2
-rw-r--r--ksysguard/ksysguardd/Solaris/CMakeLists.txt25
-rw-r--r--ksysguard/ksysguardd/modules.h4
8 files changed, 54 insertions, 45 deletions
diff --git a/ksysguard/ksysguardd/CMakeLists.txt b/ksysguard/ksysguardd/CMakeLists.txt
index f90bdadb0..16019bdc1 100644
--- a/ksysguard/ksysguardd/CMakeLists.txt
+++ b/ksysguard/ksysguardd/CMakeLists.txt
@@ -21,6 +21,8 @@ elseif( ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" )
set( OS_SPECIFIC_DIR FreeBSD )
elseif( ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD" )
set( OS_SPECIFIC_DIR NetBSD )
+elseif( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" )
+ set( OS_SPECIFIC_DIR Solaris )
else()
tde_message_fatal( "Your operating system (${CMAKE_SYSTEM_NAME}) is not supported yet." )
endif()
diff --git a/ksysguard/ksysguardd/FreeBSD/ProcessList.c b/ksysguard/ksysguardd/FreeBSD/ProcessList.c
index f8d2c3ba6..dbb330efb 100644
--- a/ksysguard/ksysguardd/FreeBSD/ProcessList.c
+++ b/ksysguard/ksysguardd/FreeBSD/ProcessList.c
@@ -98,18 +98,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.
@@ -264,20 +258,20 @@ updateProcess(int pid)
#if __FreeBSD_version >= 500015
ps->userLoad = 100.0 * (double) p.ki_pctcpu / fscale;
ps->vmSize = p.ki_size;
- ps->vmRss = p.ki_rssize * getpagesize();
+ ps->vmRss = (size_t)(p.ki_rssize) * (size_t)(getpagesize());
strlcpy(ps->name,p.ki_comm? p.ki_comm:"????",sizeof(ps->name));
strcpy(ps->status,(p.ki_stat>=1)&&(p.ki_stat<=5)? statuses[p.ki_stat-1]:"????");
#elif defined (__DragonFly__) && __DragonFly_version >= 190000
ps->userLoad = 100.0 * (double) p.kp_lwp.kl_pctcpu / fscale;
ps->vmSize = p.kp_vm_map_size;
- ps->vmRss = p.kp_vm_rssize * getpagesize();
+ ps->vmRss = (size_t)(p.kp_vm_rssize) * (size_t)(getpagesize());
strlcpy(ps->name,p.kp_comm ? p.kp_comm : "????",
sizeof(ps->name));
strcpy(ps->status,(p.kp_stat>=1)&&(p.kp_stat<=5)? statuses[p.kp_stat-1]:"????");
#else
ps->userLoad = 100.0 * (double) p.kp_proc.p_pctcpu / fscale;
ps->vmSize = p.kp_eproc.e_vm.vm_map.size;
- ps->vmRss = p.kp_eproc.e_vm.vm_rssize * getpagesize();
+ ps->vmRss = (size_t)(p.kp_eproc.e_vm.vm_rssize) * (size_t)(getpagesize());
#if defined (__DragonFly__)
strlcpy(ps->name,p.kp_thread.td_comm ? p.kp_thread.td_comm : "????",
sizeof(ps->name));
@@ -417,7 +411,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%.2f\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%.2f\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->sysLoad, ps->niceLevel,
diff --git a/ksysguard/ksysguardd/Linux/ProcessList.c b/ksysguard/ksysguardd/Linux/ProcessList.c
index 2708664bd..8582aae56 100644
--- a/ksysguard/ksysguardd/Linux/ProcessList.c
+++ b/ksysguard/ksysguardd/Linux/ProcessList.c
@@ -84,10 +84,10 @@ 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;
+ size_t vmRss;
/**
The number of 1/100 of a second the process has spend in user space.
@@ -215,7 +215,7 @@ static int updateProcess( int pid )
return -1;
if ( fscanf( fd, "%*d %*s %c %d %d %*d %d %*d %*u %*u %*u %*u %*u %d %d"
- "%*d %*d %*d %d %*u %*u %*d %u %u",
+ "%*d %*d %*d %d %*u %*u %*d %zu %zu",
&status, (int*)&ps->ppid, (int*)&ps->gid, &ps->ttyNo,
&userTime, &sysTime, &ps->niceLevel, &ps->vmSize,
&ps->vmRss) != 9 ) {
@@ -419,7 +419,7 @@ void printProcessList( const char* cmd )
(void)cmd;
for ( ps = first_ctnr( ProcessList ); ps; ps = next_ctnr( ProcessList ) ) {
- fprintf( CurrentClient, "%s\t%ld\t%ld\t%ld\t%ld\t%s\t%.2f\t%.2f\t%d\t%d\t%d"
+ fprintf( CurrentClient, "%s\t%ld\t%ld\t%ld\t%ld\t%s\t%.2f\t%.2f\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->sysLoad, ps->niceLevel, ps->vmSize / 1024, ps->vmRss / 1024,
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,
diff --git a/ksysguard/ksysguardd/OpenBSD/ProcessList.c b/ksysguard/ksysguardd/OpenBSD/ProcessList.c
index ccdcc2313..f84ff0b2d 100644
--- a/ksysguard/ksysguardd/OpenBSD/ProcessList.c
+++ b/ksysguard/ksysguardd/OpenBSD/ProcessList.c
@@ -88,18 +88,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.
@@ -245,10 +239,10 @@ updateProcess(struct kinfo_proc *p)
ps->userName[sizeof(ps->userName)-1]='\0';
ps->userLoad = p->p_pctcpu / 100;
- 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>=1)&&(p->p_stat<=5)? statuses[p->p_stat-1]:"????", sizeof(ps->status));
@@ -362,7 +356,7 @@ printProcessList(const char* cmd)
for (ps = first_ctnr(ProcessList); ps; ps = next_ctnr(ProcessList))
{
- fprintf(CurrentClient, "%s\t%ld\t%ld\t%ld\t%ld\t%s\t%.2f\t%.2f\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%.2f\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->sysLoad, ps->niceLevel,
diff --git a/ksysguard/ksysguardd/Porting-HOWTO b/ksysguard/ksysguardd/Porting-HOWTO
index 4576783bc..f7096b03d 100644
--- a/ksysguard/ksysguardd/Porting-HOWTO
+++ b/ksysguard/ksysguardd/Porting-HOWTO
@@ -112,7 +112,7 @@ COMMAND\nksysguardd> ".
ksysguardd does not handle native language support. In order to have a
minimum installation (only a single file) on the monitored machine,
all translation are handled by the front-end. Please see the files
-gui/ksgrd/SensorManger.cc and gui/SensorDisplayLib/ProcessTable.cc
+gui/ksgrd/SensorManger.cpp and gui/SensorDisplayLib/ProcessTable.cpp
if you add new strings.
/**
diff --git a/ksysguard/ksysguardd/Solaris/CMakeLists.txt b/ksysguard/ksysguardd/Solaris/CMakeLists.txt
new file mode 100644
index 000000000..aeeda9ac3
--- /dev/null
+++ b/ksysguard/ksysguardd/Solaris/CMakeLists.txt
@@ -0,0 +1,25 @@
+#################################################
+#
+# (C) 2023 Denis Kozadaev
+# denis (AT) tambov (DOT) ru
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+
+include_directories(
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/ksysguard/CContLib
+ ${CMAKE_SOURCE_DIR}/ksysguard/ksysguardd
+)
+
+
+##### ksysguardd (static) #######################
+
+tde_add_library( ksysguardd STATIC
+ SOURCES
+ Memory.c LoadAvg.c ProcessList.c NetDev.c
+)
diff --git a/ksysguard/ksysguardd/modules.h b/ksysguard/ksysguardd/modules.h
index fe66ad537..6130f2a83 100644
--- a/ksysguard/ksysguardd/modules.h
+++ b/ksysguard/ksysguardd/modules.h
@@ -68,7 +68,7 @@
#include "netdev.h"
#endif /* OSTYPE_NetBSD */
-#ifdef OSTYPE_Solaris
+#if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS)
#include "LoadAvg.h"
#include "Memory.h"
#include "NetDev.h"
@@ -146,7 +146,7 @@ struct SensorModul SensorModulList[] = {
{ "NetDev", initNetDev, exitNetDev, updateNetDev, checkNetDev, 0, NULLTIME },
#endif /* OSTYPE_NetBSD */
-#ifdef OSTYPE_Solaris
+#if defined(OSTYPE_Solaris) || defined(OSTYPE_SunOS)
{ "LoadAvg", initLoadAvg, exitLoadAvg, updateLoadAvg, NULLVVFUNC, 0, NULLTIME },
{ "Memory", initMemory, exitMemory, updateMemory, NULLVVFUNC, 0, NULLTIME },
{ "NetDev", initNetDev, exitNetDev, updateNetDev, NULLVVFUNC, 0, NULLTIME },