summaryrefslogtreecommitdiffstats
path: root/linux/LinuxProcess.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-28 12:06:13 +0200
committercgzones <cgzones@googlemail.com>2020-10-03 18:51:17 +0200
commit6f387008cba414abdf695ae0eccdc0501bd36a1d (patch)
tree34411ef70b75c67289d89a85f149809ab08d2800 /linux/LinuxProcess.c
parent4b14ab9789eee004daab8594ac00a113c18af060 (diff)
Add security attribute process column
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r--linux/LinuxProcess.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 890c8a0f..2775122c 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -109,6 +109,7 @@ ProcessFieldData Process_fields[] = {
[M_SWAP] = { .name = "M_SWAP", .title = " SWAP ", .description = "Size of the process's swapped pages", .flags = PROCESS_FLAG_LINUX_SMAPS, },
[M_PSSWP] = { .name = "M_PSSWP", .title = " PSSWP ", .description = "shows proportional swap share of this mapping, Unlike \"Swap\", this does not take into account swapped out page of underlying shmem objects.", .flags = PROCESS_FLAG_LINUX_SMAPS, },
[CTXT] = { .name = "CTXT", .title = " CTXT ", .description = "Context switches (incremental sum of voluntary_ctxt_switches and nonvoluntary_ctxt_switches)", .flags = PROCESS_FLAG_LINUX_CTXT, },
+ [SECATTR] = { .name = "SECATTR", .title = " Security Attribute ", .description = "Security attribute of the process (e.g. SELinux or AppArmor)", .flags = PROCESS_FLAG_LINUX_SECATTR, },
[LAST_PROCESSFIELD] = { .name = "*** report bug! ***", .title = NULL, .description = NULL, .flags = 0, },
};
@@ -148,6 +149,7 @@ void Process_delete(Object* cast) {
#ifdef HAVE_CGROUP
free(this->cgroup);
#endif
+ free(this->secattr);
free(this->ttyDevice);
free(this);
}
@@ -289,6 +291,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
attr |= A_BOLD;
xSnprintf(buffer, n, "%5lu ", lp->ctxt_diff);
break;
+ case SECATTR: snprintf(buffer, n, "%-30s ", lp->secattr ? lp->secattr : "?"); break;
default:
Process_writeField(this, str, field);
return;
@@ -374,6 +377,8 @@ long LinuxProcess_compare(const void* v1, const void* v2) {
return LinuxProcess_effectiveIOPriority(p1) - LinuxProcess_effectiveIOPriority(p2);
case CTXT:
return ((long)p2->ctxt_diff - (long)p1->ctxt_diff);
+ case SECATTR:
+ return strcmp(p1->secattr ? p1->secattr : "", p2->secattr ? p2->secattr : "");
default:
return Process_compare(v1, v2);
}

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