diff options
author | Nathan Scott <nathans@redhat.com> | 2023-08-22 16:11:05 +1000 |
---|---|---|
committer | Nathan Scott <nathans@redhat.com> | 2023-08-30 13:11:57 +1000 |
commit | 0f751e991d399769fb8d7800f7c4bccec2ca7f60 (patch) | |
tree | 34cd7838f7ebf51049816f9acb6a63cea175af06 /OpenFilesScreen.c | |
parent | 68f4f10f012d11bd57bb725fe4113b2af937fc1d (diff) |
Introduce Row and Table classes for screens beyond top-processes
This commit refactors the Process and ProcessList structures such
they each have a new parent - Row and Table, respectively. These
new classes handle screen updates relating to anything that could
be represented in tabular format, e.g. cgroups, filesystems, etc,
without us having to reimplement the display logic repeatedly for
each new entity.
Diffstat (limited to 'OpenFilesScreen.c')
-rw-r--r-- | OpenFilesScreen.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c index 2e782b98..3077490d 100644 --- a/OpenFilesScreen.c +++ b/OpenFilesScreen.c @@ -72,12 +72,12 @@ static const char* getDataForType(const OpenFiles_Data* data, char type) { } OpenFilesScreen* OpenFilesScreen_new(const Process* process) { - OpenFilesScreen* this = xMalloc(sizeof(OpenFilesScreen)); + OpenFilesScreen* this = xCalloc(1, sizeof(OpenFilesScreen)); Object_setClass(this, Class(OpenFilesScreen)); if (Process_isThread(process)) { - this->pid = process->tgid; + this->pid = Process_getThreadGroup(process); } else { - this->pid = process->pid; + this->pid = Process_getPid(process); } return (OpenFilesScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 2, " FD TYPE MODE DEVICE SIZE OFFSET NODE NAME"); } |