+ /*
+ * Find out which consumerd to execute. We will
+ * first try the 64-bit path, then the
+ * sessiond's installation directory, and
+ * fallback on the 32-bit one,
+ */
+ if (stat(consumerd64_bin, &st) == 0) {
+ consumer_to_use = consumerd64_bin;
+ } else if (stat(INSTALL_BIN_PATH "/" CONSUMERD_FILE, &st) == 0) {
+ consumer_to_use = INSTALL_BIN_PATH "/" CONSUMERD_FILE;
+ } else if (stat(consumerd32_bin, &st) == 0) {
+ consumer_to_use = consumerd32_bin;
+ } else {
+ break;
+ }
+ DBG("Using kernel consumer at: %s", consumer_to_use);
+ execl(consumer_to_use,
+ "lttng-consumerd", verbosity, "-k",
+ "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
+ "--consumerd-err-sock", consumer_data->err_unix_sock_path,
+ NULL);
+ break;
+ case LTTNG_CONSUMER64_UST:
+ {
+ char *tmpnew = NULL;
+
+ if (consumerd64_libdir[0] != '\0') {
+ char *tmp;
+ size_t tmplen;
+
+ tmp = getenv("LD_LIBRARY_PATH");
+ if (!tmp) {
+ tmp = "";
+ }
+ tmplen = strlen("LD_LIBRARY_PATH=")
+ + strlen(consumerd64_libdir) + 1 /* : */ + strlen(tmp);
+ tmpnew = zmalloc(tmplen + 1 /* \0 */);
+ if (!tmpnew) {
+ ret = -ENOMEM;
+ goto error;
+ }
+ strcpy(tmpnew, "LD_LIBRARY_PATH=");
+ strcat(tmpnew, consumerd64_libdir);
+ if (tmp[0] != '\0') {
+ strcat(tmpnew, ":");
+ strcat(tmpnew, tmp);
+ }
+ ret = putenv(tmpnew);
+ if (ret) {
+ ret = -errno;
+ goto error;
+ }
+ }
+ DBG("Using 64-bit UST consumer at: %s", consumerd64_bin);
+ ret = execl(consumerd64_bin, "lttng-consumerd", verbosity, "-u",
+ "--consumerd-cmd-sock", consumer_data->cmd_unix_sock_path,
+ "--consumerd-err-sock", consumer_data->err_unix_sock_path,
+ NULL);
+ if (consumerd64_libdir[0] != '\0') {
+ free(tmpnew);
+ }
+ if (ret) {
+ goto error;
+ }