API change for lttng_destroy_session prototype
authorDavid Goulet <david.goulet@polymtl.ca>
Tue, 6 Dec 2011 19:43:41 +0000 (14:43 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Tue, 6 Dec 2011 19:57:31 +0000 (14:57 -0500)
Now takes a session name and no lttng_handle anymore.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
include/lttng/lttng.h
liblttngctl/lttngctl.c
lttng/commands/destroy.c
tests/lttng/kernel_all_events_basic.c
tests/lttng/kernel_event_basic.c

index a137a4385218c91f176c14f1dc83e06b66390119..5654eb79ffc69c9d144cd1cee1fb666d18041e9d 100644 (file)
@@ -242,7 +242,7 @@ extern int lttng_create_session(const char *name, const char *path);
  * The session will not be useable anymore, tracing will stopped for all
  * registered trace and tracing buffers will be flushed.
  */
-extern int lttng_destroy_session(struct lttng_handle *handle);
+extern int lttng_destroy_session(const char *name);
 
 /*
  * List all tracing sessions.
index 9c3735f38f9a2896b2f4e0d611adef2a682e76ca..48e82def7570ef225c6b83de8f3962fe858c6c7f 100644 (file)
@@ -666,17 +666,17 @@ int lttng_create_session(const char *name, const char *path)
 /*
  *  Destroy session using name.
  */
-int lttng_destroy_session(struct lttng_handle *handle)
+int lttng_destroy_session(const char *session_name)
 {
        struct lttcomm_session_msg lsm;
 
-       if (handle == NULL) {
+       if (session_name == NULL) {
                return -1;
        }
 
        lsm.cmd_type = LTTNG_DESTROY_SESSION;
-       copy_string(lsm.session.name, handle->session_name,
-                       sizeof(lsm.session.name));
+
+       copy_string(lsm.session.name, session_name, sizeof(lsm.session.name));
 
        return ask_sessiond(&lsm, NULL);
 }
index 3b02a53eee41fe9eea8e8c1b2472f640404db86b..151686ff9061b157fa9b33aadd8c6924550e534b 100644 (file)
@@ -30,7 +30,6 @@
 #include "../utils.h"
 
 static char *opt_session_name;
-static struct lttng_handle *handle;
 
 enum {
        OPT_HELP = 1,
@@ -57,10 +56,8 @@ static void usage(FILE *ofp)
 }
 
 /*
- *  destroy_session
- *
- *  Destroy a session removing the config directory and unregistering to the
- *  session daemon.
+ * Destroy a session removing the config directory and unregistering to the
+ * session daemon.
  */
 static int destroy_session()
 {
@@ -77,13 +74,7 @@ static int destroy_session()
                session_name = opt_session_name;
        }
 
-       handle = lttng_create_handle(session_name, NULL);
-       if (handle == NULL) {
-               ret = -1;
-               goto error;
-       }
-
-       ret = lttng_destroy_session(handle);
+       ret = lttng_destroy_session(session_name);
        if (ret < 0) {
                goto free_name;
        }
@@ -108,15 +99,11 @@ free_name:
                free(session_name);
        }
 error:
-       lttng_destroy_handle(handle);
-
        return ret;
 }
 
 /*
- *  cmd_destroy
- *
- *  The 'destroy <options>' first level command
+ * The 'destroy <options>' first level command
  */
 int cmd_destroy(int argc, const char **argv)
 {
index 52546287f8be9bb97202087a5be0a2264bd680c9..eb46decaee58b100fde99d2a6cae0b2ace415cae 100644 (file)
@@ -93,7 +93,7 @@ int main(int argc, char **argv)
        PRINT_OK();
 
        printf("Destroy tracing session: ");
-       if ((ret = lttng_destroy_session(handle)) < 0) {
+       if ((ret = lttng_destroy_session("test")) < 0) {
                printf("error destroying session: %s\n", lttng_strerror(ret));
        }
        PRINT_OK();
@@ -108,7 +108,7 @@ handle_fail:
 stop_fail:
 start_fail:
 enable_fail:
-       lttng_destroy_session(handle);
+       lttng_destroy_session("test");
        lttng_destroy_handle(handle);
 
     return 1;
index 255557148ca8ff627e5677a7237dce23a353444e..d45b5e4f98cacc3abbfe2c8a97dcc2d44a06ba28 100644 (file)
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
        PRINT_OK();
 
        printf("Destroy tracing session: ");
-       if ((ret = lttng_destroy_session(handle)) < 0) {
+       if ((ret = lttng_destroy_session(session_name)) < 0) {
                printf("error destroying session: %s\n", lttng_strerror(ret));
        }
        PRINT_OK();
@@ -175,7 +175,7 @@ handle_fail:
 stop_fail:
 start_fail:
 enable_fail:
-       lttng_destroy_session(handle);
+       lttng_destroy_session(session_name);
        lttng_destroy_handle(handle);
 
     return 1;
This page took 0.029156 seconds and 4 git commands to generate.