From f7df2f540466121dff20162c2911c8ea9bfe8038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stelmach?= Date: Fri, 4 May 2018 15:23:34 +0200 Subject: WIP: add ProcExclude as a method Change-Id: I1fa8be9305d50d8c27924e6e94785cb888731b74 --- src/proc-stat/proc-monitor.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/proc-stat/proc-monitor.c b/src/proc-stat/proc-monitor.c index 0236bc57..3c4573e7 100755 --- a/src/proc-stat/proc-monitor.c +++ b/src/proc-stat/proc-monitor.c @@ -413,7 +413,7 @@ static void dbus_get_cpu_lists(GDBusMethodInvocation *invocation, GVariant *para static void proc_dbus_exclude_signal_handler(GVariant *params) { - char *str = NULL; + const char *str = NULL; pid_t pid = 0; struct proc_exclude pe; int len; @@ -452,6 +452,24 @@ static void proc_dbus_exclude_signal_handler(GVariant *params) return; } +static void proc_dbus_exclude_method_handler(GDBusMethodInvocation *invocation, GVariant *params) +{ + const char *str = NULL; + pid_t pid = 0; + + g_variant_get(params, "(&si)", &str, &pid); + if (!str || pid == 0) { + _E("invalid parameters"); + g_dbus_method_invocation_return_error(invocation, + G_DBUS_ERROR, + G_DBUS_ERROR_INVALID_ARGS, + "invalid arguments"); + return; + } + proc_dbus_exclude_signal_handler(params); + D_BUS_REPLY_NULL(invocation); +} + static void proc_dbus_exclude_appid_signal_handler(GVariant *params) { char *str = NULL; @@ -1008,6 +1026,10 @@ static const char dbus_methods_xml[] = " " " " " " +" " +" " +" " +" " " " /* Following functions are defined in proc-usage-stats.c */ " " @@ -1035,6 +1057,7 @@ static struct d_bus_method dbus_methods[] = { /* Following functions are defined in proc-usage-stats.c */ { "ProcMemoryUsage", dbus_proc_memory_usage }, { "ProcCpuUsage", dbus_proc_cpu_usage }, + { "ProcExclude", proc_dbus_exclude_method_handler}, /* Add methods here */ }; -- cgit v1.2.3