/** * This is where recorder and the repalyer start */ int main(int argc, char* argv[], char** envp) { int option = INVALID; /* allocate memory for the arguments that are passed to the * client application. This is the first thing that has to be * done to ensure that the pointers that are passed to the client * are the same in the recorder/replayer.*/ alloc_argc(argc); alloc_envp(envp); alloc_executable(); //TODO: add parsing/checking of arguments if (strncmp("--record", argv[1], 7) == 0) { option = RECORD; } else if (strncmp("--replay", argv[1], 7) == 0) { option = REPLAY; } if (option > 0) { start(option, argc, argv, envp); } else { print_usage(); } return 0; }
/** * This is where recorder and the replayer start */ int main(int argc, char* argv[], char** envp) { int argi; /* index of first positional argument */ assert_prerequisites(); if (parse_args(argc, argv, &__rr_flags, &argi) || argc <= argi) { print_usage(); return 1; } if (RECORD == __rr_flags.option) { log_info("Scheduler using max_events=%d, max_rbc=%d", __rr_flags.max_events, __rr_flags.max_rbc); if (!__rr_flags.use_syscall_buffer) { log_info("Syscall buffer disabled by flag"); } else if (!is_seccomp_bpf_available()) { log_warn("seccomp-bpf not available on this system; syscall buffer disabled"); } else { /* We rely on the distribution package or the * user to set up the LD_LIBRARY_PATH properly * so that we can LD_PRELOAD the bare library * name. Trying to do otherwise is possible, * but annoying. */ __rr_flags.syscall_buffer_lib_path = SYSCALLBUF_LIB_FILENAME; } } /* allocate memory for the arguments that are passed to the * client application. This is the first thing that has to be * done to ensure that the pointers that are passed to the client * are the same in the recorder/replayer.*/ alloc_argc(argc); alloc_envp(envp); alloc_executable(); start(argc - argi , argv + argi, envp); return 0; }