X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng-sessiond%2Fust-app.c;h=78c84bd755a82e0313743fc853bd77faac5648d2;hp=35688702602eb4fd5d91b9825da95dc4acaf81fd;hb=7753dea8e1af2342c4d42d2efc5da62538709ca8;hpb=84cd17c63cde7ea5d7a0ad037dd41e8297658812 diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index 356887026..78c84bd75 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -827,12 +828,21 @@ error: * Using pid and uid (of the app), allocate a new ust_app struct and * add it to the global traceable app list. * - * On success, return 0, else return malloc ENOMEM. + * On success, return 0, else return malloc -ENOMEM, or -EINVAL if app + * bitness is not supported. */ int ust_app_register(struct ust_register_msg *msg, int sock) { struct ust_app *lta; + if ((msg->bits_per_long == 64 && ust_consumerd64_fd == -EINVAL) + || (msg->bits_per_long == 32 && 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); + close(sock); + return -EINVAL; + } lta = zmalloc(sizeof(struct ust_app)); if (lta == NULL) { PERROR("malloc"); @@ -842,6 +852,7 @@ int ust_app_register(struct ust_register_msg *msg, int sock) lta->ppid = msg->ppid; lta->uid = msg->uid; lta->gid = msg->gid; + lta->bits_per_long = msg->bits_per_long; lta->v_major = msg->major; lta->v_minor = msg->minor; strncpy(lta->name, msg->name, sizeof(lta->name)); @@ -1123,6 +1134,7 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) struct ust_app_session *ua_sess; struct ust_app_channel *ua_chan; struct ltt_ust_stream *ustream; + int consumerd_fd; DBG("Starting tracing for ust app pid %d", app->key.pid); @@ -1176,8 +1188,19 @@ int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app) } } + switch (app->bits_per_long) { + case 64: + consumerd_fd = ust_consumerd64_fd; + break; + case 32: + consumerd_fd = ust_consumerd32_fd; + break; + default: + ret = -EINVAL; + goto error_rcu_unlock; + } /* Setup UST consumer socket and send fds to it */ - ret = ust_consumer_send_session(ust_consumer_fd, ua_sess); + ret = ust_consumer_send_session(consumerd_fd, ua_sess); if (ret < 0) { goto error_rcu_unlock; }