diff options
author | Łukasz Stelmach <l.stelmach@samsung.com> | 2018-05-04 15:23:34 +0200 |
---|---|---|
committer | Łukasz Stelmach <l.stelmach@samsung.com> | 2018-05-04 16:02:59 +0200 |
commit | f7df2f540466121dff20162c2911c8ea9bfe8038 (patch) | |
tree | 2c09b269a4cbb9fc3c29bc3b39d4a3563151d717 | |
parent | 73dab95d838fffa0dfee2ae78e961759cc83b6d8 (diff) | |
download | resourced-sandbox/lstelmach/proc-exclude-method.tar.gz resourced-sandbox/lstelmach/proc-exclude-method.tar.bz2 resourced-sandbox/lstelmach/proc-exclude-method.zip |
WIP: add ProcExclude as a methodsandbox/lstelmach/proc-exclude-method
Change-Id: I1fa8be9305d50d8c27924e6e94785cb888731b74
-rwxr-xr-x | src/proc-stat/proc-monitor.c | 25 |
1 files changed, 24 insertions, 1 deletions
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[] = " </method>" " <method name='PrePoweroff'>" " <arg type='i' name='MinusOne' direction='out'/>" +" </method name='ProcExclude'>" +" <arg type='s' name='Action' direction='in'>" +" <arg type='u' name='PID' direction='in'>" +" <method>" " </method>" /* Following functions are defined in proc-usage-stats.c */ " <method name='ProcMemoryUsage'>" @@ -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 */ }; |