• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

Revisionf894b96a9211dcefb83b175720b53a2e49b8e463 (tree)
Zeit2016-08-23 05:02:45
AutorTim Murray <timmurray@goog...>
CommiterTim Murray

Log Message

Restrict pmsg use to eng builds.

bug 30375418

Change-Id: I50c6c74a2373593495cf6a3b94b31f9a865c950c

Ändern Zusammenfassung

Diff

--- a/liblog/pmsg_writer.c
+++ b/liblog/pmsg_writer.c
@@ -31,6 +31,8 @@
3131 #include <private/android_filesystem_config.h>
3232 #include <private/android_logger.h>
3333
34+#include <sys/system_properties.h>
35+
3436 #include "config_write.h"
3537 #include "log_portability.h"
3638 #include "logger.h"
@@ -51,8 +53,25 @@ LIBLOG_HIDDEN struct android_log_transport_write pmsgLoggerWrite = {
5153 .write = pmsgWrite,
5254 };
5355
56+static bool pmsgShouldUse = false;
57+
58+// Only use pmsg on eng builds
59+static bool pmsgIsEng() {
60+ char buf[PROP_VALUE_MAX];
61+
62+ if (__system_property_get("ro.build.type", buf) == 0) {
63+ return false;
64+ }
65+
66+ if (!strncmp(buf, "eng", sizeof("eng"))) {
67+ return true;
68+ }
69+ return false;
70+}
71+
5472 static int pmsgOpen()
5573 {
74+ pmsgShouldUse = pmsgIsEng();
5675 if (pmsgLoggerWrite.context.fd < 0) {
5776 pmsgLoggerWrite.context.fd = TEMP_FAILURE_RETRY(open("/dev/pmsg0", O_WRONLY | O_CLOEXEC));
5877 }
@@ -75,7 +94,7 @@ static int pmsgAvailable(log_id_t logId)
7594 }
7695 if ((logId != LOG_ID_SECURITY) &&
7796 (logId != LOG_ID_EVENTS) &&
78- !__android_log_is_debuggable()) {
97+ (!pmsgShouldUse || !__android_log_is_debuggable())) {
7998 return -EINVAL;
8099 }
81100 if (pmsgLoggerWrite.context.fd < 0) {
@@ -105,7 +124,7 @@ static int pmsgWrite(log_id_t logId, struct timespec *ts,
105124 size_t i, payloadSize;
106125 ssize_t ret;
107126
108- if ((logId == LOG_ID_EVENTS) && !__android_log_is_debuggable()) {
127+ if ((logId == LOG_ID_EVENTS) && (!pmsgShouldUse || !__android_log_is_debuggable())) {
109128 if (vec[0].iov_len < 4) {
110129 return -EINVAL;
111130 }