diff options
author | Benny Baumann <BenBE@geshi.org> | 2021-04-24 12:06:49 +0200 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2021-05-23 09:22:21 +0200 |
commit | c0d02024407411f75a4d7d5b63f26b74c727027b (patch) | |
tree | 1252f8c71d108af939daa731bccc71e1bf5125d2 /Process.c | |
parent | 7224d0e0831ee53d5028915f87dffd51ffa0d6fa (diff) |
Move LinuxProcess_getCommandStr to Process_getCommandStr
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -521,8 +521,15 @@ void Process_done(Process* this) { free(this->tty_name); } -static const char* Process_getCommandStr(const Process* p) { - return p->cmdline ? p->cmdline : ""; +/* This function returns the string displayed in Command column, so that sorting + * happens on what is displayed - whether comm, full path, basename, etc.. So + * this follows Process_writeField(COMM) and Process_writeCommand */ +const char *Process_getCommandStr(const Process *this) { + if ((Process_isUserlandThread(this) && this->settings->showThreadNames) || !this->mergedCommand.str) { + return this->cmdline; + } + + return this->mergedCommand.str; } const ProcessClass Process_class = { |