diff options
Diffstat (limited to 'logd')
-rw-r--r-- | logd/CommandListener.cpp | 12 | ||||
-rw-r--r-- | logd/LogAudit.cpp | 3 | ||||
-rw-r--r-- | logd/LogListener.cpp | 3 | ||||
-rw-r--r-- | logd/LogReader.cpp | 3 | ||||
-rw-r--r-- | logd/LogTimes.cpp | 4 |
5 files changed, 25 insertions, 0 deletions
diff --git a/logd/CommandListener.cpp b/logd/CommandListener.cpp index a7bf92b..1f3fd0e 100644 --- a/logd/CommandListener.cpp +++ b/logd/CommandListener.cpp @@ -21,6 +21,7 @@ #include <netinet/in.h> #include <string.h> #include <stdlib.h> +#include <sys/prctl.h> #include <sys/socket.h> #include <sys/types.h> @@ -66,8 +67,13 @@ CommandListener::ClearCmd::ClearCmd(LogBuffer *buf) , mBuf(*buf) { } +static void setname() { + prctl(PR_SET_NAME, "logd.control"); +} + int CommandListener::ClearCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); if (!clientHasLogCredentials(cli)) { cli->sendMsg("Permission Denied"); return 0; @@ -96,6 +102,7 @@ CommandListener::GetBufSizeCmd::GetBufSizeCmd(LogBuffer *buf) int CommandListener::GetBufSizeCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); if (argc < 2) { cli->sendMsg("Missing Argument"); return 0; @@ -121,6 +128,7 @@ CommandListener::SetBufSizeCmd::SetBufSizeCmd(LogBuffer *buf) int CommandListener::SetBufSizeCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); if (!clientHasLogCredentials(cli)) { cli->sendMsg("Permission Denied"); return 0; @@ -154,6 +162,7 @@ CommandListener::GetBufSizeUsedCmd::GetBufSizeUsedCmd(LogBuffer *buf) int CommandListener::GetBufSizeUsedCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); if (argc < 2) { cli->sendMsg("Missing Argument"); return 0; @@ -197,6 +206,7 @@ static void package_string(char **strp) { int CommandListener::GetStatisticsCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); uid_t uid = cli->getUid(); gid_t gid = cli->getGid(); if (clientHasLogCredentials(cli)) { @@ -236,6 +246,7 @@ CommandListener::GetPruneListCmd::GetPruneListCmd(LogBuffer *buf) int CommandListener::GetPruneListCmd::runCommand(SocketClient *cli, int /*argc*/, char ** /*argv*/) { + setname(); char *buf = NULL; mBuf.formatPrune(&buf); if (!buf) { @@ -255,6 +266,7 @@ CommandListener::SetPruneListCmd::SetPruneListCmd(LogBuffer *buf) int CommandListener::SetPruneListCmd::runCommand(SocketClient *cli, int argc, char **argv) { + setname(); if (!clientHasLogCredentials(cli)) { cli->sendMsg("Permission Denied"); return 0; diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp index ea6eece..1056ae4 100644 --- a/logd/LogAudit.cpp +++ b/logd/LogAudit.cpp @@ -19,6 +19,7 @@ #include <stdarg.h> #include <stdlib.h> #include <sys/klog.h> +#include <sys/prctl.h> #include <sys/uio.h> #include "libaudit.h" @@ -34,6 +35,8 @@ LogAudit::LogAudit(LogBuffer *buf, LogReader *reader, int fdDmsg) } bool LogAudit::onDataAvailable(SocketClient *cli) { + prctl(PR_SET_NAME, "logd.auditd"); + struct audit_message rep; if (audit_get_reply(cli->getSocket(), &rep, GET_REPLY_BLOCKING, 0) < 0) { diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp index 1d0a51c..bc7622b 100644 --- a/logd/LogListener.cpp +++ b/logd/LogListener.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <sys/prctl.h> #include <sys/socket.h> #include <sys/types.h> #include <sys/un.h> @@ -31,6 +32,8 @@ LogListener::LogListener(LogBuffer *buf, LogReader *reader) { } bool LogListener::onDataAvailable(SocketClient *cli) { + prctl(PR_SET_NAME, "logd.writer"); + char buffer[sizeof_log_id_t + sizeof(uint16_t) + sizeof(log_time) + LOGGER_ENTRY_MAX_PAYLOAD]; struct iovec iov = { buffer, sizeof(buffer) }; diff --git a/logd/LogReader.cpp b/logd/LogReader.cpp index 51aa2ad..8458c19 100644 --- a/logd/LogReader.cpp +++ b/logd/LogReader.cpp @@ -16,6 +16,7 @@ #include <ctype.h> #include <poll.h> +#include <sys/prctl.h> #include <sys/socket.h> #include <cutils/sockets.h> @@ -36,6 +37,8 @@ void LogReader::notifyNewLog() { } bool LogReader::onDataAvailable(SocketClient *cli) { + prctl(PR_SET_NAME, "logd.reader"); + char buffer[255]; int len = read(cli->getSocket(), buffer, sizeof(buffer) - 1); diff --git a/logd/LogTimes.cpp b/logd/LogTimes.cpp index c32ac2d..1a9a548 100644 --- a/logd/LogTimes.cpp +++ b/logd/LogTimes.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <sys/prctl.h> + #include "FlushCommand.h" #include "LogBuffer.h" #include "LogTimes.h" @@ -107,6 +109,8 @@ void LogTimeEntry::threadStop(void *obj) { } void *LogTimeEntry::threadStart(void *obj) { + prctl(PR_SET_NAME, "logd.reader.per"); + LogTimeEntry *me = reinterpret_cast<LogTimeEntry *>(obj); pthread_cleanup_push(threadStop, obj); |