{
struct lttng_handle *handle = NULL;
- if (domain == NULL) {
- goto end;
- }
-
handle = zmalloc(sizeof(struct lttng_handle));
if (handle == NULL) {
PERROR("malloc handle");
lttng_ctl_copy_string(handle->session_name, session_name,
sizeof(handle->session_name));
- /* Copy lttng domain */
- lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+ /* Copy lttng domain or leave initialized to 0. */
+ if (domain) {
+ lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+ }
end:
return handle;
memcpy(buf + provider_len, ctx_name, ctx_len);
}
memcpy(&lsm.u.context.ctx, ctx, sizeof(struct lttng_event_context));
- /* Don't leak application addresses to the sessiond. */
- lsm.u.context.ctx.u.app_ctx.provider_name = NULL;
- lsm.u.context.ctx.u.app_ctx.ctx_name = NULL;
+
+ if (ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
+ /*
+ * Don't leak application addresses to the sessiond.
+ * This is only necessary when ctx is for an app ctx otherwise
+ * the values inside the union (type & config) are overwritten.
+ */
+ lsm.u.context.ctx.u.app_ctx.provider_name = NULL;
+ lsm.u.context.ctx.u.app_ctx.ctx_name = NULL;
+ }
ret = lttng_ctl_ask_sessiond_varlen_no_cmd_header(&lsm, buf, len, NULL);
end:
* Destroy session using name.
* Returns size of returned session payload data or a negative error code.
*/
+static
int _lttng_destroy_session(const char *session_name)
{
struct lttcomm_session_msg lsm;
* Regenerate the metadata for a session.
* Return 0 on success, a negative error code on error.
*/
-int lttng_metadata_regenerate(const char *session_name)
+int lttng_regenerate_metadata(const char *session_name)
{
int ret;
struct lttcomm_session_msg lsm;
}
memset(&lsm, 0, sizeof(lsm));
- lsm.cmd_type = LTTNG_METADATA_REGENERATE;
+ lsm.cmd_type = LTTNG_REGENERATE_METADATA;
lttng_ctl_copy_string(lsm.session.name, session_name,
sizeof(lsm.session.name));
return ret;
}
+/*
+ * Deprecated, replaced by lttng_regenerate_metadata.
+ */
+int lttng_metadata_regenerate(const char *session_name)
+{
+ return lttng_regenerate_metadata(session_name);
+}
+
/*
* lib constructor.
*/
-static void __attribute__((constructor)) init()
+static void __attribute__((constructor)) init(void)
{
/* Set default session group */
lttng_set_tracing_group(DEFAULT_TRACING_GROUP);
/*
* lib destructor.
*/
-static void __attribute__((destructor)) lttng_ctl_exit()
+static void __attribute__((destructor)) lttng_ctl_exit(void)
{
free(tracing_group);
}