From 09fe94da18d33d2c4e1fe415e8346fa99b9944b4 Mon Sep 17 00:00:00 2001 From: Narendran Gopalakrishnan Date: Sat, 17 Oct 2020 16:24:45 +0530 Subject: Improving Command display/sort --- linux/LinuxProcess.h | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'linux/LinuxProcess.h') diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 6116808e..88da78f1 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -95,11 +95,42 @@ typedef enum LinuxProcessFields { M_PSSWP = 121, CTXT = 122, SECATTR = 123, - LAST_PROCESSFIELD = 124, + PROC_COMM = 124, + PROC_EXE = 125, + LAST_PROCESSFIELD = 126, } LinuxProcessField; +/* LinuxProcessMergedCommand is populated by LinuxProcess_makeCommandStr: It + * contains the merged Command string, and the information needed by + * LinuxProcess_writeCommand to color the string. str will be NULL for kernel + * threads and zombies */ +typedef struct LinuxProcessMergedCommand_ { + char *str; /* merged Command string */ + int maxLen; /* maximum expected length of Command string */ + int baseStart; /* basename's start offset */ + int baseEnd; /* basename's end offset */ + int commStart; /* comm's start offset */ + int commEnd; /* comm's end offset */ + bool separateComm; /* whether comm is a separate field */ + bool unmatchedExe; /* whether exe matched with cmdline */ + bool cmdlineChanged; /* whether cmdline changed */ + bool exeChanged; /* whether exe changed */ + bool commChanged; /* whether comm changed */ + bool prevMergeSet; /* whether showMergedCommand was set */ + bool prevPathSet; /* whether showProgramPath was set */ + bool prevCommSet; /* whether findCommInCmdline was set */ + bool prevCmdlineSet; /* whether findCommInCmdline was set */ +} LinuxProcessMergedCommand; + typedef struct LinuxProcess_ { Process super; + char *procComm; + char *procExe; + int procExeLen; + int procExeBasenameOffset; + int procCmdlineBasenameOffset; + int procCmdlineBasenameEnd; + LinuxProcessMergedCommand mergedCommand; bool isKernelThread; IOPriority ioPriority; unsigned long int cminflt; @@ -177,6 +208,10 @@ IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this); bool LinuxProcess_setIOPriority(Process* this, Arg ioprio); +/* This function constructs the string that is displayed by + * LinuxProcess_writeCommand and also returned by LinuxProcess_getCommandStr */ +void LinuxProcess_makeCommandStr(Process *this); + bool Process_isThread(const Process* this); #endif -- cgit v1.2.3