Use sched_policy to avoid hard-coded cpuctl path

Change-Id: I8f62287d1b60d8eef72d1dfc64be5c3d56e9f498
gugelfrei
Glenn Kasten 13 years ago
parent 9713ed4639
commit 1b4807b19a

@ -25,6 +25,7 @@
#include "private/android_filesystem_config.h"
#include "cutils/log.h"
#include "cutils/sched_policy.h"
int parent(const char *tag, int parent_read) {
int status;
@ -148,18 +149,10 @@ int logwrap(int argc, const char* argv[], int background)
close(child_ptty);
if (background) {
int fd = open("/dev/cpuctl/bg_non_interactive/tasks", O_WRONLY);
if (fd >= 0) {
char text[64];
sprintf(text, "%d", getpid());
if (write(fd, text, strlen(text)) < 0) {
ALOG(LOG_WARN, "logwrapper",
"Unable to background process (%s)", strerror(errno));
}
close(fd);
} else {
int err = set_sched_policy(getpid(), SP_BACKGROUND);
if (err < 0) {
ALOG(LOG_WARN, "logwrapper",
"Unable to background process (%s)", strerror(errno));
"Unable to background process (%s)", strerror(-err));
}
}

Loading…
Cancel
Save