]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
Parser: Remove excess debug prints
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 4 Jul 2010 13:30:53 +0000 (16:30 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 4 Jul 2010 13:30:53 +0000 (16:30 +0300)
These provide very little useful information at this point. Removing
them make the program more usable.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
parse.c

diff --git a/parse.c b/parse.c
index deb5dd2089c03619ab519587185eee4ea701bf7f..ff3b22c15cecde508f149694f80670194167e086 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -56,9 +56,6 @@ static struct maps *parse_maps(FILE *file, int pid)
                ret = sscanf(line, "%lx-%lx %*s %*s %*s %*s %s",
                             &start, &end, name);
 
-               printf("%x, start %lx, end %lx, str: %s\n",
-                       ret, start, end, ret >= 3 ? name : "");
-
                if (ret < 2) {
                        printf("Error reading input: %s\n", line);
                        break;
@@ -141,9 +138,6 @@ static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
                start = map->start >> (PAGE_SHIFT - 3);
                len = map->size >> (PAGE_SHIFT - 3);
 
-               printf("start: %lx len %lx: name: %s\n",
-                       start, len, map->name);
-
                ret = fseek(file, start, SEEK_SET);
                if (ret) {
                        error = errno;
@@ -156,9 +150,6 @@ static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
                        ret = fread(&pf, 1, sizeof(pf), file);
                        if (ret != sizeof(pf)) {
                                error = errno;
-                               fprintf(stderr, 
-                                       "Error reading %ld bytes, got %d: %s\n",
-                                       sizeof(pf), ret, strerror(errno));
                                continue;
                        }
                        if (!pageframe)
@@ -207,29 +198,25 @@ void read_pageframe(int pid, struct pageframe *pageframe, int add_to_tree)
 {
        struct maps *maps;
        FILE *file;
-       int error;
        char path[512];
 
        snprintf(path, sizeof(path), "/proc/%d/maps", pid);
        file = fopen(path, "rb");
 
        if (!file)
-               goto err_out;
+               return;
 
        maps = parse_maps(file, pid);
+       fclose(file);
 
        snprintf(path, sizeof(path), "/proc/%d/pagemap", pid);
        file = fopen(path, "rb");
 
        if (!file)
-               goto err_out;
+               return;
 
        parse_pageframe(file, pageframe, maps, add_to_tree);
-
-       return;
-err_out:
-       error = errno;
-       fprintf(stderr, "Failed to open file %s: %s\n", path, strerror(error));
+       fclose(file);
 
        return;
 }
@@ -259,7 +246,7 @@ restart:
                        return 0;
                }
                error = errno;
-               printf("Failed to read directory: %s\n", strerror(error));
+               printf("Failed to read /proc directory: %s\n", strerror(error));
                return -1;
        }