*
* The session list lock must be held.
*/
-int ltt_sessions_ht_alloc(void)
+static int ltt_sessions_ht_alloc(void)
{
int ret = 0;
pthread_mutex_lock(socket->lock);
ret = consumer_create_trace_chunk(socket,
relayd_id,
- session->id, new_trace_chunk);
+ session->id, new_trace_chunk,
+ DEFAULT_UST_TRACE_DIR);
pthread_mutex_unlock(socket->lock);
if (ret) {
goto error;
pthread_mutex_lock(socket->lock);
ret = consumer_create_trace_chunk(socket,
relayd_id,
- session->id, new_trace_chunk);
+ session->id, new_trace_chunk,
+ DEFAULT_KERNEL_TRACE_DIR);
pthread_mutex_unlock(socket->lock);
if (ret) {
goto error;
const time_t chunk_creation_ts = time(NULL);
bool is_local_trace;
const char *base_path;
- struct lttng_directory_handle session_output_directory;
+ struct lttng_directory_handle *session_output_directory = NULL;
const struct lttng_credentials session_credentials = {
.uid = session->uid,
.gid = session->gid,
if (ret) {
goto error;
}
- ret = lttng_directory_handle_init(&session_output_directory,
- base_path);
- if (ret) {
+ session_output_directory = lttng_directory_handle_create(base_path);
+ if (!session_output_directory) {
goto error;
}
chunk_status = lttng_trace_chunk_set_as_owner(trace_chunk,
- &session_output_directory);
- lttng_directory_handle_fini(&session_output_directory);
+ session_output_directory);
+ lttng_directory_handle_put(session_output_directory);
+ session_output_directory = NULL;
if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
goto error;
}
end:
return trace_chunk;
error:
+ lttng_directory_handle_put(session_output_directory);
lttng_trace_chunk_put(trace_chunk);
trace_chunk = NULL;
goto end;
* Session list lock must be held by the caller.
*/
enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
- const char *base_path, struct ltt_session **out_session)
+ struct ltt_session **out_session)
{
int ret;
enum lttng_error_code ret_code;
}
}
- if (base_path) {
- new_session->base_path = strdup(base_path);
- if (!new_session->base_path) {
- ERR("Failed to allocate base path of session \"%s\"",
- name);
- ret_code = LTTNG_ERR_SESSION_FAIL;
- goto error;
- }
- }
-
new_session->uid = uid;
new_session->gid = gid;
*
* Be careful of the result passed to this function. For instance,
* on failure to launch a rotation, a client will expect the rotation
- * state to be set to "NO_ROTATION". If an error occured while the
+ * state to be set to "NO_ROTATION". If an error occurred while the
* rotation was "ONGOING", result should be set to "ERROR", which will
* allow a client to report it.
*