From e9f607873c5e57a4a1823772c9b8606007b5a836 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 21 Jun 2019 08:37:29 -0700 Subject: [PATCH] edits --- main.cc | 7 ++++++- params.h | 3 ++- snapshot.cc | 7 ++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/main.cc b/main.cc index 7ce43cbf..df8b8776 100644 --- a/main.cc +++ b/main.cc @@ -22,6 +22,7 @@ static void param_defaults(struct model_params *params) params->verbose = !!DBG_ENABLED(); params->uninitvalue = 0; params->maxexecutions = 10; + params->nofork = false; } static void print_usage(const char *program_name, struct model_params *params) @@ -54,6 +55,7 @@ static void print_usage(const char *program_name, struct model_params *params) "-x, --maxexec=NUM Maximum number of executions.\n" " Default: %u\n" " -o help for a list of options\n" + "-n No fork\n" " -- Program arguments follow.\n\n", program_name, params->verbose, @@ -84,7 +86,7 @@ bool install_plugin(char * name) { static void parse_options(struct model_params *params, int argc, char **argv) { - const char *shortopts = "ht:o:u:x:v::"; + const char *shortopts = "hnt:o:u:x:v::"; const struct option longopts[] = { {"help", no_argument, NULL, 'h'}, {"verbose", optional_argument, NULL, 'v'}, @@ -101,6 +103,9 @@ static void parse_options(struct model_params *params, int argc, char **argv) case 'h': print_usage(argv[0], params); break; + case 'n': + params->nofork = true; + break; case 'x': params->maxexecutions = atoi(optarg); break; diff --git a/params.h b/params.h index c190066b..7f5c2192 100644 --- a/params.h +++ b/params.h @@ -8,7 +8,8 @@ struct model_params { unsigned int uninitvalue; int maxexecutions; - + bool nofork; + /** @brief Verbosity (0 = quiet; 1 = noisy; 2 = noisier) */ int verbose; diff --git a/snapshot.cc b/snapshot.cc index ca54c785..b4944f45 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -12,6 +12,7 @@ #include "mymemory.h" #include "common.h" #include "context.h" +#include "model.h" /** PageAlignedAdressUpdate return a page aligned address for the * address being added as a side effect the numBytes are also changed. @@ -383,7 +384,11 @@ static void fork_snapshot_init(unsigned int numbackingpages, /* switch back here when takesnapshot is called */ snapshotid = fork_snap->currSnapShotID; - + if (model->params.nofork) { + setcontext(&fork_snap->shared_ctxt); + exit(EXIT_SUCCESS); + } + while (true) { pid_t forkedID; fork_snap->currSnapShotID = snapshotid + 1; -- 2.34.1