netstar pushed a commit to branch master. http://git.enlightenment.org/apps/evisum.git/commit/?id=1de886e55f357cce2e53a82349d7a38ca9c7c1cf
commit 1de886e55f357cce2e53a82349d7a38ca9c7c1cf Author: Alastair Poole <nets...@gmail.com> Date: Sat Feb 27 19:19:37 2021 +0000 openfiles: keep the fds around. for now. --- src/bin/system/process.c | 9 ++++++--- src/bin/ui/ui_process_view.c | 39 ++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/bin/system/process.c b/src/bin/system/process.c index 6b3ec36..1182432 100644 --- a/src/bin/system/process.c +++ b/src/bin/system/process.c @@ -911,7 +911,6 @@ _kvm_get(Proc_Info *p, struct kinfo_proc *kp) struct filedesc filed; struct fdescenttbl *fdt; unsigned int n; - char buf[64]; if (!kvm_read(kern, (unsigned long)kp->ki_fd, &filed, sizeof(filed))) goto kvmerror; @@ -928,8 +927,12 @@ _kvm_get(Proc_Info *p, struct kinfo_proc *kp) for (int i = 0; i < n; i++) { if (!fdt->fdt_ofiles[i].fde_file) continue; - snprintf(buf, sizeof(buf), "%i", i); - p->fds = eina_list_append(p->fds, strdup(buf)); + int *fd = malloc(sizeof(int)); + if (fd) + { + *fd = i; + p->fds = eina_list_append(p->fds, fd); + } p->numfiles++; } } diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c index 520ffa0..ada8f12 100644 --- a/src/bin/ui/ui_process_view.c +++ b/src/bin/ui/ui_process_view.c @@ -839,8 +839,6 @@ static void _general_view_update(Ui_Data *pd, Proc_Info *proc) { struct passwd *pwd_entry; - Eina_List *l; - int *num; if (!strcmp(proc->state, "stop")) { @@ -865,29 +863,31 @@ _general_view_update(Ui_Data *pd, Proc_Info *proc) else elm_object_text_set(pd->general.entry_cmd_args, ""); - elm_object_text_set(pd->general.entry_pid, eina_slstr_printf("%d", proc->pid)); - elm_object_text_set(pd->general.entry_uid, eina_slstr_printf("%d", proc->uid)); + elm_object_text_set(pd->general.entry_pid, + eina_slstr_printf("%d", proc->pid)); + elm_object_text_set(pd->general.entry_uid, + eina_slstr_printf("%d", proc->uid)); elm_object_text_set(pd->general.entry_cpu, eina_slstr_printf("%d", proc->cpu_id)); - elm_object_text_set(pd->general.entry_ppid, eina_slstr_printf("%d", proc->ppid)); + elm_object_text_set(pd->general.entry_ppid, + eina_slstr_printf("%d", proc->ppid)); elm_object_text_set(pd->general.entry_threads, eina_slstr_printf("%d", proc->numthreads)); - Eina_Strbuf *b = eina_strbuf_new(); - EINA_LIST_FOREACH(proc->fds, l, num) - eina_strbuf_append_printf(b, "%i ", *num); - if (eina_strbuf_length_get(b)) - elm_object_text_set(pd->general.entry_files, eina_strbuf_string_get(b)); - eina_strbuf_free(b); - - elm_object_text_set(pd->general.entry_virt, evisum_size_format(proc->mem_virt)); - elm_object_text_set(pd->general.entry_rss, evisum_size_format(proc->mem_rss)); + elm_object_text_set(pd->general.entry_files, + eina_slstr_printf("%d", proc->numfiles)); + elm_object_text_set(pd->general.entry_virt, + evisum_size_format(proc->mem_virt)); + elm_object_text_set(pd->general.entry_rss, + evisum_size_format(proc->mem_rss)); #if !defined(__linux__) - elm_object_text_set(pd->general.entry_shared, "N/A"); + elm_object_text_set(pd->general.entry_shared, + "N/A"); #else elm_object_text_set(pd->general.entry_shared, evisum_size_format(proc->mem_shared)); #endif - elm_object_text_set(pd->general.entry_size, evisum_size_format(proc->mem_size)); + elm_object_text_set(pd->general.entry_size, + evisum_size_format(proc->mem_size)); char *t = _run_time_string(proc->run_time); if (t) { @@ -900,11 +900,12 @@ _general_view_update(Ui_Data *pd, Proc_Info *proc) elm_object_text_set(pd->general.entry_started, t); free(t); } - elm_object_text_set(pd->general.entry_nice, eina_slstr_printf("%d", proc->nice)); + elm_object_text_set(pd->general.entry_nice, + eina_slstr_printf("%d", proc->nice)); elm_object_text_set(pd->general.entry_pri, eina_slstr_printf("%d", proc->priority)); - elm_object_text_set(pd->general.entry_state, proc->state); - + elm_object_text_set(pd->general.entry_state, + proc->state); elm_object_text_set(pd->general.entry_cpu_usage, eina_slstr_printf("%.0f%%", proc->cpu_usage)); } --