#include "shared/util.h"
#include "shared/log.h"
-#define DLOG_BACKEND_PATH "/run/dloginit.conf"
-
#define FILE_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH)
static struct dump_item {
const char *title;
return percent;
}
-static bool dlogutil_supported(void)
-{
- FILE *fp;
- char buf[32];
-
- fp = fopen(DLOG_BACKEND_PATH, "r");
- if (!fp) {
- _E("cannot open dlog backend file(errno:%d)", errno);
- return false;
- }
-
- if(!fgets(buf, sizeof(buf), fp)) {
- _E("Failed to read dlog backend");
- fclose(fp);
- return false;
- }
-
- fclose(fp);
-
- if (!strncmp(buf, "LOG_TYPE=journal", 16))
- return false;
-
- return true;
-}
-
int main(int argc, char *argv[]) {
int c, ret, i, is_root, dpercent;
const char *arg_file = NULL;
}
if (arg_dlog) {
- if (dlogutil_supported()) {
- fprintf_fd(out_fd, "\n==== main log messages (/dev/log_main)\n");
- ret = run_command_write_fd("/usr/bin/dlogutil -d -v dump -b main", out_fd);
- if (ret < 0)
- goto exit_close;
-
- if(is_root) {
- fprintf_fd(out_fd, "\n==== system log messages (/dev/log_system)\n");
- ret = run_command_write_fd("/usr/bin/dlogutil -d -v dump -b system", out_fd);
- if (ret < 0)
- goto exit_close;
-
- fprintf_fd(out_fd, "\n==== radio log messages (/dev/log_radio)\n");
- ret = run_command_write_fd("/usr/bin/dlogutil -d -v dump -b radio", out_fd);
- if (ret < 0)
- goto exit_close;
- }
- } else {
- fprintf_fd(out_fd, "\n==== Log messages (journalctl)\n");
- ret = run_command_write_fd("/usr/bin/journalctl", out_fd);
- if (ret < 0)
- goto exit_close;
- }
+ fprintf_fd(out_fd, "\n==== Log messages\n");
+ ret = run_command_write_fd("/usr/bin/dlogutil -d -v threadtime", out_fd);
+ if (ret < 0)
+ goto exit_close;
}
exit_close: