Merge "Retire the emulator workaround"
diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp
index 67ee676..084003e 100644
--- a/logcat/logcat.cpp
+++ b/logcat/logcat.cpp
@@ -794,91 +794,6 @@
}
break;
- case 'Q':
-#define LOGCAT_FILTER "androidboot.logcat="
-#define CONSOLE_PIPE_OPTION "androidboot.consolepipe="
-#define CONSOLE_OPTION "androidboot.console="
-#define QEMU_PROPERTY "ro.kernel.qemu"
-#define QEMU_CMDLINE "qemu.cmdline"
- // This is a *hidden* option used to start a version of logcat
- // in an emulated device only. It basically looks for
- // androidboot.logcat= on the kernel command line. If
- // something is found, it extracts a log filter and uses it to
- // run the program. The logcat output will go to consolepipe if
- // androiboot.consolepipe (e.g. qemu_pipe) is given, otherwise,
- // it goes to androidboot.console (e.g. tty)
- {
- // if not in emulator, exit quietly
- if (false == android::base::GetBoolProperty(QEMU_PROPERTY, false)) {
- return EXIT_SUCCESS;
- }
-
- std::string cmdline = android::base::GetProperty(QEMU_CMDLINE, "");
- if (cmdline.empty()) {
- android::base::ReadFileToString("/proc/cmdline", &cmdline);
- }
-
- const char* logcatFilter = strstr(cmdline.c_str(), LOGCAT_FILTER);
- // if nothing found or invalid filters, exit quietly
- if (!logcatFilter) {
- return EXIT_SUCCESS;
- }
-
- const char* p = logcatFilter + strlen(LOGCAT_FILTER);
- const char* q = strpbrk(p, " \t\n\r");
- if (!q) q = p + strlen(p);
- forceFilters = std::string(p, q);
-
- // redirect our output to the emulator console pipe or console
- const char* consolePipe =
- strstr(cmdline.c_str(), CONSOLE_PIPE_OPTION);
- const char* console =
- strstr(cmdline.c_str(), CONSOLE_OPTION);
-
- if (consolePipe) {
- p = consolePipe + strlen(CONSOLE_PIPE_OPTION);
- } else if (console) {
- p = console + strlen(CONSOLE_OPTION);
- } else {
- return EXIT_FAILURE;
- }
-
- q = strpbrk(p, " \t\n\r");
- int len = q ? q - p : strlen(p);
- std::string devname = "/dev/" + std::string(p, len);
- std::string pipePurpose("pipe:logcat");
- if (consolePipe) {
- // example: "qemu_pipe,pipe:logcat"
- // upon opening of /dev/qemu_pipe, the "pipe:logcat"
- // string with trailing '\0' should be written to the fd
- size_t pos = devname.find(',');
- if (pos != std::string::npos) {
- pipePurpose = devname.substr(pos + 1);
- devname = devname.substr(0, pos);
- }
- }
-
- fprintf(stderr, "logcat using %s\n", devname.c_str());
-
- int fd = open(devname.c_str(), O_WRONLY | O_CLOEXEC);
- if (fd < 0) {
- break;
- }
-
- if (consolePipe) {
- // need the trailing '\0'
- if (!WriteFully(fd, pipePurpose.c_str(), pipePurpose.size() + 1)) {
- close(fd);
- return EXIT_FAILURE;
- }
- }
- // close output and error channels, replace with console
- dup2(fd, output_fd_.get());
- dup2(fd, STDERR_FILENO);
- close(fd);
- }
- break;
-
case 'S':
printStatistics = true;
break;