Merge "ueventd: allow configuring SO_RCVBUF(FORCE) for the ueventd socket"
diff --git a/adb/client/fastdeploy.cpp b/adb/client/fastdeploy.cpp
index 45f3cca..e82f15a 100644
--- a/adb/client/fastdeploy.cpp
+++ b/adb/client/fastdeploy.cpp
@@ -228,11 +228,12 @@
android::base::StringPrintf(kAgentExtractCommandPattern, packageName.c_str());
std::vector<char> extractErrorBuffer;
- int statusCode;
- DeployAgentFileCallback cb(outputFp, &extractErrorBuffer, &statusCode);
+ DeployAgentFileCallback cb(outputFp, &extractErrorBuffer);
int returnCode = send_shell_command(extractCommand, false, &cb);
if (returnCode != 0) {
- error_exit("Executing %s returned %d", extractCommand.c_str(), returnCode);
+ fprintf(stderr, "Executing %s returned %d\n", extractCommand.c_str(), returnCode);
+ fprintf(stderr, "%*s\n", int(extractErrorBuffer.size()), extractErrorBuffer.data());
+ error_exit("Aborting");
}
}
diff --git a/adb/client/fastdeploycallbacks.cpp b/adb/client/fastdeploycallbacks.cpp
index 6c9a21f..23a0aca 100644
--- a/adb/client/fastdeploycallbacks.cpp
+++ b/adb/client/fastdeploycallbacks.cpp
@@ -35,8 +35,7 @@
class DeployAgentBufferCallback : public StandardStreamsCallbackInterface {
public:
- DeployAgentBufferCallback(std::vector<char>* outBuffer, std::vector<char>* errBuffer,
- int* statusCode);
+ DeployAgentBufferCallback(std::vector<char>* outBuffer, std::vector<char>* errBuffer);
virtual void OnStdout(const char* buffer, int length);
virtual void OnStderr(const char* buffer, int length);
@@ -45,27 +44,17 @@
private:
std::vector<char>* mpOutBuffer;
std::vector<char>* mpErrBuffer;
- int* mpStatusCode;
};
int capture_shell_command(const char* command, std::vector<char>* outBuffer,
std::vector<char>* errBuffer) {
- int statusCode;
- DeployAgentBufferCallback cb(outBuffer, errBuffer, &statusCode);
- int ret = send_shell_command(command, false, &cb);
-
- if (ret == 0) {
- return statusCode;
- } else {
- return ret;
- }
+ DeployAgentBufferCallback cb(outBuffer, errBuffer);
+ return send_shell_command(command, false, &cb);
}
-DeployAgentFileCallback::DeployAgentFileCallback(FILE* outputFile, std::vector<char>* errBuffer,
- int* statusCode) {
+DeployAgentFileCallback::DeployAgentFileCallback(FILE* outputFile, std::vector<char>* errBuffer) {
mpOutFile = outputFile;
mpErrBuffer = errBuffer;
- mpStatusCode = statusCode;
mBytesWritten = 0;
}
@@ -84,10 +73,7 @@
}
int DeployAgentFileCallback::Done(int status) {
- if (mpStatusCode != NULL) {
- *mpStatusCode = status;
- }
- return 0;
+ return status;
}
int DeployAgentFileCallback::getBytesWritten() {
@@ -95,11 +81,9 @@
}
DeployAgentBufferCallback::DeployAgentBufferCallback(std::vector<char>* outBuffer,
- std::vector<char>* errBuffer,
- int* statusCode) {
+ std::vector<char>* errBuffer) {
mpOutBuffer = outBuffer;
mpErrBuffer = errBuffer;
- mpStatusCode = statusCode;
}
void DeployAgentBufferCallback::OnStdout(const char* buffer, int length) {
@@ -111,8 +95,5 @@
}
int DeployAgentBufferCallback::Done(int status) {
- if (mpStatusCode != NULL) {
- *mpStatusCode = status;
- }
- return 0;
+ return status;
}
diff --git a/adb/client/fastdeploycallbacks.h b/adb/client/fastdeploycallbacks.h
index b428b50..7e049c5 100644
--- a/adb/client/fastdeploycallbacks.h
+++ b/adb/client/fastdeploycallbacks.h
@@ -21,7 +21,7 @@
class DeployAgentFileCallback : public StandardStreamsCallbackInterface {
public:
- DeployAgentFileCallback(FILE* outputFile, std::vector<char>* errBuffer, int* statusCode);
+ DeployAgentFileCallback(FILE* outputFile, std::vector<char>* errBuffer);
virtual void OnStdout(const char* buffer, int length);
virtual void OnStderr(const char* buffer, int length);
@@ -33,7 +33,6 @@
FILE* mpOutFile;
std::vector<char>* mpErrBuffer;
int mBytesWritten;
- int* mpStatusCode;
};
int capture_shell_command(const char* command, std::vector<char>* outBuffer,
diff --git a/base/file.cpp b/base/file.cpp
index d5bb7fe..2f4a517 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -22,6 +22,7 @@
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/libprocinfo/include/procinfo/process_map.h b/libprocinfo/include/procinfo/process_map.h
index 0fc4201..981241e 100644
--- a/libprocinfo/include/procinfo/process_map.h
+++ b/libprocinfo/include/procinfo/process_map.h
@@ -17,6 +17,7 @@
#pragma once
#include <stdlib.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
diff --git a/libstats/include/stats_event_list.h b/libstats/include/stats_event_list.h
index a9832db..41ca79b 100644
--- a/libstats/include/stats_event_list.h
+++ b/libstats/include/stats_event_list.h
@@ -26,7 +26,7 @@
int write_to_logger(android_log_context context, log_id_t id);
void note_log_drop();
void stats_log_close();
-
+int android_log_write_char_array(android_log_context ctx, const char* value, size_t len);
#ifdef __cplusplus
}
#endif
@@ -244,6 +244,14 @@
return ret >= 0;
}
+ bool AppendCharArray(const char* value, size_t len) {
+ int retval = android_log_write_char_array(ctx, value, len);
+ if (retval < 0) {
+ ret = retval;
+ }
+ return ret >= 0;
+ }
+
android_log_list_element read() { return android_log_read_next(ctx); }
android_log_list_element peek() { return android_log_peek_next(ctx); }
};
diff --git a/libstats/stats_event_list.c b/libstats/stats_event_list.c
index 72770d4..f4a7e94 100644
--- a/libstats/stats_event_list.c
+++ b/libstats/stats_event_list.c
@@ -193,3 +193,47 @@
errno = save_errno;
return ret;
}
+
+static inline void copy4LE(uint8_t* buf, uint32_t val) {
+ buf[0] = val & 0xFF;
+ buf[1] = (val >> 8) & 0xFF;
+ buf[2] = (val >> 16) & 0xFF;
+ buf[3] = (val >> 24) & 0xFF;
+}
+
+// Note: this function differs from android_log_write_string8_len in that the length passed in
+// should be treated as actual length and not max length.
+int android_log_write_char_array(android_log_context ctx, const char* value, size_t actual_len) {
+ size_t needed;
+ ssize_t len = actual_len;
+ android_log_context_internal* context;
+
+ context = (android_log_context_internal*)ctx;
+ if (!context || (kAndroidLoggerWrite != context->read_write_flag)) {
+ return -EBADF;
+ }
+ if (context->overflow) {
+ return -EIO;
+ }
+ if (!value) {
+ value = "";
+ len = 0;
+ }
+ needed = sizeof(uint8_t) + sizeof(int32_t) + len;
+ if ((context->pos + needed) > MAX_EVENT_PAYLOAD) {
+ /* Truncate string for delivery */
+ len = MAX_EVENT_PAYLOAD - context->pos - 1 - sizeof(int32_t);
+ if (len <= 0) {
+ context->overflow = true;
+ return -EIO;
+ }
+ }
+ context->count[context->list_nest_depth]++;
+ context->storage[context->pos + 0] = EVENT_TYPE_STRING;
+ copy4LE(&context->storage[context->pos + 1], len);
+ if (len) {
+ memcpy(&context->storage[context->pos + 5], value, len);
+ }
+ context->pos += needed;
+ return len;
+}
diff --git a/libunwindstack/Global.cpp b/libunwindstack/Global.cpp
index 7a3de01..fdfd705 100644
--- a/libunwindstack/Global.cpp
+++ b/libunwindstack/Global.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <sys/mman.h>
#include <string>
diff --git a/libunwindstack/Maps.cpp b/libunwindstack/Maps.cpp
index 8729871..a9fb859 100644
--- a/libunwindstack/Maps.cpp
+++ b/libunwindstack/Maps.cpp
@@ -19,6 +19,7 @@
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/libunwindstack/Memory.cpp b/libunwindstack/Memory.cpp
index a30d65e..9904fef 100644
--- a/libunwindstack/Memory.cpp
+++ b/libunwindstack/Memory.cpp
@@ -16,6 +16,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <string.h>
#include <sys/mman.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
diff --git a/libunwindstack/RegsArm.cpp b/libunwindstack/RegsArm.cpp
index de22bde..885dc94 100644
--- a/libunwindstack/RegsArm.cpp
+++ b/libunwindstack/RegsArm.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <functional>
diff --git a/libunwindstack/RegsArm64.cpp b/libunwindstack/RegsArm64.cpp
index a68f6e0..e9787aa 100644
--- a/libunwindstack/RegsArm64.cpp
+++ b/libunwindstack/RegsArm64.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <functional>
diff --git a/libunwindstack/RegsMips.cpp b/libunwindstack/RegsMips.cpp
index 2e6908c..14a4e31 100644
--- a/libunwindstack/RegsMips.cpp
+++ b/libunwindstack/RegsMips.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <functional>
diff --git a/libunwindstack/RegsMips64.cpp b/libunwindstack/RegsMips64.cpp
index 0b835a1..3f67d92 100644
--- a/libunwindstack/RegsMips64.cpp
+++ b/libunwindstack/RegsMips64.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <functional>
diff --git a/libunwindstack/RegsX86_64.cpp b/libunwindstack/RegsX86_64.cpp
index ebad3f4..74cd1cb 100644
--- a/libunwindstack/RegsX86_64.cpp
+++ b/libunwindstack/RegsX86_64.cpp
@@ -15,6 +15,7 @@
*/
#include <stdint.h>
+#include <string.h>
#include <functional>
diff --git a/libunwindstack/Symbols.cpp b/libunwindstack/Symbols.cpp
index 14ebdbb..e3c15a2 100644
--- a/libunwindstack/Symbols.cpp
+++ b/libunwindstack/Symbols.cpp
@@ -17,6 +17,7 @@
#include <elf.h>
#include <stdint.h>
+#include <algorithm>
#include <string>
#include <unwindstack/Memory.h>
diff --git a/rootdir/etc/ld.config.txt b/rootdir/etc/ld.config.txt
index d3e80c9..de31629 100644
--- a/rootdir/etc/ld.config.txt
+++ b/rootdir/etc/ld.config.txt
@@ -38,7 +38,8 @@
###############################################################################
namespace.default.isolated = true
-namespace.default.search.paths = /system/${LIB}
+namespace.default.search.paths = /apex/com.android.resolv/${LIB}
+namespace.default.search.paths += /system/${LIB}
namespace.default.search.paths += /%PRODUCT%/${LIB}
namespace.default.search.paths += /%PRODUCT_SERVICES%/${LIB}
@@ -74,7 +75,8 @@
namespace.default.permitted.paths += /data
namespace.default.permitted.paths += /mnt/expand
-namespace.default.asan.search.paths = /data/asan/system/${LIB}
+namespace.default.asan.search.paths = /apex/com.android.resolv/${LIB}
+namespace.default.asan.search.paths += /data/asan/system/${LIB}
namespace.default.asan.search.paths += /system/${LIB}
namespace.default.asan.search.paths += /data/asan/product/${LIB}
namespace.default.asan.search.paths += /%PRODUCT%/${LIB}
diff --git a/rootdir/etc/ld.config.vndk_lite.txt b/rootdir/etc/ld.config.vndk_lite.txt
index 7e354ac..21d3642 100644
--- a/rootdir/etc/ld.config.vndk_lite.txt
+++ b/rootdir/etc/ld.config.vndk_lite.txt
@@ -38,13 +38,15 @@
###############################################################################
namespace.default.isolated = false
-namespace.default.search.paths = /system/${LIB}
+namespace.default.search.paths = /apex/com.android.resolv/${LIB}
+namespace.default.search.paths += /system/${LIB}
namespace.default.search.paths += /odm/${LIB}
namespace.default.search.paths += /vendor/${LIB}
namespace.default.search.paths += /%PRODUCT%/${LIB}
namespace.default.search.paths += /%PRODUCT_SERVICES%/${LIB}
-namespace.default.asan.search.paths = /data/asan/system/${LIB}
+namespace.default.asan.search.paths = /apex/com.android.resolv/${LIB}
+namespace.default.asan.search.paths += /data/asan/system/${LIB}
namespace.default.asan.search.paths += /system/${LIB}
namespace.default.asan.search.paths += /data/asan/odm/${LIB}
namespace.default.asan.search.paths += /odm/${LIB}