summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2015-03-17 09:56:32 -0500
committerMark Salyzyn2015-04-01 14:41:59 -0500
commite3aeeeeccc260c29ca5907a444f8d746bcc2f8a5 (patch)
treed03d386d0804bb07a175bd9e74aefd0a64aa2a68 /logd/LogListener.cpp
parent221554749337a9c961c192596be5eb4e42083733 (diff)
downloadplatform-system-core-e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5.tar.gz
platform-system-core-e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5.tar.xz
platform-system-core-e3aeeeeccc260c29ca5907a444f8d746bcc2f8a5.zip
logd: syscall optimization
- prset(PR_SET_NAME) call once - No need to call getuid(), should be AID_LOGD Change-Id: I4dde0b178bc84e711b355cd7677b0dbf905a0634
Diffstat (limited to 'logd/LogListener.cpp')
-rw-r--r--logd/LogListener.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index fc9e30ff4..3b4ef8822 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -23,6 +23,7 @@
23 23
24#include <cutils/sockets.h> 24#include <cutils/sockets.h>
25#include <log/logger.h> 25#include <log/logger.h>
26#include <private/android_filesystem_config.h>
26#include <private/android_logger.h> 27#include <private/android_logger.h>
27 28
28#include "LogListener.h" 29#include "LogListener.h"
@@ -34,7 +35,11 @@ LogListener::LogListener(LogBuffer *buf, LogReader *reader)
34{ } 35{ }
35 36
36bool LogListener::onDataAvailable(SocketClient *cli) { 37bool LogListener::onDataAvailable(SocketClient *cli) {
37 prctl(PR_SET_NAME, "logd.writer"); 38 static bool name_set;
39 if (!name_set) {
40 prctl(PR_SET_NAME, "logd.writer");
41 name_set = true;
42 }
38 43
39 char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time) 44 char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time)
40 + LOGGER_ENTRY_MAX_PAYLOAD]; 45 + LOGGER_ENTRY_MAX_PAYLOAD];
@@ -75,7 +80,7 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
75 return false; 80 return false;
76 } 81 }
77 82
78 if (cred->uid == getuid()) { 83 if (cred->uid == AID_LOGD) {
79 // ignore log messages we send to ourself. 84 // ignore log messages we send to ourself.
80 // Such log messages are often generated by libraries we depend on 85 // Such log messages are often generated by libraries we depend on
81 // which use standard Android logging. 86 // which use standard Android logging.