Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
cmd_ret = LTTNG_ERR_CREATE_DIR_FAIL;
goto error;
}
cmd_ret = LTTNG_ERR_CREATE_DIR_FAIL;
goto error;
}
- /*
- * TODO: ust_app_rotate_session must be adapted to return
- * an lttng_error_code, like its kernel counterpart.
- */
cmd_ret = ust_app_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
goto error;
cmd_ret = ust_app_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
goto error;
/*
* Rotate all the channels of a session.
*
/*
* Rotate all the channels of a session.
*
- * Return 0 on success or else a negative value.
+ * Return LTTNG_OK on success or else an LTTng error code.
-int ust_app_rotate_session(struct ltt_session *session)
+enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
+ int ret;
+ enum lttng_error_code cmd_ret = LTTNG_OK;
struct lttng_ht_iter iter;
struct ust_app *app;
struct ltt_ust_session *usess = session->ust_session;
struct lttng_ht_iter iter;
struct ust_app *app;
struct ltt_ust_session *usess = session->ust_session;
socket = consumer_find_socket_by_bitness(reg->bits_per_long,
usess->consumer);
if (!socket) {
socket = consumer_find_socket_by_bitness(reg->bits_per_long,
usess->consumer);
if (!socket) {
+ cmd_ret = LTTNG_ERR_INVALID;
reg->uid, reg->bits_per_long);
if (ret < 0 || ret == sizeof(pathname)) {
PERROR("Failed to format rotation path");
reg->uid, reg->bits_per_long);
if (ret < 0 || ret == sizeof(pathname)) {
PERROR("Failed to format rotation path");
+ cmd_ret = LTTNG_ERR_INVALID;
/* is_metadata_channel */ false,
session->current_archive_id);
if (ret < 0) {
/* is_metadata_channel */ false,
session->current_archive_id);
if (ret < 0) {
+ cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
/* is_metadata_channel */ true,
session->current_archive_id);
if (ret < 0) {
/* is_metadata_channel */ true,
session->current_archive_id);
if (ret < 0) {
+ cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
ua_sess->path);
if (ret < 0 || ret == sizeof(pathname)) {
PERROR("Failed to format rotation path");
ua_sess->path);
if (ret < 0 || ret == sizeof(pathname)) {
PERROR("Failed to format rotation path");
+ cmd_ret = LTTNG_ERR_INVALID;
socket = consumer_find_socket_by_bitness(app->bits_per_long,
usess->consumer);
if (!socket) {
socket = consumer_find_socket_by_bitness(app->bits_per_long,
usess->consumer);
if (!socket) {
+ cmd_ret = LTTNG_ERR_INVALID;
goto error;
}
registry = get_session_registry(ua_sess);
if (!registry) {
goto error;
}
registry = get_session_registry(ua_sess);
if (!registry) {
- DBG("Application session is being torn down. Abort session rotation.");
- ret = -1;
- goto error;
+ DBG("Application session is being torn down. Skip application.");
+ continue;
/* is_metadata_channel */ false,
session->current_archive_id);
if (ret < 0) {
/* is_metadata_channel */ false,
session->current_archive_id);
if (ret < 0) {
+ /* Per-PID buffer and application going away. */
+ if (ret == -LTTNG_ERR_CHAN_NOT_FOUND)
+ continue;
+ cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
/* is_metadata_channel */ true,
session->current_archive_id);
if (ret < 0) {
/* is_metadata_channel */ true,
session->current_archive_id);
if (ret < 0) {
+ /* Per-PID buffer and application going away. */
+ if (ret == -LTTNG_ERR_CHAN_NOT_FOUND)
+ continue;
+ cmd_ret = LTTNG_ERR_ROTATION_FAIL_CONSUMER;
error:
rcu_read_unlock();
error:
rcu_read_unlock();
struct consumer_output *consumer,
int overwrite, uint64_t *discarded, uint64_t *lost);
int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess);
struct consumer_output *consumer,
int overwrite, uint64_t *discarded, uint64_t *lost);
int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess);
-int ust_app_rotate_session(struct ltt_session *session);
+enum lttng_error_code ust_app_rotate_session(struct ltt_session *session);
static inline
int ust_app_supported(void)
static inline
int ust_app_supported(void)