X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=2abcdf48eb5f161e207d48288c07cfa781116b2f;hb=e8f7fa117487c9b57f5a9699364c3bebf53c5cec;hp=39e824bdef7e4fc10fae81cafc8f2882d4a13e81;hpb=3e6e0df2f8f9f23d252c2508b6d741916dfcc4b3;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 39e824bde..2abcdf48e 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4342,6 +4342,15 @@ int cmd_register_trigger(struct command_ctx *cmd_ctx, int sock, } } + /* + * The bytecode generation also serves as a validation step for the + * bytecode expressions. + */ + ret = lttng_trigger_generate_bytecode(trigger, &cmd_creds); + if (ret != LTTNG_OK) { + goto end; + } + /* * A reference to the trigger is acquired by the notification thread. * It is safe to return the same trigger to the caller since it the @@ -4450,6 +4459,29 @@ end: return ret; } +int cmd_list_triggers(struct command_ctx *cmd_ctx, + struct notification_thread_handle *notification_thread, + struct lttng_triggers **return_triggers) +{ + int ret = 0; + enum lttng_error_code ret_code; + struct lttng_triggers *triggers = NULL; + + /* Get the set of triggers from the notification thread. */ + ret_code = notification_thread_command_list_triggers( + notification_thread, cmd_ctx->creds.uid, &triggers); + if (ret_code != LTTNG_OK) { + ret = ret_code; + goto end; + } + + *return_triggers = triggers; + triggers = NULL; + ret = LTTNG_OK; +end: + lttng_triggers_destroy(triggers); + return ret; +} /* * Send relayd sockets from snapshot output to consumer. Ignore request if the * snapshot output is *not* set with a remote destination.