Merge "Updated trace.h to recognize ATRACE_TAG_BIONIC."
diff --git a/adb/SERVICES.TXT b/adb/SERVICES.TXT
index 7f85dc3..63000f2 100644
--- a/adb/SERVICES.TXT
+++ b/adb/SERVICES.TXT
@@ -240,3 +240,20 @@
This starts the file synchronisation service, used to implement "adb push"
and "adb pull". Since this service is pretty complex, it will be detailed
in a companion document named SYNC.TXT
+
+reverse:<forward-command>
+ This implements the 'adb reverse' feature, i.e. the ability to reverse
+ socket connections from a device to the host. <forward-command> is one
+ of the forwarding commands that are described above, as in:
+
+ list-forward
+ forward:<local>;<remote>
+ forward:norebind:<local>;<remote>
+ killforward-all
+ killforward:<local>
+
+ Note that in this case, <local> corresponds to the socket on the device
+ and <remote> corresponds to the socket on the host.
+
+ The output of reverse:list-forward is the same as host:list-forward
+ except that <serial> will be just 'host'.
diff --git a/adb/adb.c b/adb/adb.c
index 0e41b34..8c1f005 100644
--- a/adb/adb.c
+++ b/adb/adb.c
@@ -318,7 +318,18 @@
#endif
}
-static void send_msg_with_okay(int fd, char* msg, size_t msglen) {
+#if !ADB_HOST
+static void send_msg_with_header(int fd, const char* msg, size_t msglen) {
+ char header[5];
+ if (msglen > 0xffff)
+ msglen = 0xffff;
+ snprintf(header, sizeof(header), "%04x", (unsigned)msglen);
+ writex(fd, header, 4);
+ writex(fd, msg, msglen);
+}
+#endif
+
+static void send_msg_with_okay(int fd, const char* msg, size_t msglen) {
char header[9];
if (msglen > 0xffff)
msglen = 0xffff;
@@ -1428,6 +1439,120 @@
return 0;
}
+// Try to handle a network forwarding request.
+// This returns 1 on success, 0 on failure, and -1 to indicate this is not
+// a forwarding-related request.
+int handle_forward_request(const char* service, transport_type ttype, char* serial, int reply_fd)
+{
+ if (!strcmp(service, "list-forward")) {
+ // Create the list of forward redirections.
+ int buffer_size = format_listeners(NULL, 0);
+ // Add one byte for the trailing zero.
+ char* buffer = malloc(buffer_size + 1);
+ if (buffer == NULL) {
+ sendfailmsg(reply_fd, "not enough memory");
+ return 1;
+ }
+ (void) format_listeners(buffer, buffer_size + 1);
+#if ADB_HOST
+ send_msg_with_okay(reply_fd, buffer, buffer_size);
+#else
+ send_msg_with_header(reply_fd, buffer, buffer_size);
+#endif
+ free(buffer);
+ return 1;
+ }
+
+ if (!strcmp(service, "killforward-all")) {
+ remove_all_listeners();
+#if ADB_HOST
+ /* On the host: 1st OKAY is connect, 2nd OKAY is status */
+ adb_write(reply_fd, "OKAY", 4);
+#endif
+ adb_write(reply_fd, "OKAY", 4);
+ return 1;
+ }
+
+ if (!strncmp(service, "forward:",8) ||
+ !strncmp(service, "killforward:",12)) {
+ char *local, *remote, *err;
+ int r;
+ atransport *transport;
+
+ int createForward = strncmp(service, "kill", 4);
+ int no_rebind = 0;
+
+ local = strchr(service, ':') + 1;
+
+ // Handle forward:norebind:<local>... here
+ if (createForward && !strncmp(local, "norebind:", 9)) {
+ no_rebind = 1;
+ local = strchr(local, ':') + 1;
+ }
+
+ remote = strchr(local,';');
+
+ if (createForward) {
+ // Check forward: parameter format: '<local>;<remote>'
+ if(remote == 0) {
+ sendfailmsg(reply_fd, "malformed forward spec");
+ return 1;
+ }
+
+ *remote++ = 0;
+ if((local[0] == 0) || (remote[0] == 0) || (remote[0] == '*')) {
+ sendfailmsg(reply_fd, "malformed forward spec");
+ return 1;
+ }
+ } else {
+ // Check killforward: parameter format: '<local>'
+ if (local[0] == 0) {
+ sendfailmsg(reply_fd, "malformed forward spec");
+ return 1;
+ }
+ }
+
+ transport = acquire_one_transport(CS_ANY, ttype, serial, &err);
+ if (!transport) {
+ sendfailmsg(reply_fd, err);
+ return 1;
+ }
+
+ if (createForward) {
+ r = install_listener(local, remote, transport, no_rebind);
+ } else {
+ r = remove_listener(local, transport);
+ }
+ if(r == 0) {
+#if ADB_HOST
+ /* On the host: 1st OKAY is connect, 2nd OKAY is status */
+ writex(reply_fd, "OKAY", 4);
+#endif
+ writex(reply_fd, "OKAY", 4);
+ return 1;
+ }
+
+ if (createForward) {
+ const char* message;
+ switch (r) {
+ case INSTALL_STATUS_CANNOT_BIND:
+ message = "cannot bind to socket";
+ break;
+ case INSTALL_STATUS_CANNOT_REBIND:
+ message = "cannot rebind existing socket";
+ break;
+ default:
+ message = "internal error";
+ }
+ sendfailmsg(reply_fd, message);
+ } else {
+ sendfailmsg(reply_fd, "cannot remove listener");
+ }
+ return 1;
+ }
+ return 0;
+}
+
int handle_host_request(char *service, transport_type ttype, char* serial, int reply_fd, asocket *s)
{
atransport *transport = NULL;
@@ -1548,97 +1673,9 @@
}
#endif // ADB_HOST
- if(!strcmp(service,"list-forward")) {
- // Create the list of forward redirections.
- int buffer_size = format_listeners(NULL, 0);
- // Add one byte for the trailing zero.
- char* buffer = malloc(buffer_size+1);
- (void) format_listeners(buffer, buffer_size+1);
- send_msg_with_okay(reply_fd, buffer, buffer_size);
- free(buffer);
- return 0;
- }
-
- if (!strcmp(service,"killforward-all")) {
- remove_all_listeners();
- adb_write(reply_fd, "OKAYOKAY", 8);
- return 0;
- }
-
- if(!strncmp(service,"forward:",8) ||
- !strncmp(service,"killforward:",12)) {
- char *local, *remote, *err;
- int r;
- atransport *transport;
-
- int createForward = strncmp(service,"kill",4);
- int no_rebind = 0;
-
- local = strchr(service, ':') + 1;
-
- // Handle forward:norebind:<local>... here
- if (createForward && !strncmp(local, "norebind:", 9)) {
- no_rebind = 1;
- local = strchr(local, ':') + 1;
- }
-
- remote = strchr(local,';');
-
- if (createForward) {
- // Check forward: parameter format: '<local>;<remote>'
- if(remote == 0) {
- sendfailmsg(reply_fd, "malformed forward spec");
- return 0;
- }
-
- *remote++ = 0;
- if((local[0] == 0) || (remote[0] == 0) || (remote[0] == '*')){
- sendfailmsg(reply_fd, "malformed forward spec");
- return 0;
- }
- } else {
- // Check killforward: parameter format: '<local>'
- if (local[0] == 0) {
- sendfailmsg(reply_fd, "malformed forward spec");
- return 0;
- }
- }
-
- transport = acquire_one_transport(CS_ANY, ttype, serial, &err);
- if (!transport) {
- sendfailmsg(reply_fd, err);
- return 0;
- }
-
- if (createForward) {
- r = install_listener(local, remote, transport, no_rebind);
- } else {
- r = remove_listener(local, transport);
- }
- if(r == 0) {
- /* 1st OKAY is connect, 2nd OKAY is status */
- writex(reply_fd, "OKAYOKAY", 8);
- return 0;
- }
-
- if (createForward) {
- const char* message;
- switch (r) {
- case INSTALL_STATUS_CANNOT_BIND:
- message = "cannot bind to socket";
- break;
- case INSTALL_STATUS_CANNOT_REBIND:
- message = "cannot rebind existing socket";
- break;
- default:
- message = "internal error";
- }
- sendfailmsg(reply_fd, message);
- } else {
- sendfailmsg(reply_fd, "cannot remove listener");
- }
- return 0;
- }
+ int ret = handle_forward_request(service, ttype, serial, reply_fd);
+ if (ret >= 0)
+ return ret - 1;
if(!strncmp(service,"get-state",strlen("get-state"))) {
transport = acquire_one_transport(CS_ANY, ttype, serial, NULL);
diff --git a/adb/adb.h b/adb/adb.h
index 6f5c93c..2504f99 100644
--- a/adb/adb.h
+++ b/adb/adb.h
@@ -323,6 +323,8 @@
int create_jdwp_connection_fd(int jdwp_pid);
#endif
+int handle_forward_request(const char* service, transport_type ttype, char* serial, int reply_fd);
+
#if !ADB_HOST
typedef enum {
BACKUP,
diff --git a/adb/commandline.c b/adb/commandline.c
index 241cefc..3970ab1 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -136,6 +136,19 @@
" if <local> is already forwarded\n"
" adb forward --remove <local> - remove a specific forward socket connection\n"
" adb forward --remove-all - remove all forward socket connections\n"
+ " adb reverse --list - list all reverse socket connections from device\n"
+ " adb reverse <remote> <local> - reverse socket connections\n"
+ " reverse specs are one of:\n"
+ " tcp:<port>\n"
+ " localabstract:<unix domain socket name>\n"
+ " localreserved:<unix domain socket name>\n"
+ " localfilesystem:<unix domain socket name>\n"
+ " adb reverse --norebind <remote> <local>\n"
+ " - same as 'adb reverse <remote> <local>' but fails\n"
+ " if <remote> is already reversed.\n"
+ " adb reverse --remove <remote>\n"
+ " - remove a specific reversed socket connection\n"
+ " adb reverse --remove-all - remove all reversed socket connections from device\n"
" adb jdwp - list PIDs of processes hosting a JDWP transport\n"
" adb install [-l] [-r] [-s] [--algo <algorithm name> --key <hex-encoded key> --iv <hex-encoded iv>] <file>\n"
" - push this package file to the device and install it\n"
@@ -1299,8 +1312,11 @@
return 0;
}
- if(!strcmp(argv[0], "forward")) {
+ if(!strcmp(argv[0], "forward") ||
+ !strcmp(argv[0], "reverse"))
+ {
char host_prefix[64];
+ char reverse = (char) !strcmp(argv[0], "reverse");
char remove = 0;
char remove_all = 0;
char list = 0;
@@ -1329,15 +1345,19 @@
}
// Determine the <host-prefix> for this command.
- if (serial) {
- snprintf(host_prefix, sizeof host_prefix, "host-serial:%s",
- serial);
- } else if (ttype == kTransportUsb) {
- snprintf(host_prefix, sizeof host_prefix, "host-usb");
- } else if (ttype == kTransportLocal) {
- snprintf(host_prefix, sizeof host_prefix, "host-local");
+ if (reverse) {
+ snprintf(host_prefix, sizeof host_prefix, "reverse");
} else {
- snprintf(host_prefix, sizeof host_prefix, "host");
+ if (serial) {
+ snprintf(host_prefix, sizeof host_prefix, "host-serial:%s",
+ serial);
+ } else if (ttype == kTransportUsb) {
+ snprintf(host_prefix, sizeof host_prefix, "host-usb");
+ } else if (ttype == kTransportLocal) {
+ snprintf(host_prefix, sizeof host_prefix, "host-local");
+ } else {
+ snprintf(host_prefix, sizeof host_prefix, "host");
+ }
}
// Implement forward --list
diff --git a/adb/services.c b/adb/services.c
index 2d3423b..ebe84bb6 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -154,6 +154,17 @@
adb_close(fd);
}
+void reverse_service(int fd, void* arg)
+{
+ const char* command = arg;
+
+ if (handle_forward_request(command, kTransportAny, NULL, fd) < 0) {
+ sendfailmsg(fd, "not a reverse forwarding command");
+ }
+ free(arg);
+ adb_close(fd);
+}
+
#endif
static int create_service_thread(void (*func)(int, void *), void *cookie)
@@ -398,6 +409,16 @@
ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
} else if(!strncmp(name, "usb:", 4)) {
ret = create_service_thread(restart_usb_service, NULL);
+ } else if (!strncmp(name, "reverse:", 8)) {
+ char* cookie = strdup(name + 8);
+ if (cookie == NULL) {
+ ret = -1;
+ } else {
+ ret = create_service_thread(reverse_service, cookie);
+ if (ret < 0) {
+ free(cookie);
+ }
+ }
#endif
}
if (ret >= 0) {
diff --git a/adb/usb_vendors.c b/adb/usb_vendors.c
index 0c46a0c..c7e0ad5 100755
--- a/adb/usb_vendors.c
+++ b/adb/usb_vendors.c
@@ -51,7 +51,9 @@
// BYD's USB Vendor ID
#define VENDOR_ID_BYD 0x1D91
// Compal's USB Vendor ID
-#define VENDOR_ID_COMPAL 0x1219
+#define VENDOR_ID_COMPAL 0x04B7
+// Compalcomm's USB Vendor ID
+#define VENDOR_ID_COMPALCOMM 0x1219
// Dell's USB Vendor ID
#define VENDOR_ID_DELL 0x413c
// ECS's USB Vendor ID
@@ -170,6 +172,8 @@
#define VENDOR_ID_TI 0x0451
// Toshiba's USB Vendor ID
#define VENDOR_ID_TOSHIBA 0x0930
+// Unowhy's USB Vendor ID
+#define VENDOR_ID_UNOWHY 0x2A49
// Vizio's USB Vendor ID
#define VENDOR_ID_VIZIO 0xE040
// Wacom's USB Vendor ID
@@ -195,6 +199,7 @@
VENDOR_ID_ASUS,
VENDOR_ID_BYD,
VENDOR_ID_COMPAL,
+ VENDOR_ID_COMPALCOMM,
VENDOR_ID_DELL,
VENDOR_ID_ECS,
VENDOR_ID_EMERGING_TECH,
@@ -254,6 +259,7 @@
VENDOR_ID_TELEEPOCH,
VENDOR_ID_TI,
VENDOR_ID_TOSHIBA,
+ VENDOR_ID_UNOWHY,
VENDOR_ID_VIZIO,
VENDOR_ID_WACOM,
VENDOR_ID_XIAOMI,
diff --git a/cpio/Android.mk b/cpio/Android.mk
index 5184463..575beb2 100644
--- a/cpio/Android.mk
+++ b/cpio/Android.mk
@@ -8,6 +8,8 @@
LOCAL_MODULE := mkbootfs
+LOCAL_CFLAGS := -Werror
+
include $(BUILD_HOST_EXECUTABLE)
$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE))
diff --git a/cpio/mkbootfs.c b/cpio/mkbootfs.c
index 7d3740c..7175749 100644
--- a/cpio/mkbootfs.c
+++ b/cpio/mkbootfs.c
@@ -78,8 +78,9 @@
s->st_mode = empty_path_config->mode | (s->st_mode & ~07777);
} else {
// Use the compiled-in fs_config() function.
-
- fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &s->st_mode, &capabilities);
+ unsigned st_mode = s->st_mode;
+ fs_config(path, S_ISDIR(s->st_mode), &s->st_uid, &s->st_gid, &st_mode, &capabilities);
+ s->st_mode = (typeof(s->st_mode)) st_mode;
}
}
diff --git a/debuggerd/mips/machine.cpp b/debuggerd/mips/machine.cpp
index ab34182..5c82d4d 100644
--- a/debuggerd/mips/machine.cpp
+++ b/debuggerd/mips/machine.cpp
@@ -32,10 +32,22 @@
#define R(x) (static_cast<unsigned int>(x))
+// The MIPS uapi ptrace.h has the wrong definition for pt_regs. PTRACE_GETREGS
+// writes 64-bit quantities even though the public struct uses 32-bit ones.
+struct pt_regs_mips_t {
+ uint64_t regs[32];
+ uint64_t lo;
+ uint64_t hi;
+ uint64_t cp0_epc;
+ uint64_t cp0_badvaddr;
+ uint64_t cp0_status;
+ uint64_t cp0_cause;
+};
+
// If configured to do so, dump memory around *all* registers
// for the crashing thread.
void dump_memory_and_code(log_t* log, pid_t tid, int scope_flags) {
- pt_regs r;
+ pt_regs_mips_t r;
if (ptrace(PTRACE_GETREGS, tid, 0, &r)) {
return;
}
@@ -78,7 +90,7 @@
}
void dump_registers(log_t* log, pid_t tid, int scope_flags) {
- pt_regs r;
+ pt_regs_mips_t r;
if(ptrace(PTRACE_GETREGS, tid, 0, &r)) {
_LOG(log, scope_flags, "cannot get registers: %s\n", strerror(errno));
return;
diff --git a/debuggerd/tombstone.cpp b/debuggerd/tombstone.cpp
index 1a00146..cdaa09f 100755
--- a/debuggerd/tombstone.cpp
+++ b/debuggerd/tombstone.cpp
@@ -583,7 +583,6 @@
static void dump_logs(log_t* log, pid_t pid, unsigned tail) {
dump_log_file(log, pid, "system", tail);
dump_log_file(log, pid, "main", tail);
- dump_log_file(log, pid, "events", tail);
}
static void dump_abort_message(Backtrace* backtrace, log_t* log, uintptr_t address) {
diff --git a/fastbootd/transport.c b/fastbootd/transport.c
index ce8f9d0..9a16fd7 100644
--- a/fastbootd/transport.c
+++ b/fastbootd/transport.c
@@ -55,7 +55,7 @@
ftruncate(fd, len);
buffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
- if (buffer == NULL) {
+ if (buffer == MAP_FAILED) {
D(ERR, "mmap(%zu) failed: %d %s", len, errno, strerror(errno));
goto err;
}
diff --git a/include/backtrace/BacktraceMap.h b/include/backtrace/BacktraceMap.h
index 13083bd..c717f09 100644
--- a/include/backtrace/BacktraceMap.h
+++ b/include/backtrace/BacktraceMap.h
@@ -18,6 +18,7 @@
#define _BACKTRACE_BACKTRACE_MAP_H
#include <stdint.h>
+#include <sys/types.h>
#ifdef USE_MINGW
// MINGW does not define these constants.
#define PROT_NONE 0
diff --git a/include/cutils/bitops.h b/include/cutils/bitops.h
index c26dc54..045830d 100644
--- a/include/cutils/bitops.h
+++ b/include/cutils/bitops.h
@@ -59,7 +59,7 @@
static inline int bitmask_ffz(unsigned int *bitmask, int num_bits)
{
int bit, result;
- unsigned int i;
+ size_t i;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++) {
bit = ffs(~bitmask[i]);
@@ -77,7 +77,7 @@
static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
{
- int i;
+ size_t i;
int weight = 0;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
diff --git a/include/cutils/fs.h b/include/cutils/fs.h
index d1d4cf2..70f0b92 100644
--- a/include/cutils/fs.h
+++ b/include/cutils/fs.h
@@ -18,6 +18,7 @@
#define __CUTILS_FS_H
#include <sys/types.h>
+#include <unistd.h>
/*
* TEMP_FAILURE_RETRY is defined by some, but not all, versions of
diff --git a/include/cutils/list.h b/include/cutils/list.h
index 945729a..4ba2cfd 100644
--- a/include/cutils/list.h
+++ b/include/cutils/list.h
@@ -44,10 +44,10 @@
#define list_for_each_reverse(node, list) \
for (node = (list)->prev; node != (list); node = node->prev)
-#define list_for_each_safe(node, next, list) \
- for (node = (list)->next, next = node->next; \
+#define list_for_each_safe(node, n, list) \
+ for (node = (list)->next, n = node->next; \
node != (list); \
- node = next, next = node->next)
+ node = n, n = node->next)
static inline void list_init(struct listnode *node)
{
@@ -63,6 +63,14 @@
head->prev = item;
}
+static inline void list_add_head(struct listnode *head, struct listnode *item)
+{
+ item->next = head->next;
+ item->prev = head;
+ head->next->prev = item;
+ head->next = item;
+}
+
static inline void list_remove(struct listnode *item)
{
item->next->prev = item->prev;
diff --git a/include/cutils/trace.h b/include/cutils/trace.h
index 62a4e9f..fd9bc6a 100644
--- a/include/cutils/trace.h
+++ b/include/cutils/trace.h
@@ -20,6 +20,7 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
+#include <stdio.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/include/log/log_read.h b/include/log/log_read.h
index 54d71a4..946711a 100644
--- a/include/log/log_read.h
+++ b/include/log/log_read.h
@@ -67,7 +67,8 @@
// timespec
bool operator== (const timespec &T) const
{
- return (tv_sec == T.tv_sec) && (tv_nsec == T.tv_nsec);
+ return (tv_sec == static_cast<uint32_t>(T.tv_sec))
+ && (tv_nsec == static_cast<uint32_t>(T.tv_nsec));
}
bool operator!= (const timespec &T) const
{
@@ -75,8 +76,9 @@
}
bool operator< (const timespec &T) const
{
- return (tv_sec < T.tv_sec)
- || ((tv_sec == T.tv_sec) && (tv_nsec < T.tv_nsec));
+ return (tv_sec < static_cast<uint32_t>(T.tv_sec))
+ || ((tv_sec == static_cast<uint32_t>(T.tv_sec))
+ && (tv_nsec < static_cast<uint32_t>(T.tv_nsec)));
}
bool operator>= (const timespec &T) const
{
@@ -84,8 +86,9 @@
}
bool operator> (const timespec &T) const
{
- return (tv_sec > T.tv_sec)
- || ((tv_sec == T.tv_sec) && (tv_nsec > T.tv_nsec));
+ return (tv_sec > static_cast<uint32_t>(T.tv_sec))
+ || ((tv_sec == static_cast<uint32_t>(T.tv_sec))
+ && (tv_nsec > static_cast<uint32_t>(T.tv_nsec)));
}
bool operator<= (const timespec &T) const
{
diff --git a/include/log/logger.h b/include/log/logger.h
index ed39c4f..53be1d3 100644
--- a/include/log/logger.h
+++ b/include/log/logger.h
@@ -62,9 +62,8 @@
/*
* The maximum size of the log entry payload that can be
- * written to the kernel logger driver. An attempt to write
- * more than this amount to /dev/log/* will result in a
- * truncated log entry.
+ * written to the logger. An attempt to write more than
+ * this amount will result in a truncated log entry.
*/
#define LOGGER_ENTRY_MAX_PAYLOAD 4076
diff --git a/include/netd_client/FwmarkCommands.h b/include/netd_client/FwmarkCommands.h
deleted file mode 100644
index 0d22f02..0000000
--- a/include/netd_client/FwmarkCommands.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NETD_CLIENT_FWMARK_COMMANDS_H
-#define NETD_CLIENT_FWMARK_COMMANDS_H
-
-#include <stdint.h>
-
-// Commands sent from clients to the fwmark server to mark sockets (i.e., set their SO_MARK).
-const uint8_t FWMARK_COMMAND_ON_CREATE = 0;
-const uint8_t FWMARK_COMMAND_ON_CONNECT = 1;
-const uint8_t FWMARK_COMMAND_ON_ACCEPT = 2;
-const uint8_t FWMARK_COMMAND_SELECT_NETWORK = 3;
-const uint8_t FWMARK_COMMAND_PROTECT_FROM_VPN = 4;
-
-#endif // NETD_CLIENT_FWMARK_COMMANDS_H
diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h
index d662107..f5289c1 100644
--- a/include/private/android_filesystem_config.h
+++ b/include/private/android_filesystem_config.h
@@ -77,6 +77,7 @@
#define AID_SDCARD_AV 1034 /* external storage audio/video access */
#define AID_SDCARD_ALL 1035 /* access all users external storage */
#define AID_LOGD 1036 /* log daemon */
+#define AID_SHARED_RELRO 1037 /* creator of shared GNU RELRO files */
#define AID_SHELL 2000 /* adb and debug shell user */
#define AID_CACHE 2001 /* cache access */
@@ -153,6 +154,7 @@
{ "sdcard_av", AID_SDCARD_AV, },
{ "sdcard_all", AID_SDCARD_ALL, },
{ "logd", AID_LOGD, },
+ { "shared_relro", AID_SHARED_RELRO, },
{ "shell", AID_SHELL, },
{ "cache", AID_CACHE, },
@@ -198,6 +200,7 @@
{ 00771, AID_SHELL, AID_SHELL, 0, "data/local" },
{ 01771, AID_SYSTEM, AID_MISC, 0, "data/misc" },
{ 00770, AID_DHCP, AID_DHCP, 0, "data/misc/dhcp" },
+ { 00771, AID_SHARED_RELRO, AID_SHARED_RELRO, 0, "data/misc/shared_relro" },
{ 00775, AID_MEDIA_RW, AID_MEDIA_RW, 0, "data/media" },
{ 00775, AID_MEDIA_RW, AID_MEDIA_RW, 0, "data/media/Music" },
{ 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
diff --git a/include/system/audio.h b/include/system/audio.h
index f36befb..8838e71 100644
--- a/include/system/audio.h
+++ b/include/system/audio.h
@@ -434,6 +434,14 @@
static const audio_offload_info_t AUDIO_INFO_INITIALIZER = {
version: AUDIO_OFFLOAD_INFO_VERSION_CURRENT,
size: sizeof(audio_offload_info_t),
+ sample_rate: 0,
+ channel_mask: 0,
+ format: AUDIO_FORMAT_DEFAULT,
+ stream_type: AUDIO_STREAM_VOICE_CALL,
+ bit_rate: 0,
+ duration_us: 0,
+ has_video: false,
+ is_streaming: false
};
static inline bool audio_is_output_device(audio_devices_t device)
diff --git a/include/system/window.h b/include/system/window.h
index 588f9c6..16b7b67 100644
--- a/include/system/window.h
+++ b/include/system/window.h
@@ -26,6 +26,13 @@
#include <system/graphics.h>
#include <unistd.h>
+#ifndef __unused
+#define __unused __attribute__((__unused__))
+#endif
+#ifndef __deprecated
+#define __deprecated __attribute__((__deprecated__))
+#endif
+
__BEGIN_DECLS
/*****************************************************************************/
@@ -89,10 +96,10 @@
// Implement the methods that sp<ANativeWindowBuffer> expects so that it
// can be used to automatically refcount ANativeWindowBuffer's.
- void incStrong(const void* id) const {
+ void incStrong(const void* /*id*/) const {
common.incRef(const_cast<android_native_base_t*>(&common));
}
- void decStrong(const void* id) const {
+ void decStrong(const void* /*id*/) const {
common.decRef(const_cast<android_native_base_t*>(&common));
}
#endif
@@ -352,10 +359,10 @@
/* Implement the methods that sp<ANativeWindow> expects so that it
can be used to automatically refcount ANativeWindow's. */
- void incStrong(const void* id) const {
+ void incStrong(const void* /*id*/) const {
common.incRef(const_cast<android_native_base_t*>(&common));
}
- void decStrong(const void* id) const {
+ void decStrong(const void* /*id*/) const {
common.decRef(const_cast<android_native_base_t*>(&common));
}
#endif
@@ -582,7 +589,7 @@
* android_native_window_t is deprecated.
*/
typedef struct ANativeWindow ANativeWindow;
-typedef struct ANativeWindow android_native_window_t;
+typedef struct ANativeWindow android_native_window_t __deprecated;
/*
* native_window_set_usage(..., usage)
@@ -603,13 +610,19 @@
/* deprecated. Always returns 0. Don't call. */
static inline int native_window_connect(
- struct ANativeWindow* window, int api) {
+ struct ANativeWindow* window __unused, int api __unused) __deprecated;
+
+static inline int native_window_connect(
+ struct ANativeWindow* window __unused, int api __unused) {
return 0;
}
/* deprecated. Always returns 0. Don't call. */
static inline int native_window_disconnect(
- struct ANativeWindow* window, int api) {
+ struct ANativeWindow* window __unused, int api __unused) __deprecated;
+
+static inline int native_window_disconnect(
+ struct ANativeWindow* window __unused, int api __unused) {
return 0;
}
@@ -664,6 +677,10 @@
*/
static inline int native_window_set_active_rect(
struct ANativeWindow* window,
+ android_native_rect_t const * active_rect) __deprecated;
+
+static inline int native_window_set_active_rect(
+ struct ANativeWindow* window,
android_native_rect_t const * active_rect)
{
return native_window_set_post_transform_crop(window, active_rect);
@@ -691,6 +708,10 @@
*/
static inline int native_window_set_buffers_geometry(
struct ANativeWindow* window,
+ int w, int h, int format) __deprecated;
+
+static inline int native_window_set_buffers_geometry(
+ struct ANativeWindow* window,
int w, int h, int format)
{
return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,
diff --git a/include/utils/Functor.h b/include/utils/Functor.h
index e24ded4..09ea614 100644
--- a/include/utils/Functor.h
+++ b/include/utils/Functor.h
@@ -25,7 +25,7 @@
public:
Functor() {}
virtual ~Functor() {}
- virtual status_t operator ()(int what, void* data) { return NO_ERROR; }
+ virtual status_t operator ()(int /*what*/, void* /*data*/) { return NO_ERROR; }
};
}; // namespace android
diff --git a/include/utils/LruCache.h b/include/utils/LruCache.h
index 053bfaf..9248ac9 100644
--- a/include/utils/LruCache.h
+++ b/include/utils/LruCache.h
@@ -56,7 +56,7 @@
bool next() {
mIndex = mCache.mTable->next(mIndex);
- return mIndex != -1;
+ return (ssize_t)mIndex != -1;
}
size_t index() const {
@@ -103,9 +103,13 @@
// Implementation is here, because it's fully templated
template <typename TKey, typename TValue>
-LruCache<TKey, TValue>::LruCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity),
- mNullValue(NULL), mTable(new BasicHashtable<TKey, Entry>), mYoungest(NULL), mOldest(NULL),
- mListener(NULL) {
+LruCache<TKey, TValue>::LruCache(uint32_t maxCapacity)
+ : mTable(new BasicHashtable<TKey, Entry>)
+ , mListener(NULL)
+ , mOldest(NULL)
+ , mYoungest(NULL)
+ , mMaxCapacity(maxCapacity)
+ , mNullValue(NULL) {
};
template<typename K, typename V>
diff --git a/init/devices.c b/init/devices.c
index 5d7ad3b..3119e8e 100644
--- a/init/devices.c
+++ b/init/devices.c
@@ -298,6 +298,37 @@
}
}
+/* Given a path that may start with a PCI device, populate the supplied buffer
+ * with the PCI domain/bus number and the peripheral ID and return 0.
+ * If it doesn't start with a PCI device, or there is some error, return -1 */
+static int find_pci_device_prefix(const char *path, char *buf, ssize_t buf_sz)
+{
+ const char *start, *end;
+
+ if (strncmp(path, "/devices/pci", 12))
+ return -1;
+
+ /* Beginning of the prefix is the initial "pci" after "/devices/" */
+ start = path + 9;
+
+ /* End of the prefix is two path '/' later, capturing the domain/bus number
+ * and the peripheral ID. Example: pci0000:00/0000:00:1f.2 */
+ end = strchr(start, '/');
+ if (!end)
+ return -1;
+ end = strchr(end + 1, '/');
+ if (!end)
+ return -1;
+
+ /* Make sure we have enough room for the string plus null terminator */
+ if (end - start + 1 > buf_sz)
+ return -1;
+
+ strncpy(buf, start, end - start);
+ buf[end - start] = '\0';
+ return 0;
+}
+
#if LOG_UEVENTS
static inline suseconds_t get_usecs(void)
@@ -422,11 +453,12 @@
return NULL;
}
-static char **parse_platform_block_device(struct uevent *uevent)
+static char **get_block_device_symlinks(struct uevent *uevent)
{
const char *device;
struct platform_node *pdev;
char *slash;
+ const char *type;
int width;
char buf[256];
char link_path[256];
@@ -438,18 +470,24 @@
struct stat info;
pdev = find_platform_device(uevent->path);
- if (!pdev)
+ if (pdev) {
+ device = pdev->name;
+ type = "platform";
+ } else if (!find_pci_device_prefix(uevent->path, buf, sizeof(buf))) {
+ device = buf;
+ type = "pci";
+ } else {
return NULL;
- device = pdev->name;
+ }
char **links = malloc(sizeof(char *) * 4);
if (!links)
return NULL;
memset(links, 0, sizeof(char *) * 4);
- INFO("found platform device %s\n", device);
+ INFO("found %s device %s\n", type, device);
- snprintf(link_path, sizeof(link_path), "/dev/block/platform/%s", device);
+ snprintf(link_path, sizeof(link_path), "/dev/block/%s/%s", type, device);
if (uevent->partition_name) {
p = strdup(uevent->partition_name);
@@ -556,7 +594,7 @@
make_dir(base, 0755);
if (!strncmp(uevent->path, "/devices/", 9))
- links = parse_platform_block_device(uevent);
+ links = get_block_device_symlinks(uevent);
handle_device(uevent->action, devpath, uevent->path, 1,
uevent->major, uevent->minor, links);
diff --git a/init/property_service.c b/init/property_service.c
index 4bcf883..fb3bc8d 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -38,7 +38,6 @@
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/mman.h>
-#include <sys/atomics.h>
#include <private/android_filesystem_config.h>
#include <selinux/selinux.h>
diff --git a/libbacktrace/Android.build.mk b/libbacktrace/Android.build.mk
index dc73f9f..9882e31 100644
--- a/libbacktrace/Android.build.mk
+++ b/libbacktrace/Android.build.mk
@@ -72,6 +72,9 @@
ifeq ($(build_type),host)
# Only build if host builds are supported.
ifeq ($(build_host),true)
+ ifneq ($($(module)_libc++),)
+ include external/libcxx/libcxx.mk
+ endif
include $(BUILD_HOST_$(build_target))
endif
endif
diff --git a/libbacktrace/BacktraceThread.cpp b/libbacktrace/BacktraceThread.cpp
index 018d51f..b47cd2a 100644
--- a/libbacktrace/BacktraceThread.cpp
+++ b/libbacktrace/BacktraceThread.cpp
@@ -117,6 +117,12 @@
futex(&futex_, FUTEX_WAKE, INT_MAX, NULL, NULL, 0);
}
+void ThreadEntry::CopyUcontextFromSigcontext(void* sigcontext) {
+ ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(sigcontext);
+ // The only thing the unwinder cares about is the mcontext data.
+ memcpy(&ucontext_.uc_mcontext, &ucontext->uc_mcontext, sizeof(ucontext->uc_mcontext));
+}
+
//-------------------------------------------------------------------------
// BacktraceThread functions.
//-------------------------------------------------------------------------
@@ -129,7 +135,7 @@
return;
}
- entry->CopyUcontext(reinterpret_cast<ucontext_t*>(sigcontext));
+ entry->CopyUcontextFromSigcontext(sigcontext);
// Indicate the ucontext is now valid.
entry->Wake();
diff --git a/libbacktrace/BacktraceThread.h b/libbacktrace/BacktraceThread.h
index a75a807..ff3e9f3 100644
--- a/libbacktrace/BacktraceThread.h
+++ b/libbacktrace/BacktraceThread.h
@@ -40,14 +40,12 @@
static void Remove(ThreadEntry* entry);
- inline void CopyUcontext(ucontext_t* ucontext) {
- memcpy(&ucontext_, ucontext, sizeof(ucontext_));
- }
-
void Wake();
void Wait(int);
+ void CopyUcontextFromSigcontext(void*);
+
inline void Lock() {
pthread_mutex_lock(&mutex_);
// Reset the futex value in case of multiple unwinds of the same thread.
diff --git a/libbacktrace/UnwindMap.cpp b/libbacktrace/UnwindMap.cpp
index 1615518..4f9831b 100644
--- a/libbacktrace/UnwindMap.cpp
+++ b/libbacktrace/UnwindMap.cpp
@@ -15,6 +15,7 @@
*/
#include <pthread.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/libctest/Android.mk b/libctest/Android.mk
deleted file mode 100644
index 815fabb..0000000
--- a/libctest/Android.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libctest
-LOCAL_SRC_FILES := ctest.c
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libctest/NOTICE b/libctest/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/libctest/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-2008, The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/libctest/ctest.c b/libctest/ctest.c
deleted file mode 100644
index ee6331f..0000000
--- a/libctest/ctest.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <ctest/ctest.h>
-
-#define MAX_TESTS 255
-
-/** Semi-random number used to identify assertion errors. */
-#define ASSERTION_ERROR 42
-
-typedef void TestCase();
-
-/** A suite of tests. */
-typedef struct {
- int size;
- const char* testNames[MAX_TESTS];
- TestCase* tests[MAX_TESTS];
- int currentTest;
- FILE* out;
-} TestSuite;
-
-/** Gets the test suite. Creates it if necessary. */
-static TestSuite* getTestSuite() {
- static TestSuite* suite = NULL;
-
- if (suite != NULL) {
- return suite;
- }
-
- suite = calloc(1, sizeof(TestSuite));
- assert(suite != NULL);
-
- suite->out = tmpfile();
- assert(suite->out != NULL);
-
- return suite;
-}
-
-void addNamedTest(const char* name, TestCase* test) {
- TestSuite* testSuite = getTestSuite();
- assert(testSuite->size <= MAX_TESTS);
-
- int index = testSuite->size;
- testSuite->testNames[index] = name;
- testSuite->tests[index] = test;
-
- testSuite->size++;
-}
-
-/** Prints failures to stderr. */
-static void printFailures(int failures) {
- TestSuite* suite = getTestSuite();
-
- fprintf(stderr, "FAILURE! %d of %d tests failed. Failures:\n",
- failures, suite->size);
-
- // Copy test output to stdout.
- rewind(suite->out);
- char buffer[512];
- size_t read;
- while ((read = fread(buffer, sizeof(char), 512, suite->out)) > 0) {
- // TODO: Make sure we actually wrote 'read' bytes.
- fwrite(buffer, sizeof(char), read, stderr);
- }
-}
-
-/** Runs a single test case. */
-static int runCurrentTest() {
- TestSuite* suite = getTestSuite();
-
- pid_t pid = fork();
- if (pid == 0) {
- // Child process. Runs test case.
- suite->tests[suite->currentTest]();
-
- // Exit successfully.
- exit(0);
- } else if (pid < 0) {
- fprintf(stderr, "Fork failed.");
- exit(1);
- } else {
- // Parent process. Wait for child.
- int status;
- waitpid(pid, &status, 0);
-
- if (!WIFEXITED(status)) {
- return -1;
- }
-
- return WEXITSTATUS(status);
- }
-}
-
-void runTests() {
- TestSuite* suite = getTestSuite();
-
- int failures = 0;
- for (suite->currentTest = 0; suite->currentTest < suite->size;
- suite->currentTest++) {
- // Flush stdout before forking.
- fflush(stdout);
-
- int result = runCurrentTest();
-
- if (result != 0) {
- printf("X");
-
- failures++;
-
- // Handle errors other than assertions.
- if (result != ASSERTION_ERROR) {
- // TODO: Report file name.
- fprintf(suite->out, "Process failed: [%s] status: %d\n",
- suite->testNames[suite->currentTest], result);
- fflush(suite->out);
- }
- } else {
- printf(".");
- }
- }
-
- printf("\n");
-
- if (failures > 0) {
- printFailures(failures);
- } else {
- printf("SUCCESS! %d tests ran successfully.\n", suite->size);
- }
-}
-
-void assertTrueWithSource(int value, const char* file, int line, char* message) {
- if (!value) {
- TestSuite* suite = getTestSuite();
-
- fprintf(suite->out, "Assertion failed: [%s:%d] %s: %s\n", file, line,
- suite->testNames[suite->currentTest], message);
- fflush(suite->out);
-
- // Exit the process for this test case.
- exit(ASSERTION_ERROR);
- }
-}
diff --git a/libdiskconfig/Android.mk b/libdiskconfig/Android.mk
index b5d83fa..624e385 100644
--- a/libdiskconfig/Android.mk
+++ b/libdiskconfig/Android.mk
@@ -12,6 +12,7 @@
LOCAL_MODULE := libdiskconfig
LOCAL_MODULE_TAGS := optional
LOCAL_SYSTEM_SHARED_LIBRARIES := libcutils liblog libc
+LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
ifeq ($(HOST_OS),linux)
diff --git a/libion/Android.mk b/libion/Android.mk
index e5d495b..6562cd3 100644
--- a/libion/Android.mk
+++ b/libion/Android.mk
@@ -1,4 +1,4 @@
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := ion.c
@@ -7,6 +7,7 @@
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers
+LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@@ -15,6 +16,7 @@
LOCAL_MODULE_TAGS := optional tests
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/kernel-headers
LOCAL_SHARED_LIBRARIES := liblog
+LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/libnetd_client/Android.mk b/libnetd_client/Android.mk
deleted file mode 100644
index 2b75626..0000000
--- a/libnetd_client/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libnetd_client
-LOCAL_SRC_FILES := FwmarkClient.cpp NetdClient.cpp
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/libnetd_client/FwmarkClient.cpp b/libnetd_client/FwmarkClient.cpp
deleted file mode 100644
index e360b4e..0000000
--- a/libnetd_client/FwmarkClient.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FwmarkClient.h"
-
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <unistd.h>
-
-namespace {
-
-const sockaddr_un FWMARK_SERVER_PATH = {AF_UNIX, "/dev/socket/fwmarkd"};
-
-} // namespace
-
-bool FwmarkClient::shouldSetFwmark(int sockfd, const sockaddr* addr) {
- return sockfd >= 0 && addr && (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) &&
- !getenv("ANDROID_NO_USE_FWMARK_CLIENT");
-}
-
-FwmarkClient::FwmarkClient() : mChannel(-1) {
-}
-
-FwmarkClient::~FwmarkClient() {
- if (mChannel >= 0) {
- // We don't care about errors while closing the channel, so restore any previous error.
- int error = errno;
- close(mChannel);
- errno = error;
- }
-}
-
-bool FwmarkClient::send(void* data, size_t len, int fd) {
- mChannel = socket(AF_UNIX, SOCK_STREAM, 0);
- if (mChannel == -1) {
- return false;
- }
-
- if (TEMP_FAILURE_RETRY(connect(mChannel, reinterpret_cast<const sockaddr*>(&FWMARK_SERVER_PATH),
- sizeof(FWMARK_SERVER_PATH))) == -1) {
- // If we are unable to connect to the fwmark server, assume there's no error. This protects
- // against future changes if the fwmark server goes away.
- errno = 0;
- return true;
- }
-
- iovec iov;
- iov.iov_base = data;
- iov.iov_len = len;
-
- msghdr message;
- memset(&message, 0, sizeof(message));
- message.msg_iov = &iov;
- message.msg_iovlen = 1;
-
- union {
- cmsghdr cmh;
- char cmsg[CMSG_SPACE(sizeof(fd))];
- } cmsgu;
-
- memset(cmsgu.cmsg, 0, sizeof(cmsgu.cmsg));
- message.msg_control = cmsgu.cmsg;
- message.msg_controllen = sizeof(cmsgu.cmsg);
-
- cmsghdr* const cmsgh = CMSG_FIRSTHDR(&message);
- cmsgh->cmsg_len = CMSG_LEN(sizeof(fd));
- cmsgh->cmsg_level = SOL_SOCKET;
- cmsgh->cmsg_type = SCM_RIGHTS;
- memcpy(CMSG_DATA(cmsgh), &fd, sizeof(fd));
-
- if (TEMP_FAILURE_RETRY(sendmsg(mChannel, &message, 0)) == -1) {
- return false;
- }
-
- int error = 0;
- if (TEMP_FAILURE_RETRY(recv(mChannel, &error, sizeof(error), 0)) == -1) {
- return false;
- }
-
- errno = error;
- return !error;
-}
diff --git a/libnetd_client/FwmarkClient.h b/libnetd_client/FwmarkClient.h
deleted file mode 100644
index 4cf0cc0..0000000
--- a/libnetd_client/FwmarkClient.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef NETD_CLIENT_FWMARK_CLIENT_H
-#define NETD_CLIENT_FWMARK_CLIENT_H
-
-#include <sys/socket.h>
-
-class FwmarkClient {
-public:
- // Returns true if |sockfd| should be sent to the fwmark server to have its SO_MARK set.
- static bool shouldSetFwmark(int sockfd, const sockaddr* addr);
-
- FwmarkClient();
- ~FwmarkClient();
-
- // Sends |data| to the fwmark server, along with |fd| as ancillary data using cmsg(3).
- // Returns true on success.
- bool send(void* data, size_t len, int fd);
-
-private:
- int mChannel;
-};
-
-#endif // NETD_CLIENT_INCLUDE_FWMARK_CLIENT_H
diff --git a/libnetd_client/NetdClient.cpp b/libnetd_client/NetdClient.cpp
deleted file mode 100644
index 8deea1e..0000000
--- a/libnetd_client/NetdClient.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "FwmarkClient.h"
-#include "netd_client/FwmarkCommands.h"
-
-#include <sys/socket.h>
-#include <unistd.h>
-
-namespace {
-
-int closeFdAndRestoreErrno(int fd) {
- int error = errno;
- close(fd);
- errno = error;
- return -1;
-}
-
-typedef int (*ConnectFunctionType)(int, const sockaddr*, socklen_t);
-typedef int (*AcceptFunctionType)(int, sockaddr*, socklen_t*);
-
-ConnectFunctionType libcConnect = 0;
-AcceptFunctionType libcAccept = 0;
-
-int netdClientConnect(int sockfd, const sockaddr* addr, socklen_t addrlen) {
- if (FwmarkClient::shouldSetFwmark(sockfd, addr)) {
- char data[] = {FWMARK_COMMAND_ON_CONNECT};
- if (!FwmarkClient().send(data, sizeof(data), sockfd)) {
- return -1;
- }
- }
- return libcConnect(sockfd, addr, addrlen);
-}
-
-int netdClientAccept(int sockfd, sockaddr* addr, socklen_t* addrlen) {
- int acceptedSocket = libcAccept(sockfd, addr, addrlen);
- if (acceptedSocket == -1) {
- return -1;
- }
- sockaddr socketAddress;
- if (!addr) {
- socklen_t socketAddressLen = sizeof(socketAddress);
- if (getsockname(acceptedSocket, &socketAddress, &socketAddressLen) == -1) {
- return closeFdAndRestoreErrno(acceptedSocket);
- }
- addr = &socketAddress;
- }
- if (FwmarkClient::shouldSetFwmark(acceptedSocket, addr)) {
- char data[] = {FWMARK_COMMAND_ON_ACCEPT};
- if (!FwmarkClient().send(data, sizeof(data), acceptedSocket)) {
- return closeFdAndRestoreErrno(acceptedSocket);
- }
- }
- return acceptedSocket;
-}
-
-} // namespace
-
-extern "C" void netdClientInitConnect(ConnectFunctionType* function) {
- if (function && *function) {
- libcConnect = *function;
- *function = netdClientConnect;
- }
-}
-
-extern "C" void netdClientInitAccept(AcceptFunctionType* function) {
- if (function && *function) {
- libcAccept = *function;
- *function = netdClientAccept;
- }
-}
diff --git a/libnetutils/Android.mk b/libnetutils/Android.mk
index aba4621..1f61511 100644
--- a/libnetutils/Android.mk
+++ b/libnetutils/Android.mk
@@ -1,7 +1,7 @@
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= \
+LOCAL_SRC_FILES := \
dhcpclient.c \
dhcpmsg.c \
dhcp_utils.c \
@@ -12,6 +12,8 @@
libcutils \
liblog
-LOCAL_MODULE:= libnetutils
+LOCAL_MODULE := libnetutils
+
+LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
diff --git a/libnetutils/dhcpclient.c b/libnetutils/dhcpclient.c
index 34500e7..b58120e 100644
--- a/libnetutils/dhcpclient.c
+++ b/libnetutils/dhcpclient.c
@@ -282,16 +282,18 @@
ALOGD("chaddr = {%s}", buf);
for (n = 0; n < 64; n++) {
- if ((msg->sname[n] < ' ') || (msg->sname[n] > 127)) {
- if (msg->sname[n] == 0) break;
+ unsigned char x = msg->sname[n];
+ if ((x < ' ') || (x > 127)) {
+ if (x == 0) break;
msg->sname[n] = '.';
}
}
msg->sname[63] = 0;
for (n = 0; n < 128; n++) {
- if ((msg->file[n] < ' ') || (msg->file[n] > 127)) {
- if (msg->file[n] == 0) break;
+ unsigned char x = msg->file[n];
+ if ((x < ' ') || (x > 127)) {
+ if (x == 0) break;
msg->file[n] = '.';
}
}
diff --git a/libpixelflinger/codeflinger/CodeCache.cpp b/libpixelflinger/codeflinger/CodeCache.cpp
index 7446da2..8afe0a9 100644
--- a/libpixelflinger/codeflinger/CodeCache.cpp
+++ b/libpixelflinger/codeflinger/CodeCache.cpp
@@ -89,7 +89,7 @@
gExecutableStore = mmap(NULL, kMaxCodeCacheCapacity,
PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_PRIVATE, fd, 0);
- LOG_ALWAYS_FATAL_IF(gExecutableStore == NULL,
+ LOG_ALWAYS_FATAL_IF(gExecutableStore == MAP_FAILED,
"Creating code cache, mmap failed with error "
"'%s'", strerror(errno));
close(fd);
diff --git a/libsuspend/Android.mk b/libsuspend/Android.mk
index a2fa3e0..1ba2f59 100644
--- a/libsuspend/Android.mk
+++ b/libsuspend/Android.mk
@@ -18,6 +18,7 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES := $(libsuspend_libraries)
+LOCAL_CFLAGS := -Werror
#LOCAL_CFLAGS += -DLOG_NDEBUG=0
include $(BUILD_SHARED_LIBRARY)
@@ -27,5 +28,6 @@
LOCAL_MODULE_TAGS := optional
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
+LOCAL_CFLAGS := -Werror
#LOCAL_CFLAGS += -DLOG_NDEBUG=0
include $(BUILD_STATIC_LIBRARY)
diff --git a/libsync/Android.mk b/libsync/Android.mk
index 626b762..fd1c88c 100644
--- a/libsync/Android.mk
+++ b/libsync/Android.mk
@@ -7,6 +7,7 @@
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
@@ -15,4 +16,5 @@
LOCAL_MODULE_TAGS := optional tests
LOCAL_SHARED_LIBRARIES := liblog
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
+LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
diff --git a/libusbhost/Android.mk b/libusbhost/Android.mk
index acfc020..5c12f2c 100644
--- a/libusbhost/Android.mk
+++ b/libusbhost/Android.mk
@@ -25,6 +25,7 @@
LOCAL_MODULE := libusbhost
LOCAL_SRC_FILES := usbhost.c
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -38,7 +39,7 @@
LOCAL_MODULE := libusbhost
LOCAL_SRC_FILES := usbhost.c
-LOCAL_CFLAGS := -g -DUSE_LIBLOG
+LOCAL_CFLAGS := -g -DUSE_LIBLOG -Werror
# needed for logcat
LOCAL_SHARED_LIBRARIES := libcutils
@@ -52,5 +53,6 @@
LOCAL_MODULE := libusbhost
LOCAL_SRC_FILES := usbhost.c
+LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY)
diff --git a/libutils/Printer.cpp b/libutils/Printer.cpp
index 263e740..1dc8632 100644
--- a/libutils/Printer.cpp
+++ b/libutils/Printer.cpp
@@ -25,10 +25,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifndef __BIONIC__
-#define fdprintf dprintf
-#endif
-
namespace android {
/*
@@ -120,7 +116,7 @@
}
#ifndef USE_MINGW
- fdprintf(mFd, mFormatString, mPrefix, string);
+ dprintf(mFd, mFormatString, mPrefix, string);
#endif
}
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index ed2c241..16fe7ee 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -633,11 +633,6 @@
dev = dev->next = new log_device_t("crash", false, 'c');
android::g_devCount++;
}
- if (android_name_to_log_id("events") == LOG_ID_EVENTS) {
- dev = dev->next = new log_device_t("events", true, 'e');
- android::g_devCount++;
- needBinary = true;
- }
}
if (android::g_logRotateSizeKBytes != 0
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
index 0651a92..f8d6162 100644
--- a/logd/LogAudit.cpp
+++ b/logd/LogAudit.cpp
@@ -70,6 +70,11 @@
return rc;
}
+ char *cp;
+ while ((cp = strstr(str, " "))) {
+ memmove(cp, cp + 1, strlen(cp + 1) + 1);
+ }
+
if (fdDmesg >= 0) {
struct iovec iov[2];
@@ -88,12 +93,11 @@
static const char audit_str[] = " audit(";
char *timeptr = strstr(str, audit_str);
- char *cp;
if (timeptr
&& ((cp = now.strptime(timeptr + sizeof(audit_str) - 1, "%s.%q")))
&& (*cp == ':')) {
memcpy(timeptr + sizeof(audit_str) - 1, "0.0", 3);
- strcpy(timeptr + sizeof(audit_str) - 1 + 3, cp);
+ memmove(timeptr + sizeof(audit_str) - 1 + 3, cp, strlen(cp) + 1);
} else {
now.strptime("", ""); // side effect of setting CLOCK_REALTIME
}
@@ -109,37 +113,88 @@
}
tid = pid;
uid = logbuf->pidToUid(pid);
- strcpy(pidptr, cp);
+ memmove(pidptr, cp, strlen(cp) + 1);
}
- size_t n = strlen(str);
- n += sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t);
+ // log to events
+
+ size_t l = strlen(str);
+ size_t n = l + sizeof(uint32_t) + sizeof(uint8_t) + sizeof(uint32_t);
+
+ bool notify = false;
char *newstr = reinterpret_cast<char *>(malloc(n));
if (!newstr) {
- free(str);
- return -ENOMEM;
+ rc = -ENOMEM;
+ } else {
+ cp = newstr;
+ *cp++ = AUDITD_LOG_TAG & 0xFF;
+ *cp++ = (AUDITD_LOG_TAG >> 8) & 0xFF;
+ *cp++ = (AUDITD_LOG_TAG >> 16) & 0xFF;
+ *cp++ = (AUDITD_LOG_TAG >> 24) & 0xFF;
+ *cp++ = EVENT_TYPE_STRING;
+ *cp++ = l & 0xFF;
+ *cp++ = (l >> 8) & 0xFF;
+ *cp++ = (l >> 16) & 0xFF;
+ *cp++ = (l >> 24) & 0xFF;
+ memcpy(cp, str, l);
+
+ logbuf->log(LOG_ID_EVENTS, now, uid, pid, tid, newstr,
+ (n <= USHRT_MAX) ? (unsigned short) n : USHRT_MAX);
+ free(newstr);
+
+ notify = true;
}
- char *msg = newstr;
- *msg++ = AUDITD_LOG_TAG & 0xFF;
- *msg++ = (AUDITD_LOG_TAG >> 8) & 0xFF;
- *msg++ = (AUDITD_LOG_TAG >> 16) & 0xFF;
- *msg++ = (AUDITD_LOG_TAG >> 24) & 0xFF;
- *msg++ = EVENT_TYPE_STRING;
- size_t l = n - sizeof(uint32_t) - sizeof(uint8_t) - sizeof(uint32_t);
- *msg++ = l & 0xFF;
- *msg++ = (l >> 8) & 0xFF;
- *msg++ = (l >> 16) & 0xFF;
- *msg++ = (l >> 24) & 0xFF;
- memcpy(msg, str, l);
+ // log to main
+
+ static const char comm_str[] = " comm=\"";
+ const char *comm = strstr(str, comm_str);
+ const char *estr = str + strlen(str);
+ if (comm) {
+ estr = comm;
+ comm += sizeof(comm_str) - 1;
+ } else if (pid == getpid()) {
+ pid = tid;
+ comm = "auditd";
+ } else if (!(comm = logbuf->pidToName(pid))) {
+ comm = "unknown";
+ }
+
+ const char *ecomm = strchr(comm, '"');
+ if (ecomm) {
+ ++ecomm;
+ l = ecomm - comm;
+ } else {
+ l = strlen(comm) + 1;
+ ecomm = "";
+ }
+ n = (estr - str) + strlen(ecomm) + l + 2;
+
+ newstr = reinterpret_cast<char *>(malloc(n));
+ if (!newstr) {
+ rc = -ENOMEM;
+ } else {
+ *newstr = (strstr(str, " permissive=1")
+ || strstr(str, " policy loaded "))
+ ? ANDROID_LOG_INFO
+ : ANDROID_LOG_WARN;
+ strlcpy(newstr + 1, comm, l);
+ strncpy(newstr + 1 + l, str, estr - str);
+ strcpy(newstr + 1 + l + (estr - str), ecomm);
+
+ logbuf->log(LOG_ID_MAIN, now, uid, pid, tid, newstr,
+ (n <= USHRT_MAX) ? (unsigned short) n : USHRT_MAX);
+ free(newstr);
+
+ notify = true;
+ }
+
free(str);
- logbuf->log(LOG_ID_EVENTS, now, uid, pid, tid, newstr,
- (n <= USHRT_MAX) ? (unsigned short) n : USHRT_MAX);
- reader->notifyNewLog();
-
- free(newstr);
+ if (notify) {
+ reader->notifyNewLog();
+ }
return rc;
}
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index ae167aa..0448afa 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -174,7 +174,7 @@
if (last == mLogElements.end()) {
mLogElements.push_back(elem);
} else {
- log_time end;
+ log_time end = log_time::EPOCH;
bool end_set = false;
bool end_always = false;
diff --git a/reboot/Android.mk b/reboot/Android.mk
index 4db0c1e..7a24f99 100644
--- a/reboot/Android.mk
+++ b/reboot/Android.mk
@@ -1,12 +1,14 @@
# Copyright 2013 The Android Open Source Project
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= reboot.c
+LOCAL_SRC_FILES := reboot.c
-LOCAL_SHARED_LIBRARIES:= libcutils
+LOCAL_SHARED_LIBRARIES := libcutils
-LOCAL_MODULE:= reboot
+LOCAL_MODULE := reboot
+
+LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index ed756e0..9f60081 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -98,7 +98,6 @@
write /proc/sys/kernel/sched_child_runs_first 0
write /proc/sys/kernel/randomize_va_space 2
write /proc/sys/kernel/kptr_restrict 2
- write /proc/sys/kernel/dmesg_restrict 1
write /proc/sys/vm/mmap_min_addr 32768
write /proc/sys/net/ipv4/ping_group_range "0 2147483647"
write /proc/sys/net/unix/max_dgram_qlen 300
@@ -227,6 +226,7 @@
mkdir /data/misc/sms 0770 system radio
mkdir /data/misc/zoneinfo 0775 system system
mkdir /data/misc/vpn 0770 system vpn
+ mkdir /data/misc/shared_relro 0771 shared_relro shared_relro
mkdir /data/misc/systemkeys 0700 system system
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
diff --git a/rootdir/init.zygote64_32.rc b/rootdir/init.zygote64_32.rc
new file mode 100644
index 0000000..979ab3b
--- /dev/null
+++ b/rootdir/init.zygote64_32.rc
@@ -0,0 +1,12 @@
+service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server --socket-name=zygote
+ class main
+ socket zygote stream 660 root system
+ onrestart write /sys/android_power/request_state wake
+ onrestart write /sys/power/state on
+ onrestart restart media
+ onrestart restart netd
+
+service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote --socket-name=zygote_secondary
+ class main
+ socket zygote_secondary stream 660 root system
+ onrestart restart zygote
diff --git a/sdcard/Android.mk b/sdcard/Android.mk
index 4630db9..63b0f41 100644
--- a/sdcard/Android.mk
+++ b/sdcard/Android.mk
@@ -1,10 +1,10 @@
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= sdcard.c
-LOCAL_MODULE:= sdcard
-LOCAL_CFLAGS := -Wall -Wno-unused-parameter
+LOCAL_SRC_FILES := sdcard.c
+LOCAL_MODULE := sdcard
+LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror
LOCAL_SHARED_LIBRARIES := libc libcutils
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index 5383b83..fddf0a9 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -96,7 +96,7 @@
LOCAL_CFLAGS += \
-std=gnu99 \
- -Wno-unused-parameter \
+ -Werror -Wno-unused-parameter \
-include bsd-compatibility.h \
LOCAL_SHARED_LIBRARIES := \
diff --git a/toolbox/cp/cp.c b/toolbox/cp/cp.c
index bd3c70e..e666453 100644
--- a/toolbox/cp/cp.c
+++ b/toolbox/cp/cp.c
@@ -95,12 +95,14 @@
static int copy(char *[], enum op, int);
+#ifndef ANDROID
static void
progress(int sig __unused)
{
pinfo++;
}
+#endif
int
cp_main(int argc, char *argv[])
diff --git a/toolbox/cp/utils.c b/toolbox/cp/utils.c
index b682bbe..9d0390f 100644
--- a/toolbox/cp/utils.c
+++ b/toolbox/cp/utils.c
@@ -380,10 +380,11 @@
int
setfile(struct stat *fs, int fd)
{
- int rval, islink;
+ int rval = 0;
+#ifndef ANDROID
+ int islink = S_ISLNK(fs->st_mode);
+#endif
- rval = 0;
- islink = S_ISLNK(fs->st_mode);
fs->st_mode &= S_ISUID | S_ISGID | S_IRWXU | S_IRWXG | S_IRWXO;
/*
@@ -401,13 +402,13 @@
fs->st_mode &= ~(S_ISUID | S_ISGID);
}
#ifdef ANDROID
- if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
+ if (fd ? fchmod(fd, fs->st_mode) : chmod(to.p_path, fs->st_mode)) {
#else
- if (fd ? fchmod(fd, fs->st_mode) : lchmod(to.p_path, fs->st_mode)) {
+ if (fd ? fchmod(fd, fs->st_mode) : lchmod(to.p_path, fs->st_mode)) {
#endif
- warn("chmod: %s", to.p_path);
- rval = 1;
- }
+ warn("chmod: %s", to.p_path);
+ rval = 1;
+ }
#ifndef ANDROID
if (!islink && !Nflag) {
diff --git a/toolbox/date.c b/toolbox/date.c
index aa3b72e..70ce1d5 100644
--- a/toolbox/date.c
+++ b/toolbox/date.c
@@ -140,14 +140,12 @@
int date_main(int argc, char *argv[])
{
- int c;
+ int c;
int res;
- struct tm tm;
- time_t t;
- struct timeval tv;
- struct timespec ts;
- char strbuf[260];
- int fd;
+ struct tm tm;
+ time_t t;
+ struct timeval tv;
+ char strbuf[260];
int useutc = 0;
@@ -177,7 +175,6 @@
int hasfmt = argc == optind + 1 && argv[optind][0] == '+';
if(optind == argc || hasfmt) {
- char buf[2000];
time(&t);
if (useutc) {
gmtime_r(&t, &tm);
diff --git a/toolbox/dd.c b/toolbox/dd.c
index 6b61ffb..408a496 100644
--- a/toolbox/dd.c
+++ b/toolbox/dd.c
@@ -356,7 +356,7 @@
++st.in_full;
/* Handle full input blocks. */
- } else if (n == in.dbsz) {
+ } else if (n == (int64_t)in.dbsz) {
in.dbcnt += in.dbrcnt = n;
++st.in_full;
@@ -521,7 +521,7 @@
outp += nw;
st.bytes += nw;
if (nw == n) {
- if (n != out.dbsz)
+ if (n != (int64_t)out.dbsz)
++st.out_part;
else
++st.out_full;
@@ -649,8 +649,8 @@
void
pos_out(void)
{
-// struct mtop t_op;
- int cnt, n;
+/* struct mtop t_op; */
+ int64_t cnt, n;
/*
* If not a tape, try seeking on the file. Seeking on a pipe is
@@ -681,7 +681,7 @@
}
/* Read it. */
- for (cnt = 0; cnt < out.offset; ++cnt) {
+ for (cnt = 0; cnt < (int64_t)out.offset; ++cnt) {
if ((n = read(out.fd, out.db, out.dbsz)) > 0)
continue;
@@ -705,8 +705,8 @@
/* NOTREACHED */
}
- while (cnt++ < out.offset)
- if ((n = bwrite(out.fd, out.db, out.dbsz)) != out.dbsz) {
+ while (cnt++ < (int64_t)out.offset)
+ if ((n = bwrite(out.fd, out.db, out.dbsz)) != (int64_t)out.dbsz) {
fprintf(stderr, "%s: cannot position "
"by writing: %s\n",
out.name, strerror(errno));
@@ -1153,7 +1153,7 @@
((const struct arg *)b)->name));
}
-static long long strsuftoll(const char* name, const char* arg, int def, unsigned int max)
+static long long strsuftoll(const char* name, const char* arg, int def, unsigned long long max)
{
long long result;
@@ -1180,7 +1180,7 @@
f_count(char *arg)
{
- cpy_cnt = strsuftoll("block count", arg, 0, LLONG_MAX);
+ cpy_cnt = (uint64_t)strsuftoll("block count", arg, 0, 0xFFFFFFFFFFFFFFFFULL);
if (!cpy_cnt)
terminate(0);
}
@@ -1228,14 +1228,14 @@
f_seek(char *arg)
{
- out.offset = strsuftoll("seek blocks", arg, 0, LLONG_MAX);
+ out.offset = (uint64_t)strsuftoll("seek blocks", arg, 0, 0xFFFFFFFFFFFFFFFFULL);
}
static void
f_skip(char *arg)
{
- in.offset = strsuftoll("skip blocks", arg, 0, LLONG_MAX);
+ in.offset = (uint64_t)strsuftoll("skip blocks", arg, 0, 0xFFFFFFFFFFFFFFFFULL);
}
static void
diff --git a/toolbox/du.c b/toolbox/du.c
index fc7c943..c8beba5 100644
--- a/toolbox/du.c
+++ b/toolbox/du.c
@@ -76,7 +76,7 @@
int64_t totalblocks;
int ftsoptions, listfiles;
int depth;
- int Hflag, Lflag, aflag, ch, cflag, dflag, gkmflag, nflag, rval, sflag;
+ int Hflag, Lflag, aflag, ch, cflag, dflag, gkmflag, rval, sflag;
const char *noargv[2];
Hflag = Lflag = aflag = cflag = dflag = gkmflag = sflag = 0;
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index ed381f5..c2256ff 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -492,13 +492,11 @@
int c;
int i;
int res;
- int pollres;
int get_time = 0;
int print_device = 0;
char *newline = "\n";
uint16_t get_switch = 0;
struct input_event event;
- int version;
int print_flags = 0;
int print_flags_set = 0;
int dont_block = -1;
@@ -629,7 +627,8 @@
return 0;
while(1) {
- pollres = poll(ufds, nfds, -1);
+ //int pollres =
+ poll(ufds, nfds, -1);
//printf("poll %d, returned %d\n", nfds, pollres);
if(ufds[0].revents & POLLIN) {
read_notify(device_path, ufds[0].fd, print_flags);
diff --git a/toolbox/getevent.h b/toolbox/getevent.h
index 2b76209..0482d04 100644
--- a/toolbox/getevent.h
+++ b/toolbox/getevent.h
@@ -652,6 +652,7 @@
LABEL_END,
};
+#if 0
static struct label id_labels[] = {
LABEL(ID_BUS),
LABEL(ID_VENDOR),
@@ -682,6 +683,7 @@
LABEL(BUS_SPI),
LABEL_END,
};
+#endif
static struct label mt_tool_labels[] = {
LABEL(MT_TOOL_FINGER),
diff --git a/toolbox/getprop.c b/toolbox/getprop.c
index 7fd694d..dcc0ea0 100644
--- a/toolbox/getprop.c
+++ b/toolbox/getprop.c
@@ -32,8 +32,6 @@
int getprop_main(int argc, char *argv[])
{
- int n = 0;
-
if (argc == 1) {
list_properties();
} else {
diff --git a/toolbox/grep/file.c b/toolbox/grep/file.c
index 86b7658..d28dff5 100644
--- a/toolbox/grep/file.c
+++ b/toolbox/grep/file.c
@@ -78,7 +78,9 @@
grep_refill(struct file *f)
{
ssize_t nr;
+#ifndef ANDROID
int bzerr;
+#endif
bufpos = buffer;
bufrem = 0;
diff --git a/toolbox/grep/grep.c b/toolbox/grep/grep.c
index 5a4fa0c..7b2c487 100644
--- a/toolbox/grep/grep.c
+++ b/toolbox/grep/grep.c
@@ -403,7 +403,7 @@
Aflag = 0;
else if (Aflag > LLONG_MAX / 10) {
errno = ERANGE;
- err(2, NULL);
+ err(2, "%llu", Aflag);
}
Aflag = Bflag = (Aflag * 10) + (c - '0');
break;
@@ -420,10 +420,10 @@
l = strtoull(optarg, &ep, 10);
if (((errno == ERANGE) && (l == ULLONG_MAX)) ||
((errno == EINVAL) && (l == 0)))
- err(2, NULL);
+ err(2, "strtoull");
else if (ep[0] != '\0') {
errno = EINVAL;
- err(2, NULL);
+ err(2, "empty");
}
if (c == 'A')
Aflag = l;
@@ -509,10 +509,10 @@
mcount = strtoull(optarg, &ep, 10);
if (((errno == ERANGE) && (mcount == ULLONG_MAX)) ||
((errno == EINVAL) && (mcount == 0)))
- err(2, NULL);
+ err(2, "strtoull");
else if (ep[0] != '\0') {
errno = EINVAL;
- err(2, NULL);
+ err(2, "empty");
}
break;
case 'n':
diff --git a/toolbox/grep/util.c b/toolbox/grep/util.c
index 497db06..5712fee 100644
--- a/toolbox/grep/util.c
+++ b/toolbox/grep/util.c
@@ -273,7 +273,7 @@
return (c);
}
-#define iswword(x) (iswalnum((x)) || (x) == L'_')
+#define iswword(x) (iswalnum((wint_t)(x)) || (x) == L'_')
/*
* Processes a line comparing it with the specified patterns. Each pattern
@@ -323,7 +323,7 @@
continue;
/* Check for whole word match */
if (fg_pattern[i].word && pmatch.rm_so != 0) {
- wint_t wbegin, wend;
+ wchar_t wbegin, wend;
wbegin = wend = L' ';
if (pmatch.rm_so != 0 &&
diff --git a/toolbox/hd.c b/toolbox/hd.c
index 0d2f96a..7c9998e 100644
--- a/toolbox/hd.c
+++ b/toolbox/hd.c
@@ -14,7 +14,6 @@
unsigned char buf[4096];
int res;
int read_len;
- int rv = 0;
int i;
int filepos = 0;
int sum;
diff --git a/toolbox/insmod.c b/toolbox/insmod.c
index fb1448b..d252433 100644
--- a/toolbox/insmod.c
+++ b/toolbox/insmod.c
@@ -73,7 +73,7 @@
char *ptr = opts;
for (i = 2; (i < argc) && (ptr < end); i++) {
- len = MIN(strlen(argv[i]), end - ptr);
+ len = MIN(strlen(argv[i]), (size_t)(end - ptr));
memcpy(ptr, argv[i], len);
ptr += len;
*ptr++ = ' ';
diff --git a/toolbox/ioctl.c b/toolbox/ioctl.c
index fb555d2..17fabff 100644
--- a/toolbox/ioctl.c
+++ b/toolbox/ioctl.c
@@ -21,9 +21,9 @@
int arg_size = 4;
int direct_arg = 0;
uint32_t ioctl_nr;
- void *ioctl_args;
+ void *ioctl_args = NULL;
uint8_t *ioctl_argp;
- uint8_t *ioctl_argp_save;
+ uint8_t *ioctl_argp_save = NULL;
int rem;
do {
@@ -112,6 +112,7 @@
else
res = ioctl(fd, ioctl_nr, 0);
if (res < 0) {
+ free(ioctl_args);
fprintf(stderr, "ioctl 0x%x failed, %d\n", ioctl_nr, res);
return 1;
}
@@ -124,5 +125,6 @@
}
printf("\n");
}
+ free(ioctl_args);
return 0;
}
diff --git a/toolbox/load_policy.c b/toolbox/load_policy.c
index eb5aba6..90d48c4 100644
--- a/toolbox/load_policy.c
+++ b/toolbox/load_policy.c
@@ -10,7 +10,7 @@
int load_policy_main(int argc, char **argv)
{
- int fd, rc, vers;
+ int fd, rc;
struct stat sb;
void *map;
const char *path;
diff --git a/toolbox/ls.c b/toolbox/ls.c
index 06910ee..011f7b5 100644
--- a/toolbox/ls.c
+++ b/toolbox/ls.c
@@ -443,7 +443,6 @@
int ls_main(int argc, char **argv)
{
int flags = 0;
- int listed = 0;
if(argc > 1) {
int i;
diff --git a/toolbox/lsof.c b/toolbox/lsof.c
index af321af..bee981d 100644
--- a/toolbox/lsof.c
+++ b/toolbox/lsof.c
@@ -99,10 +99,7 @@
static void print_maps(struct pid_info_t* info)
{
FILE *maps;
- char buffer[PATH_MAX + 100];
-
size_t offset;
- int major, minor;
char device[10];
long int inode;
char file[PATH_MAX];
diff --git a/toolbox/mkdir.c b/toolbox/mkdir.c
index 656970a..398d350 100644
--- a/toolbox/mkdir.c
+++ b/toolbox/mkdir.c
@@ -15,7 +15,6 @@
int mkdir_main(int argc, char *argv[])
{
- int symbolic = 0;
int ret;
if(argc < 2 || strcmp(argv[1], "--help") == 0) {
return usage();
diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c
index 27dca42..30b9f77 100644
--- a/toolbox/newfs_msdos.c
+++ b/toolbox/newfs_msdos.c
@@ -360,7 +360,7 @@
if (!opt_create && !strchr(fname, '/')) {
snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname);
if (!(fname = strdup(buf)))
- err(1, NULL);
+ err(1, "%s", buf);
}
dtype = *argv;
if (opt_create) {
@@ -493,7 +493,7 @@
if (!strchr(bname, '/')) {
snprintf(buf, sizeof(buf), "/boot/%s", bname);
if (!(bname = strdup(buf)))
- err(1, NULL);
+ err(1, "%s", buf);
}
if ((fd1 = open(bname, O_RDONLY)) == -1 || fstat(fd1, &sb))
err(1, "%s", bname);
@@ -611,7 +611,7 @@
now = tv.tv_sec;
tm = localtime(&now);
if (!(img = malloc(bpb.bps)))
- err(1, NULL);
+ err(1, "%u", bpb.bps);
dir = bpb.res + (bpb.spf ? bpb.spf : bpb.bspf) * bpb.nft;
for (lsn = 0; lsn < dir + (fat == 32 ? bpb.spc : rds); lsn++) {
x = lsn;
@@ -728,14 +728,14 @@
static void
check_mounted(const char *fname, mode_t mode)
{
+#ifdef ANDROID
+ warnx("Skipping mount checks");
+#else
struct statfs *mp;
const char *s1, *s2;
size_t len;
int n, r;
-#ifdef ANDROID
- warnx("Skipping mount checks");
-#else
if (!(n = getmntinfo(&mp, MNT_NOWAIT)))
err(1, "getmntinfo");
len = strlen(_PATH_DEV);
diff --git a/toolbox/ps.c b/toolbox/ps.c
index e9fba0b..57b4280 100644
--- a/toolbox/ps.c
+++ b/toolbox/ps.c
@@ -43,7 +43,7 @@
struct stat stats;
int fd, r;
char *ptr, *name, *state;
- int ppid, tty;
+ int ppid;
unsigned wchan, rss, vss, eip;
unsigned utime, stime;
int prio, nice, rtprio, sched, psr;
@@ -91,7 +91,7 @@
ppid = atoi(nexttok(&ptr));
nexttok(&ptr); // pgrp
nexttok(&ptr); // sid
- tty = atoi(nexttok(&ptr));
+ nexttok(&ptr); // tty
nexttok(&ptr); // tpgid
nexttok(&ptr); // flags
@@ -133,7 +133,7 @@
rtprio = atoi(nexttok(&ptr)); // rt_priority
sched = atoi(nexttok(&ptr)); // scheduling policy
- tty = atoi(nexttok(&ptr));
+ nexttok(&ptr); // tty
if(tid != 0) {
ppid = pid;
diff --git a/toolbox/rmdir.c b/toolbox/rmdir.c
index 06f3df2..749fec8 100644
--- a/toolbox/rmdir.c
+++ b/toolbox/rmdir.c
@@ -11,7 +11,6 @@
int rmdir_main(int argc, char *argv[])
{
- int symbolic = 0;
int ret;
if(argc < 2) return usage();
diff --git a/toolbox/schedtop.c b/toolbox/schedtop.c
index 0c85e76..2fccd2e 100644
--- a/toolbox/schedtop.c
+++ b/toolbox/schedtop.c
@@ -227,7 +227,6 @@
}
for (i = 0; i < last_processes.active; i++) {
int pid = last_processes.data[i].pid;
- int tid = last_processes.data[i].tid;
for (j = 0; j < processes.active; j++)
if (pid == processes.data[j].pid)
break;
@@ -270,9 +269,6 @@
{
int c;
DIR *d;
- struct dirent *de;
- char *namefilter = 0;
- int pidfilter = 0;
uint32_t flags = 0;
int delay = 3000000;
float delay_f;
diff --git a/toolbox/sendevent.c b/toolbox/sendevent.c
index 1608e6c..9b813f6 100644
--- a/toolbox/sendevent.c
+++ b/toolbox/sendevent.c
@@ -47,9 +47,8 @@
int sendevent_main(int argc, char *argv[])
{
- int i;
int fd;
- int ret;
+ ssize_t ret;
int version;
struct input_event event;
@@ -72,7 +71,7 @@
event.code = atoi(argv[3]);
event.value = atoi(argv[4]);
ret = write(fd, &event, sizeof(event));
- if(ret < sizeof(event)) {
+ if(ret < (ssize_t) sizeof(event)) {
fprintf(stderr, "write event failed, %s\n", strerror(errno));
return -1;
}
diff --git a/toolbox/start.c b/toolbox/start.c
index 26344da..0941e64 100644
--- a/toolbox/start.c
+++ b/toolbox/start.c
@@ -7,8 +7,6 @@
int start_main(int argc, char *argv[])
{
- char buf[1024];
-
if(argc > 1) {
property_set("ctl.start", argv[1]);
} else {
diff --git a/toolbox/stop.c b/toolbox/stop.c
index 6552c7c..ed9a293 100644
--- a/toolbox/stop.c
+++ b/toolbox/stop.c
@@ -5,8 +5,6 @@
int stop_main(int argc, char *argv[])
{
- char buf[1024];
-
if(argc > 1) {
property_set("ctl.stop", argv[1]);
} else{
diff --git a/toolbox/top.c b/toolbox/top.c
index 7382f1f..280a032 100644
--- a/toolbox/top.c
+++ b/toolbox/top.c
@@ -328,7 +328,6 @@
static int read_stat(char *filename, struct proc_info *proc) {
FILE *file;
char buf[MAX_LINE], *open_paren, *close_paren;
- int res, idx;
file = fopen(filename, "r");
if (!file) return 1;
@@ -414,9 +413,7 @@
struct proc_info *old_proc, *proc;
long unsigned total_delta_time;
struct passwd *user;
- struct group *group;
char *user_str, user_buf[20];
- char *group_str, group_buf[20];
for (i = 0; i < num_new_procs; i++) {
if (new_procs[i]) {
@@ -467,19 +464,12 @@
if (!proc || (max_procs && (i >= max_procs)))
break;
user = getpwuid(proc->uid);
- group = getgrgid(proc->gid);
if (user && user->pw_name) {
user_str = user->pw_name;
} else {
snprintf(user_buf, 20, "%d", proc->uid);
user_str = user_buf;
}
- if (group && group->gr_name) {
- group_str = group->gr_name;
- } else {
- snprintf(group_buf, 20, "%d", proc->gid);
- group_str = group_buf;
- }
if (!threads)
printf("%5d %2d %3ld%% %c %5d %6ldK %6ldK %3s %-8.8s %s\n", proc->pid, proc->prs, proc->delta_time * 100 / total_delta_time, proc->state, proc->num_threads,
proc->vss / 1024, proc->rss * getpagesize() / 1024, proc->policy, user_str, proc->name[0] != 0 ? proc->name : proc->tname);
diff --git a/toolbox/umount.c b/toolbox/umount.c
index 890e870..3e17396 100644
--- a/toolbox/umount.c
+++ b/toolbox/umount.c
@@ -33,7 +33,6 @@
char mount_path[256];
char rest[256];
int result = 0;
- int path_length = strlen(path);
f = fopen("/proc/mounts", "r");
if (!f) {
diff --git a/toolbox/watchprops.c b/toolbox/watchprops.c
index bf82882..0d05aba 100644
--- a/toolbox/watchprops.c
+++ b/toolbox/watchprops.c
@@ -6,8 +6,6 @@
#include <cutils/properties.h>
#include <cutils/hashmap.h>
-#include <sys/atomics.h>
-
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
@@ -23,9 +21,9 @@
static void announce(char *name, char *value)
{
- char *x;
+ unsigned char *x;
- for(x = value; *x; x++) {
+ for(x = (unsigned char *)value; *x; x++) {
if((*x < 32) || (*x > 127)) *x = '.';
}
@@ -77,9 +75,7 @@
int watchprops_main(int argc, char *argv[])
{
- unsigned serial = 0;
- unsigned count = 0;
- unsigned n;
+ unsigned serial;
Hashmap *watchlist = hashmapCreate(1024, str_hash, str_equals);
if (!watchlist)
@@ -87,7 +83,7 @@
__system_property_foreach(populate_watchlist, watchlist);
- for(;;) {
+ for(serial = 0;;) {
serial = __system_property_wait_any(serial);
__system_property_foreach(update_watchlist, watchlist);
}