Can't create a trace without a session ID for now.
Future works will create a session automatically.
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
static void sighandler(int sig);
static int set_signal_handler(void);
static int get_cmdline_by_pid(pid_t pid, char **cmdline);
static void sighandler(int sig);
static int set_signal_handler(void);
static int get_cmdline_by_pid(pid_t pid, char **cmdline);
+static int validate_options(void);
if (ret < 0) {
goto end;
}
if (ret < 0) {
goto end;
}
- MSG("Trace created successfully!\nUse --start PID to start tracing");
+ MSG("Trace created successfully!\nUse --start PID to start tracing.");
+/*
+ * validate_options
+ *
+ * Make sure that all options passed to the command line
+ * are compatible with each others.
+ *
+ * On error, return -1
+ * On success, return 0
+ */
+static int validate_options(void)
+{
+ if ((opt_session_uuid == NULL) &&
+ (opt_create_trace)) {
+ ERR("Can't create trace without a session ID.\nPlease specify using --session UUID");
+ goto error;
+ }
+
+ return 0;
+
+error:
+ return -1;
+}
+
clean_exit(EXIT_FAILURE);
}
clean_exit(EXIT_FAILURE);
}
+ ret = validate_options();
+ if (ret < 0) {
+ return EXIT_FAILURE;
+ }
+
ret = set_signal_handler();
if (ret < 0) {
clean_exit(ret);
ret = set_signal_handler();
if (ret < 0) {
clean_exit(ret);