diff options
| author | San Mehat <san@google.com> | 2009-06-12 07:39:52 -0700 |
|---|---|---|
| committer | San Mehat <san@google.com> | 2009-06-12 07:39:52 -0700 |
| commit | 825c27d239e5bcf3c8b2cb99c320f0b1836ef338 (patch) | |
| tree | 7ff4986b42e2daf3dac678cceb13a0a788d9cd41 /vold/logwrapper.c | |
| parent | 2cf6cff71f36b76e816a7a90c66f4b04c71e8278 (diff) | |
| download | system_core-825c27d239e5bcf3c8b2cb99c320f0b1836ef338.tar.gz system_core-825c27d239e5bcf3c8b2cb99c320f0b1836ef338.tar.bz2 system_core-825c27d239e5bcf3c8b2cb99c320f0b1836ef338.zip | |
vold: Give logwrapper the ability to put jobs into the background sched group.
Also set disk check/format execution to background.
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'vold/logwrapper.c')
| -rw-r--r-- | vold/logwrapper.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/vold/logwrapper.c b/vold/logwrapper.c index 2900f2e2..46f6ed32 100644 --- a/vold/logwrapper.c +++ b/vold/logwrapper.c @@ -100,7 +100,7 @@ void child(int argc, char* argv[]) { } } -int logwrap(int argc, char* argv[], pid_t *childPid) +int logwrap(int argc, char* argv[], pid_t *childPid, int background) { pid_t pid; @@ -138,6 +138,25 @@ int logwrap(int argc, char* argv[], pid_t *childPid) dup2(child_ptty, 2); 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) { + LOG(LOG_WARN, "logwrapper", + "Unable to background process (%s)", strerror(errno)); + close(fd); + } + close(fd); + } else { + LOG(LOG_WARN, "logwrapper", + "Unable to background process (%s)", strerror(errno)); + } + } + child(argc, argv); } else { return parent(argv[0], parent_ptty); |
