X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=ff57a0d1a7a70237e396274b8a4847f1194beb3d;hb=c0d10b4f0e9d89a9163471e73ccc1903a3166d3f;hp=c5aada5bec9b46af9e26ce74c606f1a74553a2bf;hpb=6e911cad03751b6814fddd65b19a592acdc2b7b7;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index c5aada5be..ff57a0d1a 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -919,10 +919,10 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle, sizeof(lsm.u.enable.channel_name)); } - if (ev->name[0] != '\0') { - lsm.cmd_type = LTTNG_ENABLE_EVENT; - } else { - lsm.cmd_type = LTTNG_ENABLE_ALL_EVENT; + lsm.cmd_type = LTTNG_ENABLE_EVENT; + if (ev->name[0] == '\0') { + /* Enable all events */ + lttng_ctl_copy_string(ev->name, "*", sizeof(ev->name)); } lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain); @@ -1081,10 +1081,10 @@ int lttng_disable_event_ext(struct lttng_handle *handle, sizeof(lsm.u.disable.channel_name)); } - if (ev->name[0] != '\0') { - lsm.cmd_type = LTTNG_DISABLE_EVENT; - } else { - lsm.cmd_type = LTTNG_DISABLE_ALL_EVENT; + lsm.cmd_type = LTTNG_DISABLE_EVENT; + if (ev->name[0] == '\0') { + /* Disable all events */ + lttng_ctl_copy_string(ev->name, "*", sizeof(ev->name)); } lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain); @@ -1323,6 +1323,35 @@ int lttng_list_tracepoint_fields(struct lttng_handle *handle, return ret / sizeof(struct lttng_event_field); } +/* + * Lists all available kernel system calls. Allocates and sets the contents of + * the events array. + * + * Returns the number of lttng_event entries in events; on error, returns a + * negative value. + */ +int lttng_list_syscalls(struct lttng_event **events) +{ + int ret; + struct lttcomm_session_msg lsm; + + if (!events) { + return -LTTNG_ERR_INVALID; + } + + memset(&lsm, 0, sizeof(lsm)); + lsm.cmd_type = LTTNG_LIST_SYSCALLS; + /* Force kernel domain for system calls. */ + lsm.domain.type = LTTNG_DOMAIN_KERNEL; + + ret = lttng_ctl_ask_sessiond(&lsm, (void **) events); + if (ret < 0) { + return ret; + } + + return ret / sizeof(struct lttng_event); +} + /* * Returns a human readable string describing * the error code (a negative value).