diff options
author | Benny Baumann <BenBE@geshi.org> | 2020-12-12 12:21:22 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-05-23 09:22:21 +0200 |
commit | fbec3e4005ee88052aae273ce98943f8a3db6382 (patch) | |
tree | fff4317267e72248e380cfce0ac0432be8faccf4 /linux/LinuxProcess.h | |
parent | 07a4657a4744de919854b4c38c688861a0469233 (diff) |
Refactor makeCommandStr
Diffstat (limited to 'linux/LinuxProcess.h')
-rw-r--r-- | linux/LinuxProcess.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index 80a20864..d270c44d 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -31,28 +31,34 @@ in the source distribution for its full text. #define PROCESS_FLAG_LINUX_DELAYACCT 0x00040000 +/* Holds information about regions of the cmdline that should be + * highlighted (e.g. program basename, delimiter, comm). */ +typedef struct LinuxProcessCmdlineHighlight_ +{ + size_t offset; /* first character to highlight */ + size_t length; /* How many characters to highlight, zero if unused */ + int attr; /* The attributes used to highlight */ + int flags; /* Special flags used for selective highlighting, zero for always */ +} LinuxProcessCmdlineHighlight; + /* 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 */ - int sep1; /* first field separator, used if non-zero */ - int sep2; /* second field separator, used if non-zero */ - 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 */ + char *str; /* merged Command string */ + size_t maxLen; /* maximum expected length of Command string */ + size_t highlightCount; /* how many portions of cmdline to highlight */ + LinuxProcessCmdlineHighlight highlights[8]; /* which portions of cmdline to highlight */ + bool separateComm : 1; /* whether comm is a separate field */ + bool unmatchedExe : 1; /* whether exe matched with cmdline */ + bool cmdlineChanged : 1; /* whether cmdline changed */ + bool exeChanged : 1; /* whether exe changed */ + bool commChanged : 1; /* whether comm changed */ + bool prevMergeSet : 1; /* whether showMergedCommand was set */ + bool prevPathSet : 1; /* whether showProgramPath was set */ + bool prevCommSet : 1; /* whether findCommInCmdline was set */ + bool prevCmdlineSet : 1; /* whether stripExeFromCmdline was set */ } LinuxProcessMergedCommand; typedef struct LinuxProcess_ { |