struct ust_app *lta;
int ret;
- if ((msg->bits_per_long == 64 && ust_consumerd64_fd == -EINVAL)
- || (msg->bits_per_long == 32 && ust_consumerd32_fd == -EINVAL)) {
+ if ((msg->bits_per_long == 64 &&
+ (uatomic_read(&ust_consumerd64_fd) == -EINVAL))
+ || (msg->bits_per_long == 32 &&
+ (uatomic_read(&ust_consumerd32_fd) == -EINVAL))) {
ERR("Registration failed: application \"%s\" (pid: %d) has "
"%d-bit long, but no consumerd for this long size is available.\n",
msg->name, msg->pid, msg->bits_per_long);
memcpy(tmp[count].field_name, uiter.field_name, LTTNG_UST_SYM_NAME_LEN);
tmp[count].type = uiter.type;
+ tmp[count].nowrite = uiter.nowrite;
memcpy(tmp[count].event.name, uiter.event_name, LTTNG_UST_SYM_NAME_LEN);
tmp[count].event.loglevel = uiter.loglevel;
struct ust_app_session *ua_sess;
struct ust_app_channel *ua_chan;
struct ltt_ust_stream *ustream;
- int consumerd_fd;
+ struct consumer_socket *socket;
DBG("Starting tracing for ust app pid %d", app->pid);
goto skip_setup;
}
+ /* Create directories if consumer is LOCAL and has a path defined. */
+ if (usess->consumer->type == CONSUMER_DST_LOCAL &&
+ strlen(usess->consumer->dst.trace_path) > 0) {
+ ret = run_as_mkdir_recursive(usess->consumer->dst.trace_path,
+ S_IRWXU | S_IRWXG, usess->uid, usess->gid);
+ if (ret < 0) {
+ if (ret != -EEXIST) {
+ ERR("Trace directory creation error");
+ ret = -1;
+ goto error_rcu_unlock;
+ }
+ }
+ }
+
/* Indicate that the session has been started once */
ua_sess->started = 1;
ret = create_ust_app_metadata(ua_sess, usess->pathname, app);
if (ret < 0) {
+ ret = LTTNG_ERR_UST_META_FAIL;
goto error_rcu_unlock;
}
/* Got all streams */
lttng_fd_put(LTTNG_FD_APPS, 2);
free(ustream);
+ ret = LTTNG_ERR_UST_STREAM_FAIL;
break;
}
ustream->handle = ustream->obj->handle;
/* Order is important */
cds_list_add_tail(&ustream->list, &ua_chan->streams.head);
ret = snprintf(ustream->name, sizeof(ustream->name), "%s_%u",
- ua_chan->name, ua_chan->streams.count++);
+ ua_chan->name, ua_chan->streams.count);
+ ua_chan->streams.count++;
if (ret < 0) {
PERROR("asprintf UST create stream");
/*
switch (app->bits_per_long) {
case 64:
- consumerd_fd = ust_consumerd64_fd;
+ socket = consumer_find_socket(uatomic_read(&ust_consumerd64_fd),
+ usess->consumer);
+ if (socket == NULL) {
+ goto skip_setup;
+ }
break;
case 32:
- consumerd_fd = ust_consumerd32_fd;
+ socket = consumer_find_socket(uatomic_read(&ust_consumerd32_fd),
+ usess->consumer);
+ if (socket == NULL) {
+ goto skip_setup;
+ }
break;
default:
ret = -EINVAL;
}
/* Setup UST consumer socket and send fds to it */
- ret = ust_consumer_send_session(consumerd_fd, ua_sess, usess->consumer);
+ ret = ust_consumer_send_session(ua_sess, usess->consumer, socket);
if (ret < 0) {
goto error_rcu_unlock;
}
}
/* Validate version */
- if (app->version.major > UST_APP_MAJOR_VERSION) {
+ if (app->version.major != UST_APP_MAJOR_VERSION) {
goto error;
}
- DBG2("UST app PID %d is compatible with major version %d "
- "(supporting <= %d)", app->pid, app->version.major,
+ DBG2("UST app PID %d is compatible with internal major version %d "
+ "(supporting == %d)", app->pid, app->version.major,
UST_APP_MAJOR_VERSION);
app->compatible = 1;
rcu_read_unlock();
return 0;
error:
- DBG2("UST app PID %d is not compatible with major version %d "
- "(supporting <= %d)", app->pid, app->version.major,
+ DBG2("UST app PID %d is not compatible with internal major version %d "
+ "(supporting == %d)", app->pid, app->version.major,
UST_APP_MAJOR_VERSION);
app->compatible = 0;
rcu_read_unlock();