summaryrefslogtreecommitdiffstats
path: root/vold
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-12 11:44:01 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-12 11:44:01 -0700
commit01fa704538c255f497b4af861a8330eed0262de2 (patch)
tree350ca925fb75383a05cd03f387a4ab79e0e661d4 /vold
parent9862028d79f8cd29dc69d87f3f5dbd393476bafc (diff)
parent47c1d7344ab183f5440843f6b594d1b74a2335b0 (diff)
downloadsystem_core-01fa704538c255f497b4af861a8330eed0262de2.zip
system_core-01fa704538c255f497b4af861a8330eed0262de2.tar.gz
system_core-01fa704538c255f497b4af861a8330eed0262de2.tar.bz2
am 47c1d734: Merge change 4051 into donut
Merge commit '47c1d7344ab183f5440843f6b594d1b74a2335b0' * commit '47c1d7344ab183f5440843f6b594d1b74a2335b0': vold: Give logwrapper the ability to put jobs into the background sched group.
Diffstat (limited to 'vold')
-rwxr-xr-xvold/format.c4
-rw-r--r--vold/logwrapper.c21
-rw-r--r--vold/logwrapper.h2
-rw-r--r--vold/volmgr_ext3.c2
-rw-r--r--vold/volmgr_vfat.c4
5 files changed, 26 insertions, 7 deletions
diff --git a/vold/format.c b/vold/format.c
index 3383949..a1faf7a 100755
--- a/vold/format.c
+++ b/vold/format.c
@@ -44,7 +44,7 @@ int format_partition(blkdev_t *part, char *type)
args[3] = "-O android";
args[4] = devpath;
args[5] = NULL;
- rc = logwrap(5, args);
+ rc = logwrap(5, args, 1);
} else {
char *args[7];
args[0] = MKE2FS_PATH;
@@ -54,7 +54,7 @@ int format_partition(blkdev_t *part, char *type)
args[4] = "-v";
args[5] = devpath;
args[6] = NULL;
- rc = logwrap(6, args);
+ rc = logwrap(6, args, 1);
}
free(devpath);
diff --git a/vold/logwrapper.c b/vold/logwrapper.c
index 2900f2e..46f6ed3 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);
diff --git a/vold/logwrapper.h b/vold/logwrapper.h
index 602e24c..bf28aae 100644
--- a/vold/logwrapper.h
+++ b/vold/logwrapper.h
@@ -19,5 +19,5 @@
#define _LOGWRAPPER_H
#include <stdlib.h>
-int logwrap(int argc, char* argv[]);
+int logwrap(int argc, char* argv[], int background);
#endif
diff --git a/vold/volmgr_ext3.c b/vold/volmgr_ext3.c
index 680be21..fe3b2bb 100644
--- a/vold/volmgr_ext3.c
+++ b/vold/volmgr_ext3.c
@@ -107,7 +107,7 @@ int ext_check(blkdev_t *dev)
args[3] = devpath;
args[4] = NULL;
- int rc = logwrap(4, args);
+ int rc = logwrap(4, args, 1);
if (rc == 0) {
LOG_VOL("filesystem '%s' had no errors", devpath);
diff --git a/vold/volmgr_vfat.c b/vold/volmgr_vfat.c
index 2b0e1fa..7833222 100644
--- a/vold/volmgr_vfat.c
+++ b/vold/volmgr_vfat.c
@@ -62,13 +62,13 @@ int vfat_check(blkdev_t *dev)
args[3] = "-p";
args[4] = blkdev_get_devpath(dev);
args[5] = NULL;
- rc = logwrap(5, args);
+ rc = logwrap(5, args, 1);
free(args[4]);
} else {
args[2] = "-n";
args[3] = blkdev_get_devpath(dev);
args[4] = NULL;
- rc = logwrap(4, args);
+ rc = logwrap(4, args, 1);
free(args[3]);
}