lta->ppid = msg->ppid;
lta->uid = msg->uid;
lta->gid = msg->gid;
+ lta->compatible = 0; /* Not compatible until proven */
lta->bits_per_long = msg->bits_per_long;
lta->v_major = msg->major;
lta->v_minor = msg->minor;
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
struct lttng_ust_tracepoint_iter uiter;
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
handle = ustctl_tracepoint_list(app->key.sock);
if (handle < 0) {
ERR("UST app list events getting handle failed for app pid %d",
/* For every registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
struct lttng_ht_iter uiter;
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
continue;
/* For every registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
continue;
/* For all registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
/* Next app */
/* For all registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
/* If ua_sess is NULL, there is a code flow error */
assert(ua_sess);
/* For every registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
/*
* Create session on the tracer side and add it to app session HT. Note
* that if session exist, it will simply return a pointer to the ust
/* For all registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
/* If ua_sess is NULL, there is a code flow error */
assert(ua_sess);
/* For all registered applications */
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
/* If ua_sess is NULL, there is a code flow error */
assert(ua_sess);
rcu_read_lock();
+ if (!app->compatible) {
+ goto end;
+ }
+
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
goto error_rcu_unlock;
goto error_rcu_unlock;
}
- rcu_read_unlock();
-
/* Quiescent wait after starting trace */
ustctl_wait_quiescent(app->key.sock);
+end:
+ rcu_read_unlock();
return 0;
error_rcu_unlock:
rcu_read_lock();
+ if (!app->compatible) {
+ goto end;
+ }
+
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
/* Only malloc can failed so something is really wrong */
rcu_read_lock();
+ if (!app->compatible) {
+ goto end;
+ }
+
__lookup_session_by_app(usess, app, &iter);
node = lttng_ht_iter_get_node_ulong(&iter);
if (node == NULL) {
delete_ust_app_session(app->key.sock, ua_sess);
- rcu_read_unlock();
-
/* Quiescent wait after stopping trace */
ustctl_wait_quiescent(app->key.sock);
+end:
+ rcu_read_unlock();
return 0;
error_rcu_unlock:
goto error;
}
+ if (!app->compatible) {
+ goto error;
+ }
+
ua_sess = create_ust_app_session(usess, app);
if (ua_sess == NULL) {
goto error;
rcu_read_lock();
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
continue;
rcu_read_lock();
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, node.node) {
+ if (!app->compatible) {
+ /*
+ * TODO: In time, we should notice the caller of this error by
+ * telling him that this is a version error.
+ */
+ continue;
+ }
ua_sess = lookup_session_by_app(usess, app);
if (ua_sess == NULL) {
continue;
goto error;
}
+ if (!app->compatible) {
+ ret = 0;
+ goto error;
+ }
+
ua_sess = lookup_session_by_app(usess, app);
/* If ua_sess is NULL, there is a code flow error */
assert(ua_sess);
goto error;
}
+ if (!app->compatible) {
+ ret = 0;
+ goto error;
+ }
+
ua_sess = lookup_session_by_app(usess, app);
/* If ua_sess is NULL, there is a code flow error */
assert(ua_sess);
rcu_read_unlock();
return ret;
}
+
+/*
+ * Validate version of UST apps and set the compatible bit.
+ */
+int ust_app_validate_version(int sock)
+{
+ int ret;
+ struct ust_app *app;
+
+ rcu_read_lock();
+
+ app = find_app_by_sock(sock);
+ assert(app);
+
+ ret = ustctl_tracer_version(sock, &app->version);
+ if (ret < 0) {
+ goto error;
+ }
+
+ /* Validate 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->key.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->key.pid, app->version.major,
+ UST_APP_MAJOR_VERSION);
+ app->compatible = 0;
+ rcu_read_unlock();
+ return -1;
+}