summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcess.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-09-30 23:46:52 +0200
committercgzones <cgzones@googlemail.com>2020-10-07 13:14:39 +0200
commit2970cae5436c1e38a98661da3d59c3371051d606 (patch)
treea457e47c2b3cadc1a3d6f9e74334ff37b8126bd4 /linux/LinuxProcess.c
parentba282cfe193719f4fe030ebdcd80519ae19ffca2 (diff)
Handle parsing envID & VPid from process status file
Fixes #55 Fixes #192
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r--linux/LinuxProcess.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 373c9ad8..5e661e03 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -77,8 +77,8 @@ ProcessFieldData Process_fields[] = {
[NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, },
[TGID] = { .name = "TGID", .title = " TGID ", .description = "Thread group ID (i.e. process ID)", .flags = 0, },
#ifdef HAVE_OPENVZ
- [CTID] = { .name = "CTID", .title = " CTID ", .description = "OpenVZ container ID (a.k.a. virtual environment ID)", .flags = PROCESS_FLAG_LINUX_OPENVZ, },
- [VPID] = { .name = "VPID", .title = " VPID ", .description = "OpenVZ process ID", .flags = PROCESS_FLAG_LINUX_OPENVZ, },
+ [CTID] = { .name = "CTID", .title = " CTID ", .description = "OpenVZ container ID (a.k.a. virtual environment ID)", .flags = PROCESS_FLAG_LINUX_OPENVZ, },
+ [VPID] = { .name = "VPID", .title = " VPID ", .description = "OpenVZ process ID", .flags = PROCESS_FLAG_LINUX_OPENVZ, },
#endif
#ifdef HAVE_VSERVER
[VXID] = { .name = "VXID", .title = " VXID ", .description = "VServer process ID", .flags = PROCESS_FLAG_LINUX_VSERVER, },
@@ -149,6 +149,9 @@ void Process_delete(Object* cast) {
#ifdef HAVE_CGROUP
free(this->cgroup);
#endif
+#ifdef HAVE_OPENVZ
+ free(this->ctid);
+#endif
free(this->secattr);
free(this->ttyDevice);
free(this);
@@ -253,7 +256,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
}
#endif
#ifdef HAVE_OPENVZ
- case CTID: xSnprintf(buffer, n, "%7u ", lp->ctid); break;
+ case CTID: xSnprintf(buffer, n, "%-8s ", lp->ctid ? lp->ctid : ""); break;
case VPID: xSnprintf(buffer, n, Process_pidFormat, lp->vpid); break;
#endif
#ifdef HAVE_VSERVER
@@ -351,7 +354,7 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
#endif
#ifdef HAVE_OPENVZ
case CTID:
- return (p2->ctid - p1->ctid);
+ return strcmp(p1->ctid ? p1->ctid : "", p2->ctid ? p2->ctid : "");
case VPID:
return (p2->vpid - p1->vpid);
#endif

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