X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=03fb8a88151ec53dee835d968f376dfd3458bd2b;hb=473037afcb1f43e3fd653c5361a182718dfc970f;hp=dc465173e3521984f48b91f23e1782b83ba22b09;hpb=e3a639d00e6114996532f098b7915c63682dd14e;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index dc465173e..03fb8a881 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -458,6 +458,7 @@ static int add_uri_to_consumer(struct consumer_output *consumer, * URI was the same in the consumer so we do not append the subdir * again so to not duplicate output dir. */ + ret = LTTNG_OK; goto error; } @@ -1442,7 +1443,13 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, 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)); + if (is_root) { + strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME, + sizeof(uevent.name)); + } else { + strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME, + sizeof(uevent.name)); + } uevent.name[sizeof(uevent.name) - 1] = '\0'; /* @@ -1454,7 +1461,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, tmp_dom.type = LTTNG_DOMAIN_UST; ret = cmd_enable_event(session, &tmp_dom, DEFAULT_JUL_CHANNEL_NAME, - &uevent, NULL, NULL, wpipe); + &uevent, filter, NULL, wpipe); if (ret != LTTNG_OK && ret != LTTNG_ERR_UST_EVENT_ENABLED) { goto error; } @@ -1654,7 +1661,13 @@ int cmd_enable_event_all(struct ltt_session *session, /* Create the default JUL tracepoint. */ uevent.type = LTTNG_EVENT_TRACEPOINT; uevent.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; - strncpy(uevent.name, DEFAULT_JUL_EVENT_NAME, sizeof(uevent.name)); + if (is_root) { + strncpy(uevent.name, DEFAULT_SYS_JUL_EVENT_NAME, + sizeof(uevent.name)); + } else { + strncpy(uevent.name, DEFAULT_USER_JUL_EVENT_NAME, + sizeof(uevent.name)); + } uevent.name[sizeof(uevent.name) - 1] = '\0'; /* @@ -1779,6 +1792,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; @@ -1794,6 +1808,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 */ @@ -2478,6 +2507,7 @@ void cmd_list_lttng_sessions(struct lttng_session *sessions, uid_t uid, sessions[i].name[NAME_MAX - 1] = '\0'; sessions[i].enabled = session->enabled; sessions[i].snapshot_mode = session->snapshot_mode; + sessions[i].live_timer_interval = session->live_timer; i++; } } @@ -2498,6 +2528,21 @@ int cmd_data_pending(struct ltt_session *session) if (session->enabled) { ret = LTTNG_ERR_SESSION_STARTED; goto error; + } else { + /* + * If stopped, just make sure we've started before else the above call + * will always send that there is data pending. + * + * The consumer assumes that when the data pending command is received, + * the trace has been started before or else no output data is written + * by the streams which is a condition for data pending. So, this is + * *VERY* important that we don't ask the consumer before a start + * trace. + */ + if (!session->started) { + ret = 0; + goto error; + } } if (ksess && ksess->consumer) {