diff options
author | Elliott Hughes <enh@google.com> | 2014-01-16 10:53:11 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-01-16 12:54:18 -0800 |
commit | ccecf1425412beb2bc3bb38d470293fdc244d6f1 (patch) | |
tree | 9fd922197bc88bed453efa0738f3dfb5d6db4c3c /toolbox | |
parent | e847f429f43ae56aaa406697ca603c8469e2100b (diff) | |
download | system_core-ccecf1425412beb2bc3bb38d470293fdc244d6f1.zip system_core-ccecf1425412beb2bc3bb38d470293fdc244d6f1.tar.gz system_core-ccecf1425412beb2bc3bb38d470293fdc244d6f1.tar.bz2 |
system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.
Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
Diffstat (limited to 'toolbox')
-rw-r--r-- | toolbox/Android.mk | 2 | ||||
-rw-r--r-- | toolbox/dd.c | 3 | ||||
-rw-r--r-- | toolbox/getevent.c | 2 | ||||
-rw-r--r-- | toolbox/insmod.c | 4 | ||||
-rw-r--r-- | toolbox/ls.c | 4 | ||||
-rw-r--r-- | toolbox/nandread.c | 2 | ||||
-rw-r--r-- | toolbox/newfs_msdos.c | 7 | ||||
-rw-r--r-- | toolbox/schedtop.c | 2 | ||||
-rw-r--r-- | toolbox/setconsole.c | 17 |
9 files changed, 15 insertions, 28 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk index 75ce53f..436f13d 100644 --- a/toolbox/Android.mk +++ b/toolbox/Android.mk @@ -89,6 +89,8 @@ LOCAL_SRC_FILES := \ LOCAL_C_INCLUDES := bionic/libc/bionic +LOCAL_CFLAGS += -Wno-unused-parameter + LOCAL_SHARED_LIBRARIES := \ libcutils \ liblog \ diff --git a/toolbox/dd.c b/toolbox/dd.c index a8c12d2..6b61ffb 100644 --- a/toolbox/dd.c +++ b/toolbox/dd.c @@ -92,9 +92,6 @@ extern u_int files_cnt; extern int progress; extern const u_char *ctab; - -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define MAX(a, b) ((a) > (b) ? (a) : (b)) #define DEFFILEMODE (S_IRUSR | S_IWUSR) static void dd_close(void); diff --git a/toolbox/getevent.c b/toolbox/getevent.c index 5f5e16b..ed381f5 100644 --- a/toolbox/getevent.c +++ b/toolbox/getevent.c @@ -166,7 +166,7 @@ static int print_possible_events(int fd, int print_flags) if(bit_labels && (print_flags & PRINT_LABELS)) { bit_label = get_label(bit_labels, j * 8 + k); if(bit_label) - printf(" %.20s%c%*s", bit_label, down, 20 - strlen(bit_label), ""); + printf(" %.20s%c%*s", bit_label, down, (int) (20 - strlen(bit_label)), ""); else printf(" %04x%c ", j * 8 + k, down); } else { diff --git a/toolbox/insmod.c b/toolbox/insmod.c index 756a64b..fb1448b 100644 --- a/toolbox/insmod.c +++ b/toolbox/insmod.c @@ -4,6 +4,7 @@ #include <unistd.h> #include <malloc.h> #include <errno.h> +#include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -45,7 +46,6 @@ bail: return buffer; } -#define min(x,y) ((x) < (y) ? (x) : (y)) int insmod_main(int argc, char **argv) { void *file; @@ -73,7 +73,7 @@ int insmod_main(int argc, char **argv) char *ptr = opts; for (i = 2; (i < argc) && (ptr < end); i++) { - len = min(strlen(argv[i]), end - ptr); + len = MIN(strlen(argv[i]), end - ptr); memcpy(ptr, argv[i], len); ptr += len; *ptr++ = ' '; diff --git a/toolbox/ls.c b/toolbox/ls.c index c740f84..3cc5bb2 100644 --- a/toolbox/ls.c +++ b/toolbox/ls.c @@ -182,8 +182,8 @@ static int listfile_long(const char *path, struct stat *s, int flags) mode2str(s->st_mode, mode); if (flags & LIST_LONG_NUMERIC) { - snprintf(user, sizeof(user), "%ld", s->st_uid); - snprintf(group, sizeof(group), "%ld", s->st_gid); + snprintf(user, sizeof(user), "%u", s->st_uid); + snprintf(group, sizeof(group), "%u", s->st_gid); } else { user2str(s->st_uid, user, sizeof(user)); group2str(s->st_gid, group, sizeof(group)); diff --git a/toolbox/nandread.c b/toolbox/nandread.c index 4666f26..d43b2fe 100644 --- a/toolbox/nandread.c +++ b/toolbox/nandread.c @@ -158,7 +158,7 @@ int nandread_main(int argc, char **argv) printf("oobavail: %u\n", ecclayout.oobavail); } if (ecclayout.oobavail > spare_size) - printf("oobavail, %d > image spare size, %d\n", ecclayout.oobavail, spare_size); + printf("oobavail, %d > image spare size, %zu\n", ecclayout.oobavail, spare_size); ret = ioctl(fd, ECCGETSTATS, &initial_ecc); if (ret) { diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c index 6d78eb6..27dca42 100644 --- a/toolbox/newfs_msdos.c +++ b/toolbox/newfs_msdos.c @@ -234,13 +234,6 @@ static void mklabel(u_int8_t *, const char *); static void setstr(u_int8_t *, const char *, size_t); static void usage(void); -#ifdef ANDROID -#define powerof2(x) ((((x) - 1) & (x)) == 0) -#define howmany(x, y) (((x) + ((y) - 1)) / (y)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -#endif /* * Construct a FAT12, FAT16, or FAT32 file system. */ diff --git a/toolbox/schedtop.c b/toolbox/schedtop.c index 6859b50..a76f968 100644 --- a/toolbox/schedtop.c +++ b/toolbox/schedtop.c @@ -212,7 +212,7 @@ static void update_table(DIR *d, uint32_t flags) } if (!(flags & FLAG_BATCH)) printf("\e[H\e[0J"); - printf("Processes: %d, Threads %d\n", processes.active, threads.active); + printf("Processes: %zu, Threads %zu\n", processes.active, threads.active); switch (time_dp) { case 3: printf(" TID --- SINCE LAST ---- ---------- TOTAL ----------\n"); diff --git a/toolbox/setconsole.c b/toolbox/setconsole.c index 0159c07..85ea7c2 100644 --- a/toolbox/setconsole.c +++ b/toolbox/setconsole.c @@ -12,12 +12,9 @@ static int activate_thread_switch_vc; static void *activate_thread(void *arg) { - int res; - int fd = (int)arg; + int fd = (int) (uintptr_t) arg; while(activate_thread_switch_vc >= 0) { - do { - res = ioctl(fd, VT_ACTIVATE, (void*)activate_thread_switch_vc); - } while(res < 0 && errno == EINTR); + int res = TEMP_FAILURE_RETRY(ioctl(fd, VT_ACTIVATE, activate_thread_switch_vc)); if (res < 0) { fprintf(stderr, "ioctl( vcfd, VT_ACTIVATE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), activate_thread_switch_vc); } @@ -131,11 +128,9 @@ int setconsole_main(int argc, char *argv[]) activate_thread_switch_vc = switch_vc; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&thread, &attr, activate_thread, (void*)fd); - - do { - res = ioctl(fd, VT_WAITACTIVE, (void*)switch_vc); - } while(res < 0 && errno == EINTR); + pthread_create(&thread, &attr, activate_thread, (void*) (uintptr_t) fd); + + res = TEMP_FAILURE_RETRY(ioctl(fd, VT_WAITACTIVE, switch_vc)); activate_thread_switch_vc = -1; if (res < 0) { fprintf(stderr, "ioctl( vcfd, VT_WAITACTIVE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), switch_vc); @@ -157,7 +152,7 @@ int setconsole_main(int argc, char *argv[]) } } if (mode != -1) { - if (ioctl(fd, KDSETMODE, (void*)mode) < 0) { + if (ioctl(fd, KDSETMODE, mode) < 0) { fprintf(stderr, "KDSETMODE %d failed\n", mode); return -1; } |