int lttng_opt_quiet;
int lttng_opt_verbose;
+/*
+ * Compare two URL destination.
+ *
+ * Return 0 is equal else is not equal.
+ */
+static int compare_destination(struct lttng_uri *ctrl, struct lttng_uri *data)
+{
+ int ret;
+
+ assert(ctrl);
+ assert(data);
+
+ switch (ctrl->dtype) {
+ case LTTNG_DST_IPV4:
+ ret = strncmp(ctrl->dst.ipv4, data->dst.ipv4, sizeof(ctrl->dst.ipv4));
+ break;
+ case LTTNG_DST_IPV6:
+ ret = strncmp(ctrl->dst.ipv6, data->dst.ipv6, sizeof(ctrl->dst.ipv6));
+ break;
+ default:
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
+
static void set_default_url_attr(struct lttng_uri *uri,
enum lttng_stream_type stype)
{
}
if (data_url) {
+ int ret;
+
/* We have to parse the data URL in this case */
size_data = uri_parse(data_url, &data_uris);
if (size_data < 1) {
}
set_default_url_attr(&data_uris[0], LTTNG_STREAM_DATA);
+
+ ret = compare_destination(&ctrl_uris[0], &data_uris[0]);
+ if (ret != 0) {
+ ERR("Control and data destination mismatch");
+ goto error;
+ }
}
/* Compute total size */
memset(attr, 0, sizeof(struct lttng_channel_attr));
+ /* Same for all domains. */
+ attr->overwrite = DEFAULT_CHANNEL_OVERWRITE;
+ attr->tracefile_size = DEFAULT_CHANNEL_TRACEFILE_SIZE;
+ attr->tracefile_count = DEFAULT_CHANNEL_TRACEFILE_COUNT;
+
switch (domain->type) {
case LTTNG_DOMAIN_KERNEL:
- attr->overwrite = DEFAULT_CHANNEL_OVERWRITE;
- attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
- attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
-
+ attr->switch_timer_interval = DEFAULT_KERNEL_CHANNEL_SWITCH_TIMER;
+ attr->read_timer_interval = DEFAULT_KERNEL_CHANNEL_READ_TIMER;
attr->subbuf_size = default_get_kernel_channel_subbuf_size();
attr->num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
attr->output = DEFAULT_KERNEL_CHANNEL_OUTPUT;
break;
case LTTNG_DOMAIN_UST:
-#if 0
- case LTTNG_DOMAIN_UST_EXEC_NAME:
- case LTTNG_DOMAIN_UST_PID:
- case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN:
-#endif
- attr->overwrite = DEFAULT_CHANNEL_OVERWRITE;
- attr->switch_timer_interval = DEFAULT_CHANNEL_SWITCH_TIMER;
- attr->read_timer_interval = DEFAULT_CHANNEL_READ_TIMER;
-
- attr->subbuf_size = default_get_ust_channel_subbuf_size();
- attr->num_subbuf = DEFAULT_UST_CHANNEL_SUBBUF_NUM;
- attr->output = DEFAULT_UST_CHANNEL_OUTPUT;
- break;
+ switch (domain->buf_type) {
+ case LTTNG_BUFFER_PER_UID:
+ attr->subbuf_size = default_get_ust_uid_channel_subbuf_size();
+ attr->num_subbuf = DEFAULT_UST_UID_CHANNEL_SUBBUF_NUM;
+ attr->output = DEFAULT_UST_UID_CHANNEL_OUTPUT;
+ attr->switch_timer_interval = DEFAULT_UST_UID_CHANNEL_SWITCH_TIMER;
+ attr->read_timer_interval = DEFAULT_UST_UID_CHANNEL_READ_TIMER;
+ break;
+ case LTTNG_BUFFER_PER_PID:
+ default:
+ attr->subbuf_size = default_get_ust_pid_channel_subbuf_size();
+ attr->num_subbuf = DEFAULT_UST_PID_CHANNEL_SUBBUF_NUM;
+ attr->output = DEFAULT_UST_PID_CHANNEL_OUTPUT;
+ attr->switch_timer_interval = DEFAULT_UST_PID_CHANNEL_SWITCH_TIMER;
+ attr->read_timer_interval = DEFAULT_UST_PID_CHANNEL_READ_TIMER;
+ break;
+ }
default:
/* Default behavior: leave set to 0. */
break;
}
/*
- * [OBSELETE]
+ * [OBSOLETE]
*/
int lttng_enable_consumer(struct lttng_handle *handle)
{
}
/*
- * [OBSELETE]
+ * [OBSOLETE]
*/
int lttng_disable_consumer(struct lttng_handle *handle)
{
ret = reply.ret_code;
close_error:
- close(sock);
+ {
+ int closeret;
+
+ closeret = close(sock);
+ assert(!closeret);
+ }
error:
return ret;
lsm.u.uri.size = size;
if (size > 0 && uris[0].dtype != LTTNG_DST_PATH && strlen(uris[0].subdir) == 0) {
- ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s", name,
- datetime);
+ /* Don't append datetime if the name was automatically created. */
+ if (strncmp(name, DEFAULT_SESSION_NAME "-",
+ strlen(DEFAULT_SESSION_NAME) + 1)) {
+ ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s-%s",
+ name, datetime);
+ } else {
+ ret = snprintf(uris[0].subdir, sizeof(uris[0].subdir), "%s", name);
+ }
if (ret < 0) {
PERROR("snprintf uri subdir");
ret = -LTTNG_ERR_FATAL;