logd: remove class LogCommand, rename LogCommand.cpp to LogPermissions.cpp
class LogCommand isn't needed, so remove it. Since the rest of LogCommand.cpp only has to do with permissions, rename it appropriately. Test: logging unit tests Change-Id: I32d09c74d00b6e50083e46832eca3dd886b46682
This commit is contained in:
parent
227dd4f807
commit
4e9bf955d6
|
@ -32,10 +32,10 @@ cc_library_static {
|
|||
name: "liblogd",
|
||||
|
||||
srcs: [
|
||||
"LogCommand.cpp",
|
||||
"ChattyLogBuffer.cpp",
|
||||
"CommandListener.cpp",
|
||||
"LogListener.cpp",
|
||||
"LogPermissions.cpp",
|
||||
"LogReader.cpp",
|
||||
"LogReaderList.cpp",
|
||||
"LogReaderThread.cpp",
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include <private/android_filesystem_config.h>
|
||||
#include <sysutils/SocketClient.h>
|
||||
|
||||
#include "LogUtils.h"
|
||||
#include "LogPermissions.h"
|
||||
|
||||
CommandListener::CommandListener(LogBuffer* buf, LogTags* tags, PruneList* prune,
|
||||
LogStatistics* stats)
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <sysutils/FrameworkCommand.h>
|
||||
#include <sysutils/FrameworkListener.h>
|
||||
|
||||
#include "LogBuffer.h"
|
||||
#include "LogCommand.h"
|
||||
#include "LogListener.h"
|
||||
#include "LogStatistics.h"
|
||||
#include "LogTags.h"
|
||||
|
@ -38,20 +38,20 @@ class CommandListener : public FrameworkListener {
|
|||
PruneList* prune_;
|
||||
LogStatistics* stats_;
|
||||
|
||||
#define LogCmd(name, command_string) \
|
||||
class name##Cmd : public LogCommand { \
|
||||
public: \
|
||||
explicit name##Cmd(CommandListener* parent) \
|
||||
: LogCommand(#command_string), parent_(parent) {} \
|
||||
virtual ~name##Cmd() {} \
|
||||
int runCommand(SocketClient* c, int argc, char** argv); \
|
||||
\
|
||||
private: \
|
||||
LogBuffer* buf() const { return parent_->buf_; } \
|
||||
LogTags* tags() const { return parent_->tags_; } \
|
||||
PruneList* prune() const { return parent_->prune_; } \
|
||||
LogStatistics* stats() const { return parent_->stats_; } \
|
||||
CommandListener* parent_; \
|
||||
#define LogCmd(name, command_string) \
|
||||
class name##Cmd : public FrameworkCommand { \
|
||||
public: \
|
||||
explicit name##Cmd(CommandListener* parent) \
|
||||
: FrameworkCommand(#command_string), parent_(parent) {} \
|
||||
virtual ~name##Cmd() {} \
|
||||
int runCommand(SocketClient* c, int argc, char** argv); \
|
||||
\
|
||||
private: \
|
||||
LogBuffer* buf() const { return parent_->buf_; } \
|
||||
LogTags* tags() const { return parent_->tags_; } \
|
||||
PruneList* prune() const { return parent_->prune_; } \
|
||||
LogStatistics* stats() const { return parent_->stats_; } \
|
||||
CommandListener* parent_; \
|
||||
}
|
||||
|
||||
LogCmd(Clear, clear);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <log/log_read.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include "LogCommand.h"
|
||||
#include "LogStatistics.h"
|
||||
#include "LogUtils.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
#include "LogBuffer.h"
|
||||
#include "LogListener.h"
|
||||
#include "LogUtils.h"
|
||||
#include "LogPermissions.h"
|
||||
|
||||
LogListener::LogListener(LogBuffer* buf) : socket_(GetLogSocket()), logbuf_(buf) {}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "LogPermissions.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -21,12 +23,6 @@
|
|||
|
||||
#include <private/android_filesystem_config.h>
|
||||
|
||||
#include "LogCommand.h"
|
||||
#include "LogUtils.h"
|
||||
|
||||
LogCommand::LogCommand(const char* cmd) : FrameworkCommand(cmd) {
|
||||
}
|
||||
|
||||
// gets a list of supplementary group IDs associated with
|
||||
// the socket peer. This is implemented by opening
|
||||
// /proc/PID/status and look for the "Group:" line.
|
|
@ -14,17 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LOGD_COMMAND_H
|
||||
#define _LOGD_COMMAND_H
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sysutils/FrameworkCommand.h>
|
||||
#include <sysutils/SocketClient.h>
|
||||
|
||||
class LogCommand : public FrameworkCommand {
|
||||
public:
|
||||
explicit LogCommand(const char* cmd);
|
||||
virtual ~LogCommand() {
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
bool clientHasLogCredentials(uid_t uid, gid_t gid, pid_t pid);
|
||||
bool clientHasLogCredentials(SocketClient* cli);
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "LogBuffer.h"
|
||||
#include "LogBufferElement.h"
|
||||
#include "LogPermissions.h"
|
||||
#include "LogReader.h"
|
||||
#include "LogUtils.h"
|
||||
#include "LogWriter.h"
|
||||
|
|
|
@ -60,10 +60,6 @@ static inline const char* strnstr(const char* s, ssize_t len,
|
|||
}
|
||||
}
|
||||
|
||||
// Furnished in LogCommand.cpp
|
||||
bool clientHasLogCredentials(uid_t uid, gid_t gid, pid_t pid);
|
||||
bool clientHasLogCredentials(SocketClient* cli);
|
||||
|
||||
static inline bool worstUidEnabledForLogid(log_id_t id) {
|
||||
return (id == LOG_ID_MAIN) || (id == LOG_ID_SYSTEM) ||
|
||||
(id == LOG_ID_RADIO) || (id == LOG_ID_EVENTS);
|
||||
|
|
Loading…
Reference in New Issue