]> git.itanic.dy.fi Git - scan-pagemap/blobdiff - main.c
Scan threads only when requested
[scan-pagemap] / main.c
diff --git a/main.c b/main.c
index 22a6a6d0f580f37b00c106738824d3b0c6e299f6..4ac6ccbe45aa7c4e37440bea506ced2c43badb78 100644 (file)
--- a/main.c
+++ b/main.c
@@ -18,12 +18,15 @@ void print_help_and_die(char *name)
        exit(0);
 }
 
+#define OPT_WITH_THREADS       0x101
+
 void read_args(int argc, char *argv[], struct parse_opts *opts)
 {
        int optind = 0, c;
        static struct option long_options[] = {
                { .val = 'p', .name = "pid", .has_arg = 1, },
                { .val = 'm', .name = "map", .has_arg = 1, },
+               { .val = OPT_WITH_THREADS, .name = "with-threads" },
                { .val = 'h', .name = "help", },
        };
        char short_options[] = "p:m:h";
@@ -36,6 +39,7 @@ void read_args(int argc, char *argv[], struct parse_opts *opts)
                if (c == -1)
                        break;
 
+               printf("%c: %s\n", c, optarg);
                switch (c) {
                case 'p':
                        opts->pid = atoi(optarg);
@@ -45,6 +49,9 @@ void read_args(int argc, char *argv[], struct parse_opts *opts)
                        opts->parse_mask |= PARSE_MAP_NAME;
                        opts->map_name = optarg;
                        break;
+               case OPT_WITH_THREADS:
+                       opts->with_threads = 1;
+                       break;
                case 'h':
                        print_help_and_die(argv[0]);
                }