From 702549ed9a8bfd89feb87461c990f478b3da24e6 Mon Sep 17 00:00:00 2001 From: Alastair Poole Date: Thu, 16 Apr 2020 22:03:25 +0100 Subject: [PATCH] rename type. --- src/bin/process.c | 28 ++++++++++++++-------------- src/bin/process.h | 6 +++--- src/bin/ui.c | 42 +++++++++++++++++++++--------------------- src/bin/ui.h | 2 +- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/bin/process.c b/src/bin/process.c index 86742a5..1416e39 100644 --- a/src/bin/process.c +++ b/src/bin/process.c @@ -220,7 +220,7 @@ _process_list_linux_get(void) char *end = strchr(program_name, ' '); if (end) *end = '\0'; - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = pid; @@ -244,7 +244,7 @@ _process_list_linux_get(void) return list; } -Proc_Stats * +Proc_Info * proc_info_by_pid(int pid) { FILE *f; @@ -304,7 +304,7 @@ proc_info_by_pid(int pid) } } - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = pid; @@ -326,7 +326,7 @@ proc_info_by_pid(int pid) #if defined(__OpenBSD__) -Proc_Stats * +Proc_Info * proc_info_by_pid(int pid) { struct kinfo_proc *kp; @@ -343,7 +343,7 @@ proc_info_by_pid(int pid) if (count == 0) return NULL; pagesize = getpagesize(); - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = kp->p_pid; @@ -375,7 +375,7 @@ static Eina_List * _process_list_openbsd_get(void) { struct kinfo_proc *kp; - Proc_Stats *p; + Proc_Info *p; char errbuf[4096]; kvm_t *kern; int pid_count, pagesize; @@ -391,7 +391,7 @@ _process_list_openbsd_get(void) for (int i = 0; i < pid_count; i++) { - p = calloc(1, sizeof(Proc_Stats)); + p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = kp[i].p_pid; @@ -438,7 +438,7 @@ _process_list_macos_get(void) int size = proc_pidinfo(i, PROC_PIDTASKALLINFO, 0, &taskinfo, sizeof(taskinfo)); if (size != sizeof(taskinfo)) continue; - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = i; @@ -460,7 +460,7 @@ _process_list_macos_get(void) return list; } -Proc_Stats * +Proc_Info * proc_info_by_pid(int pid) { struct kinfo_proc kp; @@ -476,7 +476,7 @@ proc_info_by_pid(int pid) if (size != sizeof(workqueue)) return NULL; - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = pid; @@ -529,7 +529,7 @@ _process_list_freebsd_fallback_get(void) if (kp.ki_flag & P_KPROC) continue; - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = kp.ki_pid; @@ -577,7 +577,7 @@ _process_list_freebsd_get(void) if (kp[i].ki_flag & P_KPROC) continue; - Proc_Stats *p = proc_info_by_pid(kp[i].ki_pid); + Proc_Info *p = proc_info_by_pid(kp[i].ki_pid); if (!p) continue; list = eina_list_append(list, p); @@ -586,7 +586,7 @@ _process_list_freebsd_get(void) return list; } -Proc_Stats * +Proc_Info * proc_info_by_pid(int pid) { struct rusage *usage; @@ -607,7 +607,7 @@ proc_info_by_pid(int pid) if (sysctl(mib, 4, &kp, &len, NULL, 0) == -1) return NULL; - Proc_Stats *p = calloc(1, sizeof(Proc_Stats)); + Proc_Info *p = calloc(1, sizeof(Proc_Info)); if (!p) return NULL; p->pid = kp.ki_pid; diff --git a/src/bin/process.h b/src/bin/process.h index 7a1632c..7407ce2 100644 --- a/src/bin/process.h +++ b/src/bin/process.h @@ -26,7 +26,7 @@ #define CMD_NAME_MAX 1024 -typedef struct _Proc_Stats +typedef struct _Proc_Info { pid_t pid; uid_t uid; @@ -42,7 +42,7 @@ typedef struct _Proc_Stats // Not used yet in UI. long cpu_time; -} Proc_Stats; +} Proc_Info; /** * Query a full list of running processes and return a list. @@ -59,7 +59,7 @@ Eina_List * * * @return A proc_t pointer containing the process information. */ -Proc_Stats * +Proc_Info * proc_info_by_pid(int pid); /** diff --git a/src/bin/ui.c b/src/bin/ui.c index 21ca8a0..b8cfbc6 100644 --- a/src/bin/ui.c +++ b/src/bin/ui.c @@ -542,7 +542,7 @@ out: static int _sort_by_pid(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -552,7 +552,7 @@ _sort_by_pid(const void *p1, const void *p2) static int _sort_by_uid(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -562,7 +562,7 @@ _sort_by_uid(const void *p1, const void *p2) static int _sort_by_nice(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -572,7 +572,7 @@ _sort_by_nice(const void *p1, const void *p2) static int _sort_by_pri(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -582,7 +582,7 @@ _sort_by_pri(const void *p1, const void *p2) static int _sort_by_cpu(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -592,7 +592,7 @@ _sort_by_cpu(const void *p1, const void *p2) static int _sort_by_threads(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -602,7 +602,7 @@ _sort_by_threads(const void *p1, const void *p2) static int _sort_by_size(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; int64_t size1, size2; inf1 = p1; inf2 = p2; @@ -621,7 +621,7 @@ _sort_by_size(const void *p1, const void *p2) static int _sort_by_rss(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; int64_t size1, size2; inf1 = p1; inf2 = p2; @@ -640,7 +640,7 @@ _sort_by_rss(const void *p1, const void *p2) static int _sort_by_cpu_usage(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; double one, two; inf1 = p1; inf2 = p2; @@ -659,7 +659,7 @@ _sort_by_cpu_usage(const void *p1, const void *p2) static int _sort_by_cmd(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -669,7 +669,7 @@ _sort_by_cmd(const void *p1, const void *p2) static int _sort_by_state(const void *p1, const void *p2) { - const Proc_Stats *inf1, *inf2; + const Proc_Info *inf1, *inf2; inf1 = p1; inf2 = p2; @@ -753,7 +753,7 @@ _proc_pid_cpu_times_free(Ui *ui) } static void -_proc_pid_cpu_time_save(Ui *ui, Proc_Stats *proc) +_proc_pid_cpu_time_save(Ui *ui, Proc_Info *proc) { Eina_List *l; pid_cpu_time_t *tmp; @@ -777,7 +777,7 @@ _proc_pid_cpu_time_save(Ui *ui, Proc_Stats *proc) } static void -_proc_pid_cpu_usage_get(Ui *ui, Proc_Stats *proc) +_proc_pid_cpu_usage_get(Ui *ui, Proc_Info *proc) { Eina_List *l; pid_cpu_time_t *tmp; @@ -812,7 +812,7 @@ _column_expand_init(Ui *ui) } static void -_column_expand_calculate(Ui *ui, Proc_Stats *proc) +_column_expand_calculate(Ui *ui, Proc_Info *proc) { const char *text; @@ -882,7 +882,7 @@ _column_expand(Evas_Object *parent, const char *text) static void _item_del(void *data, Evas_Object *obj EINA_UNUSED) { - Proc_Stats *proc = data; + Proc_Info *proc = data; free(proc); } @@ -890,7 +890,7 @@ static Evas_Object * _content_get(void *data, Evas_Object *obj, const char *source) { Ui *ui; - Proc_Stats *proc; + Proc_Info *proc; Evas_Object *box, *label; Evas_Object *table, *rect; Evas_Coord w, h; @@ -1040,7 +1040,7 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED, void *ms { Ui *ui; Eina_List *list, *l, *l_next; - Proc_Stats *proc; + Proc_Info *proc; Elm_Object_Item *it; ui = data; @@ -1080,7 +1080,7 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED, void *ms list = _list = _list_sort(ui, list); EINA_LIST_FREE(list, proc) { - Proc_Stats *prev = elm_object_item_data_get(it); + Proc_Info *prev = elm_object_item_data_get(it); if (prev) { free(prev); } elm_object_item_data_set(it, proc); elm_genlist_item_update(it); @@ -1292,7 +1292,7 @@ _list_item_del_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN static void _process_panel_pids_update(Ui *ui) { - Proc_Stats *proc; + Proc_Info *proc; Elm_Widget_Item *item; Eina_List *list; pid_t *pid; @@ -1328,7 +1328,7 @@ _process_panel_update(void *data) const Eina_List *l, *list; Elm_Widget_Item *it; struct passwd *pwd_entry; - Proc_Stats *proc; + Proc_Info *proc; double cpu_usage = 0.0; ui = data; @@ -1465,7 +1465,7 @@ _item_pid_clicked_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUS Ui *ui; Evas_Event_Mouse_Up *ev; Elm_Object_Item *it; - Proc_Stats *proc; + Proc_Info *proc; ui = data; diff --git a/src/bin/ui.h b/src/bin/ui.h index 92354b3..ab61bc8 100644 --- a/src/bin/ui.h +++ b/src/bin/ui.h @@ -25,7 +25,7 @@ typedef enum PROCESS_INFO_FIELD_THREADS, // Not used yet in UI. PROCESS_INFO_FIELD_CPU_TIME, -} Proc_Stats_Field; +} Proc_Info_Field; #define PROCESS_INFO_FIELDS 7