processes: Allow toggle of kernel threads.

evisum-0.5
Alastair Poole 3 years ago
parent 8ac69d606e
commit 305ba225e4
  1. 6
      NEWS
  2. 5
      README
  3. 23
      src/bin/system/process.c
  4. 7
      src/bin/system/process.h
  5. 3
      src/bin/ui/ui.c

@ -1,3 +1,9 @@
============
Evisum 0.5.3
============
* Option to show kernel threads.
============
Evisum 0.5.2
============

@ -29,3 +29,8 @@ Patches with bug fixes are more than welcome. If you do wish to
add a substantial querying feature PLEASE ensure that it works reliaibly
on OpenBSD, Linux and FreeBSD (ideally macOS also). UI changes
should be platform independent.
NOTES:
Ctrl + k or Ctrl + K to show kernel threads.
Ctrl + e or Ctrl + E to show evisum in the process list.

@ -44,6 +44,20 @@
#include "macros.h"
static Eina_Bool _show_kthreads = EINA_FALSE;
void
proc_info_kthreads_show_set(Eina_Bool enabled)
{
_show_kthreads = enabled;
}
Eina_Bool
proc_info_kthreads_show_get(void)
{
return _show_kthreads;
}
static const char *
_process_state_name(char state)
{
@ -305,7 +319,8 @@ _process_list_linux_get(void)
if (!_stat(eina_slstr_printf("/proc/%d/stat", pid), &st))
continue;
if (st.flags & PF_KTHREAD) continue;
if (st.flags & PF_KTHREAD && !proc_info_kthreads_show_get())
continue;
Proc_Info *p = calloc(1, sizeof(Proc_Info));
if (!p) return NULL;
@ -895,7 +910,7 @@ _process_list_freebsd_fallback_get(void)
if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1)
continue;
if (kp.ki_flag & P_KPROC)
if (kp.ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue;
Proc_Info *p = _proc_thread_info(&kp, EINA_FALSE);
@ -928,7 +943,7 @@ _process_list_freebsd_get(void)
for (int i = 0; i < pid_count; i++)
{
if (kps[i].ki_flag & P_KPROC)
if (kps[i].ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue;
kp = &kps[i];
@ -988,7 +1003,7 @@ proc_info_by_pid(int pid)
for (int i = 0; i < pid_count; i++)
{
if (kps[i].ki_flag & P_KPROC)
if (kps[i].ki_flag & P_KPROC && !proc_info_kthreads_show_get())
continue;
if (kps[i].ki_pid != pid)
continue;

@ -76,6 +76,13 @@ proc_info_by_pid(int pid);
void
proc_info_free(Proc_Info *proc);
void
proc_info_kthreads_show_set(Eina_Bool enabled);
Eina_Bool
proc_info_kthreads_show_get(void);
/**
* @}
*/

@ -1381,6 +1381,9 @@ _evisum_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
if (ev->keyname[0] == 'e' || ev->keyname[0] == 'E')
ui->show_self = !ui->show_self;
if (ev->keyname[0] == 'k' || ev->keyname[0] == 'K')
proc_info_kthreads_show_set(!proc_info_kthreads_show_get());
_config_save(ui);
}

Loading…
Cancel
Save