Merge "property_service: make /dev/__properties__ readable"
diff --git a/fastboot/engine.c b/fastboot/engine.c
index 7a55260..8d46991 100644
--- a/fastboot/engine.c
+++ b/fastboot/engine.c
@@ -29,6 +29,7 @@
#include "fastboot.h"
#include "make_ext4fs.h"
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -45,8 +46,6 @@
#include <sys/mman.h>
#endif
-extern struct fs_info info;
-
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
double now()
@@ -302,10 +301,7 @@
#else
fd = fileno(tmpfile());
#endif
- /* reset ext4fs info so we can be called multiple times */
- reset_ext4fs_info();
- info.len = image->partition_size;
- make_ext4fs_internal(fd, NULL, NULL, NULL, 0, 1, 0, 0, 0, NULL);
+ make_ext4fs_sparse_fd(fd, image->partition_size, NULL, NULL);
fstat(fd, &st);
image->image_size = st.st_size;
diff --git a/toolbox/renice.c b/toolbox/renice.c
index 978b329..9dfeb51 100644
--- a/toolbox/renice.c
+++ b/toolbox/renice.c
@@ -35,11 +35,12 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <sched.h>
+#include <getopt.h>
static void
usage(const char *s)
{
- fprintf(stderr, "USAGE: %s [[-r] priority pids ...] [-g pid]\n", s);
+ fprintf(stderr, "USAGE: %s [[-r] [-t TYPE] priority pids ...] [-g pid]\n", s);
exit(EXIT_FAILURE);
}
@@ -74,32 +75,49 @@
sched_get_priority_min(sched), sched_get_priority_max(sched));
}
+int get_sched(char *str)
+{
+ if (strcasecmp(str, "RR") == 0)
+ return SCHED_RR;
+ else if (strcasecmp(str, "FIFO") == 0)
+ return SCHED_FIFO;
+ else if (strcasecmp(str, "NORMAL") == 0)
+ return SCHED_OTHER;
+ else if (strcasecmp(str, "OTHER") == 0)
+ return SCHED_OTHER;
+ return SCHED_RR;
+}
+
int renice_main(int argc, char *argv[])
{
int prio;
int realtime = 0;
+ int opt;
+ int sched = SCHED_RR;
char *cmd = argv[0];
- // consume command name
- argc--;
- argv++;
-
- if (argc < 1)
- usage(cmd);
-
- if(strcmp("-r", argv[0]) == 0) {
- // do realtime priority adjustment
- realtime = 1;
- argc--;
- argv++;
- }
-
- if(strcmp("-g", argv[0]) == 0) {
- if (argc < 2)
+ do {
+ opt = getopt(argc, argv, "rt:g:");
+ if (opt == -1)
+ break;
+ switch (opt) {
+ case 'r':
+ // do realtime priority adjustment
+ realtime = 1;
+ break;
+ case 't':
+ sched = get_sched(optarg);
+ break;
+ case 'g':
+ print_prio(atoi(optarg));
+ return 0;
+ default:
usage(cmd);
- print_prio(atoi(argv[1]));
- return 0;
- }
+ }
+ } while (1);
+
+ argc -= optind;
+ argv += optind;
if (argc < 1)
usage(cmd);
@@ -122,7 +140,7 @@
struct sched_param sp = { .sched_priority = prio };
int ret;
- ret = sched_setscheduler(pid, SCHED_RR, &sp);
+ ret = sched_setscheduler(pid, sched, &sp);
if (ret) {
perror("sched_set_scheduler");
exit(EXIT_FAILURE);
@@ -137,8 +155,6 @@
}
}
}
-
+
return 0;
}
-
-