X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=5bf00be8536f12cb124fd0d828486344b75734b7;hb=8c93562f396a3e785c5193ca32b40f1f16599a6a;hp=69dfda6a3bf384813cc62189c2299348e12929b5;hpb=f1613f52941de629d913f7945cac7447d164728a;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 69dfda6a3..5bf00be85 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -305,6 +305,9 @@ static int list_lttng_ust_global_events(char *channel_name, if (uevent->filter) { tmp[i].filter = 1; } + if (uevent->exclusion) { + tmp[i].exclusion = 1; + } i++; } @@ -1436,6 +1439,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, assert(usess); /* Create the default JUL tracepoint. */ + memset(&uevent, 0, sizeof(uevent)); uevent.type = LTTNG_EVENT_TRACEPOINT; uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name)); @@ -1457,7 +1461,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, /* The wild card * means that everything should be enabled. */ if (strncmp(event->name, "*", 1) == 0 && strlen(event->name) == 1) { - ret = event_jul_enable_all(usess); + ret = event_jul_enable_all(usess, event); } else { ret = event_jul_enable(usess, event); } @@ -1641,7 +1645,7 @@ int cmd_enable_event_all(struct ltt_session *session, } case LTTNG_DOMAIN_JUL: { - struct lttng_event uevent; + struct lttng_event uevent, event; struct lttng_domain tmp_dom; struct ltt_ust_session *usess = session->ust_session; @@ -1667,7 +1671,12 @@ int cmd_enable_event_all(struct ltt_session *session, goto error; } - ret = event_jul_enable_all(usess); + event.loglevel = LTTNG_LOGLEVEL_JUL_ALL; + event.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; + strncpy(event.name, "*", sizeof(event.name)); + event.name[sizeof(event.name) - 1] = '\0'; + + ret = event_jul_enable_all(usess, &event); if (ret != LTTNG_OK) { goto error; } @@ -1770,6 +1779,7 @@ error: int cmd_start_trace(struct ltt_session *session) { int ret; + unsigned long nb_chan = 0; struct ltt_kernel_session *ksession; struct ltt_ust_session *usess; @@ -1785,6 +1795,21 @@ int cmd_start_trace(struct ltt_session *session) goto error; } + /* + * Starting a session without channel is useless since after that it's not + * possible to enable channel thus inform the client. + */ + if (usess && usess->domain_global.channels) { + nb_chan += lttng_ht_get_count(usess->domain_global.channels); + } + if (ksession) { + nb_chan += ksession->channel_count; + } + if (!nb_chan) { + ret = LTTNG_ERR_NO_CHANNEL; + goto error; + } + session->enabled = 1; /* Kernel tracing */ @@ -2144,7 +2169,14 @@ int cmd_calibrate(int domain, struct lttng_calibrate *calibrate) { struct lttng_kernel_calibrate kcalibrate; - kcalibrate.type = calibrate->type; + switch (calibrate->type) { + case LTTNG_CALIBRATE_FUNCTION: + default: + /* Default and only possible calibrate option. */ + kcalibrate.type = LTTNG_KERNEL_CALIBRATE_KRETPROBE; + break; + } + ret = kernel_calibrate(kernel_tracer_fd, &kcalibrate); if (ret < 0) { ret = LTTNG_ERR_KERN_ENABLE_FAIL; @@ -2156,7 +2188,14 @@ int cmd_calibrate(int domain, struct lttng_calibrate *calibrate) { struct lttng_ust_calibrate ucalibrate; - ucalibrate.type = calibrate->type; + switch (calibrate->type) { + case LTTNG_CALIBRATE_FUNCTION: + default: + /* Default and only possible calibrate option. */ + ucalibrate.type = LTTNG_UST_CALIBRATE_TRACEPOINT; + break; + } + ret = ust_app_calibrate_glb(&ucalibrate); if (ret < 0) { ret = LTTNG_ERR_UST_CALIBRATE_FAIL; @@ -2829,12 +2868,17 @@ static int record_ust_snapshot(struct ltt_ust_session *usess, ret = ust_app_snapshot_record(usess, output, wait, nb_streams); if (ret < 0) { - if (ret == -EINVAL) { + switch (-ret) { + case EINVAL: ret = LTTNG_ERR_INVALID; - goto error_snapshot; + break; + case ENODATA: + ret = LTTNG_ERR_SNAPSHOT_NODATA; + break; + default: + ret = LTTNG_ERR_SNAPSHOT_FAIL; + break; } - - ret = LTTNG_ERR_SNAPSHOT_FAIL; goto error_snapshot; }