X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=3bc709a68ad2deeb573584297146f468277e8643;hb=46f44e2a0813922f2687464d6190d663e56c2711;hp=157d9a4335af5b5d52b3fcc7be942b4f2d77719a;hpb=53e367f936beb2f9a1f49f6a2920c2f58bcb08d7;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 157d9a433..3bc709a68 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -736,9 +736,16 @@ int lttng_add_context(struct lttng_handle *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: @@ -1809,13 +1816,13 @@ error: return ret; } -int lttng_event_get_filter_string(struct lttng_event *event, - const char **filter_string) +int lttng_event_get_filter_expression(struct lttng_event *event, + const char **filter_expression) { int ret = 0; struct lttcomm_event_extended_header *ext_header; - if (!event || !filter_string) { + if (!event || !filter_expression) { ret = -LTTNG_ERR_INVALID; goto end; } @@ -1827,15 +1834,15 @@ int lttng_event_get_filter_string(struct lttng_event *event, * This can happen since the lttng_event structure is * used for other tasks where this pointer is never set. */ - *filter_string = NULL; + *filter_expression = NULL; goto end; } if (ext_header->filter_len) { - *filter_string = ((const char *) (ext_header)) + - sizeof(*ext_header); + *filter_expression = ((const char *) (ext_header)) + + sizeof(*ext_header); } else { - *filter_string = NULL; + *filter_expression = NULL; } end: @@ -2374,6 +2381,36 @@ int lttng_list_tracker_pids(struct lttng_handle *handle, return 0; } +/* + * 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 ret; + struct lttcomm_session_msg lsm; + + if (!session_name) { + ret = -LTTNG_ERR_INVALID; + goto end; + } + + memset(&lsm, 0, sizeof(lsm)); + lsm.cmd_type = LTTNG_METADATA_REGENERATE; + + lttng_ctl_copy_string(lsm.session.name, session_name, + sizeof(lsm.session.name)); + + ret = lttng_ctl_ask_sessiond(&lsm, NULL); + if (ret < 0) { + goto end; + } + + ret = 0; +end: + return ret; +} + /* * lib constructor. */