Change lttng API to use a lttng_handle
[lttng-tools.git] / lttng / commands / stop.c
index 87862b4b905dcc049fd8c77703a9fd9693b02841..b40a63881b297188efc2a074bdefcd4a3c4cdcfa 100644 (file)
@@ -35,6 +35,8 @@ enum {
        OPT_HELP = 1,
 };
 
+static struct lttng_handle *handle;
+
 static struct poptOption long_options[] = {
        /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */
        {"help",      'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
@@ -56,9 +58,7 @@ static void usage(FILE *ofp)
 }
 
 /*
- *  stop_tracing
- *
- *  Start tracing for all trace of the session.
+ * Start tracing for all trace of the session.
  */
 static int stop_tracing(void)
 {
@@ -75,7 +75,13 @@ static int stop_tracing(void)
                session_name = opt_session_name;
        }
 
-       ret = lttng_stop_tracing(session_name);
+       handle = lttng_create_handle(session_name, NULL);
+       if (handle == NULL) {
+               ret = -1;
+               goto error;
+       }
+
+       ret = lttng_stop_tracing(handle);
        if (ret < 0) {
                goto free_name;
        }
@@ -86,7 +92,10 @@ free_name:
        if (opt_session_name == NULL) {
                free(session_name);
        }
+
 error:
+       lttng_destroy_handle(handle);
+
        return ret;
 }
 
This page took 0.023432 seconds and 4 git commands to generate.