X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotate.c;h=7abfaed644b1e372a95ed623de3ade1eb7ba9fa3;hp=17d3c51fdbf0823adb32d4bd3aab8606058df2f7;hb=9402c5b93a3e3344612a9938878bddb1430a3418;hpb=e94fecfcf3a8607771a6adf38f3ba0a686ddd683 diff --git a/src/bin/lttng-sessiond/rotate.c b/src/bin/lttng-sessiond/rotate.c index 17d3c51fd..7abfaed64 100644 --- a/src/bin/lttng-sessiond/rotate.c +++ b/src/bin/lttng-sessiond/rotate.c @@ -320,6 +320,47 @@ end: return ret; } +int rename_active_chunk(struct ltt_session *session) +{ + int ret; + + session->current_archive_id++; + + /* + * The currently active tracing path is now the folder we + * want to rename. + */ + ret = lttng_strncpy(session->rotation_chunk.current_rotate_path, + session->rotation_chunk.active_tracing_path, + sizeof(session->rotation_chunk.current_rotate_path)); + if (ret) { + ERR("Failed to copy active tracing path"); + goto end; + } + + ret = rename_completed_chunk(session, time(NULL)); + if (ret < 0) { + ERR("Failed to rename current rotation's path"); + goto end; + } + + /* + * We just renamed, the folder, we didn't do an actual rotation, so + * the active tracing path is now the renamed folder and we have to + * restore the rotate count. + */ + ret = lttng_strncpy(session->rotation_chunk.active_tracing_path, + session->rotation_chunk.current_rotate_path, + sizeof(session->rotation_chunk.active_tracing_path)); + if (ret) { + ERR("Failed to rename active session chunk tracing path"); + goto end; + } +end: + session->current_archive_id--; + return ret; +} + int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64_t size, struct notification_thread_handle *notification_thread_handle) {