netstar pushed a commit to branch master.

http://git.enlightenment.org/apps/evisum.git/commit/?id=99903001a3dbca537c8a6f55869983ccc184453f

commit 99903001a3dbca537c8a6f55869983ccc184453f
Author: Alastair Poole <nets...@gmail.com>
Date:   Wed Mar 3 14:31:56 2021 +0000

    process: openbsd open files.
---
 src/bin/system/process.c     | 17 +++++++++++++++--
 src/bin/ui/ui_process_view.c |  1 -
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/bin/system/process.c b/src/bin/system/process.c
index e27fe47..8995234 100644
--- a/src/bin/system/process.c
+++ b/src/bin/system/process.c
@@ -483,7 +483,7 @@ _proc_get(Proc_Info *p, struct kinfo_proc *kp)
 }
 
 static void
-_cmd_get(Proc_Info *p, kvm_t *kern, struct kinfo_proc *kp)
+_kvm_get(Proc_Info *p, kvm_t *kern, struct kinfo_proc *kp)
 {
    char **args;
    char name[4096];
@@ -503,6 +503,19 @@ _cmd_get(Proc_Info *p, kvm_t *kern, struct kinfo_proc *kp)
         if (args[0] && ecore_file_exists(args[0]))
           p->command = strdup(ecore_file_file_get(args[0]));
      }
+   struct kinfo_file *kf;
+   int n;
+
+   if ((kf = kvm_getfiles(kern, KERN_FILE_BYPID, -1, sizeof(struct 
kinfo_file), &n)))
+     {
+        for (int i = 0; i < n; i++)
+          {
+             if (kf[i].p_pid == kp->p_pid)
+               {
+                  if (kf[i].fd_fd >= 0) p->numfiles++;
+               }
+          }
+     }
 
    if (!p->command)
      p->command = strdup(kp->p_comm);
@@ -528,7 +541,7 @@ proc_info_by_pid(int pid)
    if (!p) return NULL;
 
    _proc_get(p, kp);
-   _cmd_get(p, kern, kp);
+   _kvm_get(p, kern, kp);
 
    kp = kvm_getprocs(kern, KERN_PROC_SHOW_THREADS, 0, sizeof(*kp), &pid_count);
 
diff --git a/src/bin/ui/ui_process_view.c b/src/bin/ui/ui_process_view.c
index 6d5ff9c..8d6f4cb 100644
--- a/src/bin/ui/ui_process_view.c
+++ b/src/bin/ui/ui_process_view.c
@@ -1227,7 +1227,6 @@ static void
 _btn_icon_state_set(Evas_Object *btn, Eina_Bool reverse)
 {
    Evas_Object *ic = elm_icon_add(btn);
-
    if (reverse)
      elm_icon_standard_set(ic, evisum_icon_path_get("go-down"));
    else

-- 


Reply via email to