summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logd/CommandListener.cpp79
-rw-r--r--logd/FlushCommand.cpp16
-rw-r--r--logd/LogAudit.cpp12
-rw-r--r--logd/LogBuffer.cpp3
-rw-r--r--logd/LogBufferElement.cpp16
-rw-r--r--logd/LogCommand.cpp3
-rw-r--r--logd/LogKlog.cpp20
-rw-r--r--logd/LogListener.cpp10
-rw-r--r--logd/LogReader.cpp24
-rw-r--r--logd/LogStatistics.cpp3
-rw-r--r--logd/LogTimes.cpp35
-rw-r--r--logd/LogWhiteBlackList.cpp9
12 files changed, 111 insertions, 119 deletions
diff --git a/logd/CommandListener.cpp b/logd/CommandListener.cpp
index bdfed3b..5489cc9 100644
--- a/logd/CommandListener.cpp
+++ b/logd/CommandListener.cpp
@@ -33,9 +33,9 @@
#include "LogCommand.h"
CommandListener::CommandListener(LogBuffer *buf, LogReader * /*reader*/,
- LogListener * /*swl*/)
- : FrameworkListener(getLogSocket())
- , mBuf(*buf) {
+ LogListener * /*swl*/) :
+ FrameworkListener(getLogSocket()),
+ mBuf(*buf) {
// registerCmd(new ShutdownCmd(buf, writer, swl));
registerCmd(new ClearCmd(buf));
registerCmd(new GetBufSizeCmd(buf));
@@ -48,12 +48,12 @@ CommandListener::CommandListener(LogBuffer *buf, LogReader * /*reader*/,
}
CommandListener::ShutdownCmd::ShutdownCmd(LogBuffer *buf, LogReader *reader,
- LogListener *swl)
- : LogCommand("shutdown")
- , mBuf(*buf)
- , mReader(*reader)
- , mSwl(*swl)
-{ }
+ LogListener *swl) :
+ LogCommand("shutdown"),
+ mBuf(*buf),
+ mReader(*reader),
+ mSwl(*swl) {
+}
int CommandListener::ShutdownCmd::runCommand(SocketClient * /*cli*/,
int /*argc*/,
@@ -63,10 +63,10 @@ int CommandListener::ShutdownCmd::runCommand(SocketClient * /*cli*/,
exit(0);
}
-CommandListener::ClearCmd::ClearCmd(LogBuffer *buf)
- : LogCommand("clear")
- , mBuf(*buf)
-{ }
+CommandListener::ClearCmd::ClearCmd(LogBuffer *buf) :
+ LogCommand("clear"),
+ mBuf(*buf) {
+}
static void setname() {
static bool name_set;
@@ -100,10 +100,10 @@ int CommandListener::ClearCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::GetBufSizeCmd::GetBufSizeCmd(LogBuffer *buf)
- : LogCommand("getLogSize")
- , mBuf(*buf)
-{ }
+CommandListener::GetBufSizeCmd::GetBufSizeCmd(LogBuffer *buf) :
+ LogCommand("getLogSize"),
+ mBuf(*buf) {
+}
int CommandListener::GetBufSizeCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
@@ -126,10 +126,10 @@ int CommandListener::GetBufSizeCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::SetBufSizeCmd::SetBufSizeCmd(LogBuffer *buf)
- : LogCommand("setLogSize")
- , mBuf(*buf)
-{ }
+CommandListener::SetBufSizeCmd::SetBufSizeCmd(LogBuffer *buf) :
+ LogCommand("setLogSize"),
+ mBuf(*buf) {
+}
int CommandListener::SetBufSizeCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
@@ -160,10 +160,10 @@ int CommandListener::SetBufSizeCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::GetBufSizeUsedCmd::GetBufSizeUsedCmd(LogBuffer *buf)
- : LogCommand("getLogSizeUsed")
- , mBuf(*buf)
-{ }
+CommandListener::GetBufSizeUsedCmd::GetBufSizeUsedCmd(LogBuffer *buf) :
+ LogCommand("getLogSizeUsed"),
+ mBuf(*buf) {
+}
int CommandListener::GetBufSizeUsedCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
@@ -186,10 +186,10 @@ int CommandListener::GetBufSizeUsedCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::GetStatisticsCmd::GetStatisticsCmd(LogBuffer *buf)
- : LogCommand("getStatistics")
- , mBuf(*buf)
-{ }
+CommandListener::GetStatisticsCmd::GetStatisticsCmd(LogBuffer *buf) :
+ LogCommand("getStatistics"),
+ mBuf(*buf) {
+}
static void package_string(char **strp) {
const char *a = *strp;
@@ -243,10 +243,10 @@ int CommandListener::GetStatisticsCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::GetPruneListCmd::GetPruneListCmd(LogBuffer *buf)
- : LogCommand("getPruneList")
- , mBuf(*buf)
-{ }
+CommandListener::GetPruneListCmd::GetPruneListCmd(LogBuffer *buf) :
+ LogCommand("getPruneList"),
+ mBuf(*buf) {
+}
int CommandListener::GetPruneListCmd::runCommand(SocketClient *cli,
int /*argc*/, char ** /*argv*/) {
@@ -263,10 +263,10 @@ int CommandListener::GetPruneListCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::SetPruneListCmd::SetPruneListCmd(LogBuffer *buf)
- : LogCommand("setPruneList")
- , mBuf(*buf)
-{ }
+CommandListener::SetPruneListCmd::SetPruneListCmd(LogBuffer *buf) :
+ LogCommand("setPruneList"),
+ mBuf(*buf) {
+}
int CommandListener::SetPruneListCmd::runCommand(SocketClient *cli,
int argc, char **argv) {
@@ -301,9 +301,8 @@ int CommandListener::SetPruneListCmd::runCommand(SocketClient *cli,
return 0;
}
-CommandListener::ReinitCmd::ReinitCmd()
- : LogCommand("reinit")
-{ }
+CommandListener::ReinitCmd::ReinitCmd() : LogCommand("reinit") {
+}
int CommandListener::ReinitCmd::runCommand(SocketClient *cli,
int /*argc*/, char ** /*argv*/) {
diff --git a/logd/FlushCommand.cpp b/logd/FlushCommand.cpp
index 26a1861..d584925 100644
--- a/logd/FlushCommand.cpp
+++ b/logd/FlushCommand.cpp
@@ -27,14 +27,14 @@ FlushCommand::FlushCommand(LogReader &reader,
unsigned long tail,
unsigned int logMask,
pid_t pid,
- uint64_t start)
- : mReader(reader)
- , mNonBlock(nonBlock)
- , mTail(tail)
- , mLogMask(logMask)
- , mPid(pid)
- , mStart(start)
-{ }
+ uint64_t start) :
+ mReader(reader),
+ mNonBlock(nonBlock),
+ mTail(tail),
+ mLogMask(logMask),
+ mPid(pid),
+ mStart(start) {
+}
// runSocketCommand is called once for every open client on the
// log reader socket. Here we manage and associated the reader
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
index 09cdb18..4ec2e59 100644
--- a/logd/LogAudit.cpp
+++ b/logd/LogAudit.cpp
@@ -37,12 +37,12 @@
'0' + LOG_MAKEPRI(LOG_AUTH, LOG_PRI(PRI)) % 10, \
'>'
-LogAudit::LogAudit(LogBuffer *buf, LogReader *reader, int fdDmesg)
- : SocketListener(getLogSocket(), false)
- , logbuf(buf)
- , reader(reader)
- , fdDmesg(fdDmesg)
- , initialized(false) {
+LogAudit::LogAudit(LogBuffer *buf, LogReader *reader, int fdDmesg) :
+ SocketListener(getLogSocket(), false),
+ logbuf(buf),
+ reader(reader),
+ fdDmesg(fdDmesg),
+ initialized(false) {
static const char auditd_message[] = { KMSG_PRIORITY(LOG_INFO),
'l', 'o', 'g', 'd', '.', 'a', 'u', 'd', 'i', 't', 'd', ':',
' ', 's', 't', 'a', 'r', 't', '\n' };
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp
index b6b6124..c33dca6 100644
--- a/logd/LogBuffer.cpp
+++ b/logd/LogBuffer.cpp
@@ -126,8 +126,7 @@ void LogBuffer::init() {
}
}
-LogBuffer::LogBuffer(LastLogTimes *times)
- : mTimes(*times) {
+LogBuffer::LogBuffer(LastLogTimes *times) : mTimes(*times) {
pthread_mutex_init(&mLogElementsLock, NULL);
init();
diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp
index 164faa9..f98d5cd 100644
--- a/logd/LogBufferElement.cpp
+++ b/logd/LogBufferElement.cpp
@@ -34,14 +34,14 @@ atomic_int_fast64_t LogBufferElement::sequence;
LogBufferElement::LogBufferElement(log_id_t log_id, log_time realtime,
uid_t uid, pid_t pid, pid_t tid,
- const char *msg, unsigned short len)
- : mLogId(log_id)
- , mUid(uid)
- , mPid(pid)
- , mTid(tid)
- , mMsgLen(len)
- , mSequence(sequence.fetch_add(1, memory_order_relaxed))
- , mRealTime(realtime) {
+ const char *msg, unsigned short len) :
+ mLogId(log_id),
+ mUid(uid),
+ mPid(pid),
+ mTid(tid),
+ mMsgLen(len),
+ mSequence(sequence.fetch_add(1, memory_order_relaxed)),
+ mRealTime(realtime) {
mMsg = new char[len];
memcpy(mMsg, msg, len);
}
diff --git a/logd/LogCommand.cpp b/logd/LogCommand.cpp
index b78c0e0..06d865c 100644
--- a/logd/LogCommand.cpp
+++ b/logd/LogCommand.cpp
@@ -23,8 +23,7 @@
#include "LogCommand.h"
-LogCommand::LogCommand(const char *cmd)
- : FrameworkCommand(cmd) {
+LogCommand::LogCommand(const char *cmd) : FrameworkCommand(cmd) {
}
// gets a list of supplementary group IDs associated with
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index 35fe3a5..8df0d0a 100644
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -38,16 +38,16 @@ static const char priority_message[] = { KMSG_PRIORITY(LOG_INFO), '\0' };
log_time LogKlog::correction = log_time(CLOCK_REALTIME) - log_time(CLOCK_MONOTONIC);
-LogKlog::LogKlog(LogBuffer *buf, LogReader *reader, int fdWrite, int fdRead, bool auditd)
- : SocketListener(fdRead, false)
- , logbuf(buf)
- , reader(reader)
- , signature(CLOCK_MONOTONIC)
- , fdWrite(fdWrite)
- , fdRead(fdRead)
- , initialized(false)
- , enableLogging(true)
- , auditd(auditd) {
+LogKlog::LogKlog(LogBuffer *buf, LogReader *reader, int fdWrite, int fdRead, bool auditd) :
+ SocketListener(fdRead, false),
+ logbuf(buf),
+ reader(reader),
+ signature(CLOCK_MONOTONIC),
+ fdWrite(fdWrite),
+ fdRead(fdRead),
+ initialized(false),
+ enableLogging(true),
+ auditd(auditd) {
static const char klogd_message[] = "%slogd.klogd: %" PRIu64 "\n";
char buffer[sizeof(priority_message) + sizeof(klogd_message) + 20 - 4];
snprintf(buffer, sizeof(buffer), klogd_message, priority_message,
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index 17b6e6f..b29f5ab 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -28,11 +28,11 @@
#include "LogListener.h"
-LogListener::LogListener(LogBuffer *buf, LogReader *reader)
- : SocketListener(getLogSocket(), false)
- , logbuf(buf)
- , reader(reader)
-{ }
+LogListener::LogListener(LogBuffer *buf, LogReader *reader) :
+ SocketListener(getLogSocket(), false),
+ logbuf(buf),
+ reader(reader) {
+}
bool LogListener::onDataAvailable(SocketClient *cli) {
static bool name_set;
diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp
index 745e847..c7deec0 100644
--- a/logd/LogReader.cpp
+++ b/logd/LogReader.cpp
@@ -24,10 +24,10 @@
#include "LogReader.h"
#include "FlushCommand.h"
-LogReader::LogReader(LogBuffer *logbuf)
- : SocketListener(getLogSocket(), true)
- , mLogbuf(*logbuf)
-{ }
+LogReader::LogReader(LogBuffer *logbuf) :
+ SocketListener(getLogSocket(), true),
+ mLogbuf(*logbuf) {
+}
// When we are notified a new log entry is available, inform
// all of our listening sockets.
@@ -116,14 +116,14 @@ bool LogReader::onDataAvailable(SocketClient *cli) {
uint64_t last;
public:
- LogFindStart(unsigned logMask, pid_t pid, log_time &start, uint64_t &sequence)
- : mPid(pid)
- , mLogMask(logMask)
- , startTimeSet(false)
- , start(start)
- , sequence(sequence)
- , last(sequence)
- { }
+ LogFindStart(unsigned logMask, pid_t pid, log_time &start, uint64_t &sequence) :
+ mPid(pid),
+ mLogMask(logMask),
+ startTimeSet(false),
+ start(start),
+ sequence(sequence),
+ last(sequence) {
+ }
static int callback(const LogBufferElement *element, void *obj) {
LogFindStart *me = reinterpret_cast<LogFindStart *>(obj);
diff --git a/logd/LogStatistics.cpp b/logd/LogStatistics.cpp
index 9756b2d..675b692 100644
--- a/logd/LogStatistics.cpp
+++ b/logd/LogStatistics.cpp
@@ -26,8 +26,7 @@
#include "LogStatistics.h"
-LogStatistics::LogStatistics()
- : enable(false) {
+LogStatistics::LogStatistics() : enable(false) {
log_id_for_each(id) {
mSizes[id] = 0;
mElements[id] = 0;
diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp
index 1b60b7e..ec67c07 100644
--- a/logd/LogTimes.cpp
+++ b/logd/LogTimes.cpp
@@ -26,24 +26,23 @@ pthread_mutex_t LogTimeEntry::timesLock = PTHREAD_MUTEX_INITIALIZER;
LogTimeEntry::LogTimeEntry(LogReader &reader, SocketClient *client,
bool nonBlock, unsigned long tail,
unsigned int logMask, pid_t pid,
- uint64_t start)
- : mRefCount(1)
- , mRelease(false)
- , mError(false)
- , threadRunning(false)
- , mReader(reader)
- , mLogMask(logMask)
- , mPid(pid)
- , mCount(0)
- , mTail(tail)
- , mIndex(0)
- , mClient(client)
- , mStart(start)
- , mNonBlock(nonBlock)
- , mEnd(LogBufferElement::getCurrentSequence())
-{
- pthread_cond_init(&threadTriggeredCondition, NULL);
- cleanSkip_Locked();
+ uint64_t start) :
+ mRefCount(1),
+ mRelease(false),
+ mError(false),
+ threadRunning(false),
+ mReader(reader),
+ mLogMask(logMask),
+ mPid(pid),
+ mCount(0),
+ mTail(tail),
+ mIndex(0),
+ mClient(client),
+ mStart(start),
+ mNonBlock(nonBlock),
+ mEnd(LogBufferElement::getCurrentSequence()) {
+ pthread_cond_init(&threadTriggeredCondition, NULL);
+ cleanSkip_Locked();
}
void LogTimeEntry::startReader_Locked(void) {
diff --git a/logd/LogWhiteBlackList.cpp b/logd/LogWhiteBlackList.cpp
index bee940d..277b3ca 100644
--- a/logd/LogWhiteBlackList.cpp
+++ b/logd/LogWhiteBlackList.cpp
@@ -22,10 +22,8 @@
// White and Black list
-Prune::Prune(uid_t uid, pid_t pid)
- : mUid(uid)
- , mPid(pid)
-{ }
+Prune::Prune(uid_t uid, pid_t pid) : mUid(uid), mPid(pid) {
+}
int Prune::cmp(uid_t uid, pid_t pid) const {
if ((mUid == uid_all) || (mUid == uid)) {
@@ -51,8 +49,7 @@ void Prune::format(char **strp) {
}
}
-PruneList::PruneList()
- : mWorstUidEnabled(true) {
+PruneList::PruneList() : mWorstUidEnabled(true) {
mNaughty.clear();
mNice.clear();
}