Now takes a session name and no lttng_handle anymore.
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
* 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.
/*
* 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);
}
#include "../utils.h"
static char *opt_session_name;
-static struct lttng_handle *handle;
enum {
OPT_HELP = 1,
}
/*
- * 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()
{
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;
}
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)
{
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();
stop_fail:
start_fail:
enable_fail:
- lttng_destroy_session(handle);
+ lttng_destroy_session("test");
lttng_destroy_handle(handle);
return 1;
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();
stop_fail:
start_fail:
enable_fail:
- lttng_destroy_session(handle);
+ lttng_destroy_session(session_name);
lttng_destroy_handle(handle);
return 1;