Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0b3f9567 authored by Tom Cherry's avatar Tom Cherry Committed by Gerrit Code Review
Browse files

Merge changes I5731d640,Ia874b57a

* changes:
  logd: make LogBuffer an interface
  logd: refactor LastLogTimes a bit
parents b6a6023b d5b3838d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,11 +33,12 @@ cc_library_static {

    srcs: [
        "LogCommand.cpp",
        "ChattyLogBuffer.cpp",
        "CommandListener.cpp",
        "LogListener.cpp",
        "LogReader.cpp",
        "LogReaderList.cpp",
        "LogReaderThread.cpp",
        "LogBuffer.cpp",
        "LogBufferElement.cpp",
        "LogStatistics.cpp",
        "LogWhiteBlackList.cpp",
+99 −143

File changed and moved.

Preview size limit exceeded, changes collapsed.

logd/ChattyLogBuffer.h

0 → 100644
+97 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −4
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ int CommandListener::ClearCmd::runCommand(SocketClient* cli, int argc,
        return 0;
    }

    cli->sendMsg(buf()->clear((log_id_t)id, uid) ? "busy" : "success");
    cli->sendMsg(buf()->Clear((log_id_t)id, uid) ? "busy" : "success");
    return 0;
}

@@ -99,7 +99,7 @@ int CommandListener::GetBufSizeCmd::runCommand(SocketClient* cli, int argc,
        return 0;
    }

    unsigned long size = buf()->getSize((log_id_t)id);
    unsigned long size = buf()->GetSize((log_id_t)id);
    char buf[512];
    snprintf(buf, sizeof(buf), "%lu", size);
    cli->sendMsg(buf);
@@ -126,7 +126,7 @@ int CommandListener::SetBufSizeCmd::runCommand(SocketClient* cli, int argc,
    }

    unsigned long size = atol(argv[2]);
    if (buf()->setSize((log_id_t)id, size)) {
    if (buf()->SetSize((log_id_t)id, size)) {
        cli->sendMsg("Range Error");
        return 0;
    }
@@ -299,7 +299,7 @@ int CommandListener::ReinitCmd::runCommand(SocketClient* cli, int /*argc*/,
    setname();

    android::prdebug("logd reinit");
    buf()->init();
    buf()->Init();
    prune()->init(nullptr);

    // This only works on userdebug and eng devices to re-read the
+5 −10
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@
#include <private/android_logger.h>

#include "LogKlog.h"
#include "LogReader.h"
#include "LogUtils.h"
#include "libaudit.h"

@@ -45,10 +44,9 @@
    '<', '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) / 10, \
        '0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) % 10, '>'

LogAudit::LogAudit(LogBuffer* buf, LogReader* reader, int fdDmesg, LogStatistics* stats)
LogAudit::LogAudit(LogBuffer* buf, int fdDmesg, LogStatistics* stats)
    : SocketListener(getLogSocket(), false),
      logbuf(buf),
      reader(reader),
      fdDmesg(fdDmesg),
      main(__android_logger_property_get_bool("ro.logd.auditd.main", BOOL_DEFAULT_TRUE)),
      events(__android_logger_property_get_bool("ro.logd.auditd.events", BOOL_DEFAULT_TRUE)),
@@ -276,8 +274,7 @@ int LogAudit::logPrint(const char* fmt, ...) {
        memcpy(event->data + str_len - denial_metadata.length(),
               denial_metadata.c_str(), denial_metadata.length());

        rc = logbuf->log(
            LOG_ID_EVENTS, now, uid, pid, tid, reinterpret_cast<char*>(event),
        rc = logbuf->Log(LOG_ID_EVENTS, now, uid, pid, tid, reinterpret_cast<char*>(event),
                         (message_len <= UINT16_MAX) ? (uint16_t)message_len : UINT16_MAX);
        if (rc >= 0) {
            notify |= 1 << LOG_ID_EVENTS;
@@ -330,8 +327,7 @@ int LogAudit::logPrint(const char* fmt, ...) {
        strncpy(newstr + 1 + str_len + prefix_len + suffix_len,
                denial_metadata.c_str(), denial_metadata.length());

        rc = logbuf->log(
            LOG_ID_MAIN, now, uid, pid, tid, newstr,
        rc = logbuf->Log(LOG_ID_MAIN, now, uid, pid, tid, newstr,
                         (message_len <= UINT16_MAX) ? (uint16_t)message_len : UINT16_MAX);

        if (rc >= 0) {
@@ -344,7 +340,6 @@ int LogAudit::logPrint(const char* fmt, ...) {
    free(str);

    if (notify) {
        reader->notifyNewLog(notify);
        if (rc < 0) {
            rc = message_len;
        }
Loading