summaryrefslogtreecommitdiffstats
path: root/cmds/dumpstate/utils.c
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-07-22 16:08:19 -0700
committerChristopher Ferris <cferris@google.com>2014-07-23 19:18:07 -0700
commit7dc7f3221f26b771c266a26ec785eb74287922f1 (patch)
tree9fe39e5a72da651d45f2a430e21f1f7c60a95abe /cmds/dumpstate/utils.c
parent2cbba477bea136698944ece498115dbddd7bb659 (diff)
downloadframeworks_native-7dc7f3221f26b771c266a26ec785eb74287922f1.zip
frameworks_native-7dc7f3221f26b771c266a26ec785eb74287922f1.tar.gz
frameworks_native-7dc7f3221f26b771c266a26ec785eb74287922f1.tar.bz2
Add dumping of tombstones to dumpstate.
Dump only those tombstones modified within the last half an hour. Change-Id: I8ce836b2e19eba7a9c0c31a4f312f9a382526da7
Diffstat (limited to 'cmds/dumpstate/utils.c')
-rw-r--r--cmds/dumpstate/utils.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index 7694adb..a6d9ef6 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -249,8 +249,7 @@ void do_showmap(int pid, const char *name) {
}
/* prints the contents of a file */
-int dump_file(const char *title, const char* path) {
- char buffer[32768];
+int dump_file(const char *title, const char *path) {
int fd = open(path, O_RDONLY);
if (fd < 0) {
int err = errno;
@@ -259,6 +258,11 @@ int dump_file(const char *title, const char* path) {
if (title) printf("\n");
return -1;
}
+ return dump_file_from_fd(title, path, fd);
+}
+
+int dump_file_from_fd(const char *title, const char *path, int fd) {
+ char buffer[32768];
if (title) printf("------ %s (%s", title, path);
@@ -282,8 +286,8 @@ int dump_file(const char *title, const char* path) {
}
if (ret <= 0) break;
}
-
close(fd);
+
if (!newline) printf("\n");
if (title) printf("\n");
return 0;