am 56c6575d: Merge "logd: syscall optimization"
* commit '56c6575da72653c3ffd79baf1b431574d6f7e1ea': logd: syscall optimization
This commit is contained in:
commit
437a328a14
6 changed files with 21 additions and 7 deletions
|
|
@ -69,7 +69,11 @@ CommandListener::ClearCmd::ClearCmd(LogBuffer *buf)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
static void setname() {
|
static void setname() {
|
||||||
prctl(PR_SET_NAME, "logd.control");
|
static bool name_set;
|
||||||
|
if (!name_set) {
|
||||||
|
prctl(PR_SET_NAME, "logd.control");
|
||||||
|
name_set = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CommandListener::ClearCmd::runCommand(SocketClient *cli,
|
int CommandListener::ClearCmd::runCommand(SocketClient *cli,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
|
#include <private/android_filesystem_config.h>
|
||||||
#include <private/android_logger.h>
|
#include <private/android_logger.h>
|
||||||
|
|
||||||
#include "libaudit.h"
|
#include "libaudit.h"
|
||||||
|
|
@ -110,7 +111,7 @@ int LogAudit::logPrint(const char *fmt, ...) {
|
||||||
|
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
pid_t tid = gettid();
|
pid_t tid = gettid();
|
||||||
uid_t uid = getuid();
|
uid_t uid = AID_LOGD;
|
||||||
log_time now;
|
log_time now;
|
||||||
|
|
||||||
static const char audit_str[] = " audit(";
|
static const char audit_str[] = " audit(";
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include <cutils/sockets.h>
|
#include <cutils/sockets.h>
|
||||||
#include <log/logger.h>
|
#include <log/logger.h>
|
||||||
|
#include <private/android_filesystem_config.h>
|
||||||
#include <private/android_logger.h>
|
#include <private/android_logger.h>
|
||||||
|
|
||||||
#include "LogListener.h"
|
#include "LogListener.h"
|
||||||
|
|
@ -34,7 +35,11 @@ LogListener::LogListener(LogBuffer *buf, LogReader *reader)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool LogListener::onDataAvailable(SocketClient *cli) {
|
bool LogListener::onDataAvailable(SocketClient *cli) {
|
||||||
prctl(PR_SET_NAME, "logd.writer");
|
static bool name_set;
|
||||||
|
if (!name_set) {
|
||||||
|
prctl(PR_SET_NAME, "logd.writer");
|
||||||
|
name_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time)
|
char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time)
|
||||||
+ LOGGER_ENTRY_MAX_PAYLOAD];
|
+ LOGGER_ENTRY_MAX_PAYLOAD];
|
||||||
|
|
@ -75,7 +80,7 @@ bool LogListener::onDataAvailable(SocketClient *cli) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cred->uid == getuid()) {
|
if (cred->uid == AID_LOGD) {
|
||||||
// ignore log messages we send to ourself.
|
// ignore log messages we send to ourself.
|
||||||
// Such log messages are often generated by libraries we depend on
|
// Such log messages are often generated by libraries we depend on
|
||||||
// which use standard Android logging.
|
// which use standard Android logging.
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,11 @@ void LogReader::notifyNewLog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LogReader::onDataAvailable(SocketClient *cli) {
|
bool LogReader::onDataAvailable(SocketClient *cli) {
|
||||||
prctl(PR_SET_NAME, "logd.reader");
|
static bool name_set;
|
||||||
|
if (!name_set) {
|
||||||
|
prctl(PR_SET_NAME, "logd.reader");
|
||||||
|
name_set = true;
|
||||||
|
}
|
||||||
|
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -437,7 +437,7 @@ uid_t pidToUid(pid_t pid) {
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
return getuid(); // associate this with the logger
|
return AID_LOGD; // associate this with the logger
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <cutils/sched_policy.h>
|
#include <cutils/sched_policy.h>
|
||||||
#include <cutils/sockets.h>
|
#include <cutils/sockets.h>
|
||||||
|
#include <private/android_filesystem_config.h>
|
||||||
|
|
||||||
#include "private/android_filesystem_config.h"
|
|
||||||
#include "CommandListener.h"
|
#include "CommandListener.h"
|
||||||
#include "LogBuffer.h"
|
#include "LogBuffer.h"
|
||||||
#include "LogListener.h"
|
#include "LogListener.h"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue