Merge "logd: add EXIT command"
am: 16300f192b
Change-Id: Idd68cfba26f8fcc928db4fe2483d30e5d4f49a59
This commit is contained in:
commit
2cfd0e08e9
2 changed files with 46 additions and 14 deletions
|
|
@ -48,6 +48,7 @@ CommandListener::CommandListener(LogBuffer *buf, LogReader * /*reader*/,
|
||||||
registerCmd(new SetPruneListCmd(buf));
|
registerCmd(new SetPruneListCmd(buf));
|
||||||
registerCmd(new GetPruneListCmd(buf));
|
registerCmd(new GetPruneListCmd(buf));
|
||||||
registerCmd(new ReinitCmd());
|
registerCmd(new ReinitCmd());
|
||||||
|
registerCmd(new ExitCmd(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandListener::ShutdownCmd::ShutdownCmd(LogReader *reader,
|
CommandListener::ShutdownCmd::ShutdownCmd(LogReader *reader,
|
||||||
|
|
@ -297,6 +298,21 @@ int CommandListener::ReinitCmd::runCommand(SocketClient *cli,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandListener::ExitCmd::ExitCmd(CommandListener *parent) :
|
||||||
|
LogCommand("EXIT"),
|
||||||
|
mParent(*parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int CommandListener::ExitCmd::runCommand(SocketClient * cli,
|
||||||
|
int /*argc*/, char ** /*argv*/) {
|
||||||
|
setname();
|
||||||
|
|
||||||
|
cli->sendMsg("success");
|
||||||
|
release(cli);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int CommandListener::getLogSocket() {
|
int CommandListener::getLogSocket() {
|
||||||
static const char socketName[] = "logd";
|
static const char socketName[] = "logd";
|
||||||
int sock = android_get_control_socket(socketName);
|
int sock = android_get_control_socket(socketName);
|
||||||
|
|
|
||||||
|
|
@ -52,22 +52,38 @@ private:
|
||||||
explicit name##Cmd(LogBuffer *buf); \
|
explicit name##Cmd(LogBuffer *buf); \
|
||||||
virtual ~name##Cmd() {} \
|
virtual ~name##Cmd() {} \
|
||||||
int runCommand(SocketClient *c, int argc, char ** argv); \
|
int runCommand(SocketClient *c, int argc, char ** argv); \
|
||||||
};
|
}
|
||||||
|
|
||||||
LogBufferCmd(Clear)
|
LogBufferCmd(Clear);
|
||||||
LogBufferCmd(GetBufSize)
|
LogBufferCmd(GetBufSize);
|
||||||
LogBufferCmd(SetBufSize)
|
LogBufferCmd(SetBufSize);
|
||||||
LogBufferCmd(GetBufSizeUsed)
|
LogBufferCmd(GetBufSizeUsed);
|
||||||
LogBufferCmd(GetStatistics)
|
LogBufferCmd(GetStatistics);
|
||||||
LogBufferCmd(GetPruneList)
|
LogBufferCmd(GetPruneList);
|
||||||
LogBufferCmd(SetPruneList)
|
LogBufferCmd(SetPruneList);
|
||||||
|
|
||||||
class ReinitCmd : public LogCommand {
|
#define LogCmd(name) \
|
||||||
public:
|
class name##Cmd : public LogCommand { \
|
||||||
ReinitCmd();
|
public: \
|
||||||
virtual ~ReinitCmd() {}
|
name##Cmd(); \
|
||||||
int runCommand(SocketClient *c, int argc, char ** argv);
|
virtual ~name##Cmd() {} \
|
||||||
};
|
int runCommand(SocketClient *c, int argc, char ** argv); \
|
||||||
|
}
|
||||||
|
|
||||||
|
LogCmd(Reinit);
|
||||||
|
|
||||||
|
#define LogParentCmd(name) \
|
||||||
|
class name##Cmd : public LogCommand { \
|
||||||
|
CommandListener &mParent; \
|
||||||
|
public: \
|
||||||
|
name##Cmd(); \
|
||||||
|
explicit name##Cmd(CommandListener *parent); \
|
||||||
|
virtual ~name##Cmd() {} \
|
||||||
|
int runCommand(SocketClient *c, int argc, char ** argv); \
|
||||||
|
void release(SocketClient *c) { mParent.release(c); } \
|
||||||
|
}
|
||||||
|
|
||||||
|
LogParentCmd(Exit);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue