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));
/* 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);
}
}
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;
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;
}
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;
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 */
{
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;
{
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;
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;
}