health_code_update();
return ret;
}
+
+int consumer_init(struct consumer_socket *socket,
+ const lttng_uuid sessiond_uuid)
+{
+ int ret;
+ struct lttcomm_consumer_msg msg = {
+ .cmd_type = LTTNG_CONSUMER_INIT,
+ };
+
+ assert(socket);
+
+ DBG("Sending consumer initialization command");
+ lttng_uuid_copy(msg.u.init.sessiond_uuid, sessiond_uuid);
+
+ health_code_update();
+ ret = consumer_send_msg(socket, &msg);
+ if (ret < 0) {
+ goto error;
+ }
+
+error:
+ health_code_update();
+ return ret;
+}
return mkdir_local(path, uid, gid);
}
}
+
+enum lttcomm_return_code lttng_consumer_init_command(
+ struct lttng_consumer_local_data *ctx,
+ const lttng_uuid sessiond_uuid)
+{
+ enum lttcomm_return_code ret;
+
+ if (ctx->sessiond_uuid.is_set) {
+ ret = LTTCOMM_CONSUMERD_ALREADY_SET;
+ goto end;
+ }
+
+ ctx->sessiond_uuid.is_set = true;
+ memcpy(ctx->sessiond_uuid.value, sessiond_uuid, sizeof(lttng_uuid));
+ ret = LTTCOMM_CONSUMERD_SUCCESS;
+end:
+ return ret;
+}
LTTNG_CONSUMER_CHECK_ROTATION_PENDING_LOCAL,
LTTNG_CONSUMER_CHECK_ROTATION_PENDING_RELAY,
LTTNG_CONSUMER_MKDIR,
+ LTTNG_CONSUMER_INIT,
};
/* State of each fd in consumer */
* to the session daemon (write-only).
*/
int channel_monitor_pipe;
+ LTTNG_OPTIONAL(lttng_uuid) sessiond_uuid;
};
/*
int lttng_consumer_mkdir(const char *path, uid_t uid, gid_t gid,
uint64_t relayd_id);
void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd);
+enum lttcomm_return_code lttng_consumer_init_command(
+ struct lttng_consumer_local_data *ctx,
+ const lttng_uuid sessiond_uuid);
#endif /* LIB_CONSUMER_H */
}
break;
}
+ case LTTNG_CONSUMER_INIT:
+ {
+ ret_code = lttng_consumer_init_command(ctx,
+ msg.u.init.sessiond_uuid);
+
+ health_code_update();
+ ret = consumer_send_status_msg(sock, ret_code);
+ if (ret < 0) {
+ /* Somehow, the session daemon is not responding anymore. */
+ goto end_nosignal;
+ }
+ break;
+ }
default:
goto end_nosignal;
}
}
break;
}
+ case LTTNG_CONSUMER_INIT:
+ {
+ ret_code = lttng_consumer_init_command(ctx,
+ msg.u.init.sessiond_uuid);
+
+ health_code_update();
+ ret = consumer_send_status_msg(sock, ret_code);
+ if (ret < 0) {
+ /* Somehow, the session daemon is not responding anymore. */
+ goto end_nosignal;
+ }
+ break;
+ }
default:
break;
}