#include <sys/types.h>
#include <unistd.h>
#include <sys/mount.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include "proc-main.h"
#include "proc-monitor.h"
return;
}
+static void proc_dbus_set_priority_signal_handler(GVariant *params)
+{
+ char *str = NULL;
+ pid_t pid = -1;
+
+ do_expr_unless_g_variant_get_typechecked(return, params, "(&si)", &str, &pid);
+ if (!str || pid < 0) {
+ _D("there is no message");
+ return;
+ }
+
+ _D("pid (%d) requested to change priority (%s)", pid, str);
+ if (!strncmp(str, "high", sizeof "high"))
+ setpriority(PRIO_PGRP, pid, -5);
+ else if (!strncmp(str, "default", sizeof "default"))
+ setpriority(PRIO_PGRP, pid, 0);
+ else if (!strncmp(str, "low", sizeof "low"))
+ setpriority(PRIO_PGRP, pid, 1);
+ else
+ _W("Warning: invalid set priority request (%s)!", str);
+}
static void proc_dbus_prelaunch_signal_handler(GVariant *params)
{
SIGNAL_PROC_SYSTEMSERVICE, proc_dbus_systemservice_handler, NULL},
{RESOURCED_PATH_PROCESS, RESOURCED_INTERFACE_PROCESS,
SIGNAL_PROC_EXCLUDEAPPID, proc_dbus_exclude_appid_signal_handler, NULL},
+ {RESOURCED_PATH_PROCESS, RESOURCED_INTERFACE_PROCESS,
+ SIGNAL_PROC_SET_PRIORITY, proc_dbus_set_priority_signal_handler, NULL},
/* DEVICED DBUS */
{DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,