Merge "debuggerd: set the name of the signal sender."
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp
index ce10708..3eeed34 100644
--- a/adb/shell_service.cpp
+++ b/adb/shell_service.cpp
@@ -246,7 +246,7 @@
char** current = environ;
while (char* env_cstr = *current++) {
std::string env_string = env_cstr;
- char* delimiter = strchr(env_string.c_str(), '=');
+ char* delimiter = strchr(&env_string[0], '=');
// Drop any values that don't contain '='.
if (delimiter) {
diff --git a/adb/socket.h b/adb/socket.h
index 9eb1b19..4acdf4a 100644
--- a/adb/socket.h
+++ b/adb/socket.h
@@ -118,7 +118,7 @@
namespace internal {
#if ADB_HOST
-char* skip_host_serial(const char* service);
+char* skip_host_serial(char* service);
#endif
} // namespace internal
diff --git a/adb/socket_test.cpp b/adb/socket_test.cpp
index 5cbef6d..20a3bbb 100644
--- a/adb/socket_test.cpp
+++ b/adb/socket_test.cpp
@@ -275,8 +275,8 @@
// Checks that skip_host_serial(serial) returns a pointer to the part of |serial| which matches
// |expected|, otherwise logs the failure to gtest.
-void VerifySkipHostSerial(const std::string& serial, const char* expected) {
- const char* result = internal::skip_host_serial(serial.c_str());
+void VerifySkipHostSerial(std::string serial, const char* expected) {
+ char* result = internal::skip_host_serial(&serial[0]);
if (expected == nullptr) {
EXPECT_EQ(nullptr, result);
} else {
diff --git a/adb/sockets.cpp b/adb/sockets.cpp
index c083ee1..aecaba2 100644
--- a/adb/sockets.cpp
+++ b/adb/sockets.cpp
@@ -634,7 +634,7 @@
// Where <port> must be a base-10 number and <prefix> may be any of {usb,product,model,device}.
//
// The returned pointer will point to the ':' just before <command>, or nullptr if not found.
-char* skip_host_serial(const char* service) {
+char* skip_host_serial(char* service) {
static const std::vector<std::string>& prefixes =
*(new std::vector<std::string>{"usb:", "product:", "model:", "device:"});
diff --git a/bootstat/bootstat.cpp b/bootstat/bootstat.cpp
index 2639d05..b819797 100644
--- a/bootstat/bootstat.cpp
+++ b/bootstat/bootstat.cpp
@@ -224,13 +224,23 @@
time_t current_time_utc = time(nullptr);
- static const char* factory_reset_current_time = "factory_reset_current_time";
if (current_time_utc < 0) {
// UMA does not display negative values in buckets, so convert to positive.
- bootstat::LogHistogram(factory_reset_current_time, std::abs(current_time_utc));
+ bootstat::LogHistogram(
+ "factory_reset_current_time_failure", std::abs(current_time_utc));
+
+ // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+ // is losing records somehow.
+ boot_event_store.AddBootEventWithValue(
+ "factory_reset_current_time_failure", std::abs(current_time_utc));
return;
} else {
- bootstat::LogHistogram(factory_reset_current_time, current_time_utc);
+ bootstat::LogHistogram("factory_reset_current_time", current_time_utc);
+
+ // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+ // is losing records somehow.
+ boot_event_store.AddBootEventWithValue(
+ "factory_reset_current_time", current_time_utc);
}
// The factory_reset boot event does not exist after the device is reset, so
@@ -247,6 +257,12 @@
// factory_reset time.
time_t factory_reset_utc = record.second;
bootstat::LogHistogram("factory_reset_record_value", factory_reset_utc);
+
+ // Logging via BootEventRecordStore to see if using bootstat::LogHistogram
+ // is losing records somehow.
+ boot_event_store.AddBootEventWithValue(
+ "factory_reset_record_value", factory_reset_utc);
+
time_t time_since_factory_reset = difftime(current_time_utc,
factory_reset_utc);
boot_event_store.AddBootEventWithValue("time_since_factory_reset",
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 35f1a9e..6469ec4 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -27,6 +27,7 @@
#include <sys/socket.h>
#include <sys/mount.h>
#include <sys/resource.h>
+#include <sys/syscall.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -61,19 +62,20 @@
#define UNMOUNT_CHECK_MS 5000
#define UNMOUNT_CHECK_TIMES 10
-// System call provided by bionic but not in any header file.
-extern "C" int init_module(void *, unsigned long, const char *);
-
static const int kTerminateServiceDelayMicroSeconds = 50000;
static int insmod(const char *filename, const char *options) {
- std::string module;
- if (!read_file(filename, &module)) {
+ int fd = open(filename, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
+ if (fd == -1) {
+ ERROR("insmod: open(\"%s\") failed: %s", filename, strerror(errno));
return -1;
}
-
- // TODO: use finit_module for >= 3.8 kernels.
- return init_module(&module[0], module.size(), options);
+ int rc = syscall(__NR_finit_module, fd, options, 0);
+ if (rc == -1) {
+ ERROR("finit_module for \"%s\" failed: %s", filename, strerror(errno));
+ }
+ close(fd);
+ return rc;
}
static int __ifupdown(const char *interface, int up) {
diff --git a/mkbootimg/mkbootimg b/mkbootimg/mkbootimg
index 7b04bcc..5a13da2 100755
--- a/mkbootimg/mkbootimg
+++ b/mkbootimg/mkbootimg
@@ -102,12 +102,12 @@
def parse_os_version(x):
match = re.search(r'^(\d{1,3})(?:\.(\d{1,3})(?:\.(\d{1,3}))?)?', x)
if match:
- a = parse_int(match.group(1))
+ a = int(match.group(1))
b = c = 0
if match.lastindex >= 2:
- b = parse_int(match.group(2))
+ b = int(match.group(2))
if match.lastindex == 3:
- c = parse_int(match.group(3))
+ c = int(match.group(3))
# 7 bits allocated for each field
assert a < 128
assert b < 128
@@ -118,8 +118,8 @@
def parse_os_patch_level(x):
match = re.search(r'^(\d{4})-(\d{2})-(\d{2})', x)
if match:
- y = parse_int(match.group(1)) - 2000
- m = parse_int(match.group(2))
+ y = int(match.group(1)) - 2000
+ m = int(match.group(2))
# 7 bits allocated for the year, 4 bits for the month
assert y >= 0 and y < 128
assert m > 0 and m <= 12