projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sessiond: introduce cleared_after_last_stop
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
session.c
diff --git
a/src/bin/lttng-sessiond/session.c
b/src/bin/lttng-sessiond/session.c
index e0ab7f4a5eaf70933f25fa082fcead54787d5d17..3a537e49e2179357298cb43813dfa17a6f63927d 100644
(file)
--- a/
src/bin/lttng-sessiond/session.c
+++ b/
src/bin/lttng-sessiond/session.c
@@
-302,7
+302,7
@@
end:
*
* The session list lock must be held.
*/
*
* The session list lock must be held.
*/
-int ltt_sessions_ht_alloc(void)
+
static
int ltt_sessions_ht_alloc(void)
{
int ret = 0;
{
int ret = 0;
@@
-423,7
+423,7
@@
int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
struct lttng_trace_chunk *new_trace_chunk,
struct lttng_trace_chunk **_current_trace_chunk)
{
struct lttng_trace_chunk *new_trace_chunk,
struct lttng_trace_chunk **_current_trace_chunk)
{
- int ret;
+ int ret
= 0
;
unsigned int i, refs_to_acquire = 0, refs_acquired = 0, refs_to_release = 0;
struct cds_lfht_iter iter;
struct consumer_socket *socket;
unsigned int i, refs_to_acquire = 0, refs_acquired = 0, refs_to_release = 0;
struct cds_lfht_iter iter;
struct consumer_socket *socket;
@@
-482,7
+482,6
@@
int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
ret_error_code = ust_app_create_channel_subdirectories(
session->ust_session);
if (ret_error_code != LTTNG_OK) {
ret_error_code = ust_app_create_channel_subdirectories(
session->ust_session);
if (ret_error_code != LTTNG_OK) {
- ret = -ret_error_code;
goto error;
}
}
goto error;
}
}
@@
-492,7
+491,8
@@
int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
pthread_mutex_lock(socket->lock);
ret = consumer_create_trace_chunk(socket,
relayd_id,
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_unlock(socket->lock);
if (ret) {
goto error;
@@
-513,7
+513,6
@@
int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
ret_error_code = kernel_create_channel_subdirectories(
session->kernel_session);
if (ret_error_code != LTTNG_OK) {
ret_error_code = kernel_create_channel_subdirectories(
session->kernel_session);
if (ret_error_code != LTTNG_OK) {
- ret = -ret_error_code;
goto error;
}
}
goto error;
}
}
@@
-523,7
+522,8
@@
int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
pthread_mutex_lock(socket->lock);
ret = consumer_create_trace_chunk(socket,
relayd_id,
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;
pthread_mutex_unlock(socket->lock);
if (ret) {
goto error;
@@
-577,7
+577,7
@@
struct lttng_trace_chunk *session_create_new_trace_chunk(
const time_t chunk_creation_ts = time(NULL);
bool is_local_trace;
const char *base_path;
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,
const struct lttng_credentials session_credentials = {
.uid = session->uid,
.gid = session->gid,
@@
-642,28
+642,29
@@
struct lttng_trace_chunk *session_create_new_trace_chunk(
if (ret) {
goto error;
}
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,
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:
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;
}
lttng_trace_chunk_put(trace_chunk);
trace_chunk = NULL;
goto end;
}
-int session_close_trace_chunk(
const
struct ltt_session *session,
+int session_close_trace_chunk(struct ltt_session *session,
struct lttng_trace_chunk *trace_chunk,
struct lttng_trace_chunk *trace_chunk,
-
const enum lttng_trace_chunk_command_type *
close_command,
+
enum lttng_trace_chunk_command_type
close_command,
char *closed_trace_chunk_path)
{
int ret = 0;
char *closed_trace_chunk_path)
{
int ret = 0;
@@
-673,13
+674,11
@@
int session_close_trace_chunk(const struct ltt_session *session,
enum lttng_trace_chunk_status chunk_status;
const time_t chunk_close_timestamp = time(NULL);
enum lttng_trace_chunk_status chunk_status;
const time_t chunk_close_timestamp = time(NULL);
- if (close_command) {
- chunk_status = lttng_trace_chunk_set_close_command(
- trace_chunk, *close_command);
- if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
- ret = -1;
- goto end;
- }
+ chunk_status = lttng_trace_chunk_set_close_command(
+ trace_chunk, close_command);
+ if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
+ ret = -1;
+ goto end;
}
if (chunk_close_timestamp == (time_t) -1) {
}
if (chunk_close_timestamp == (time_t) -1) {
@@
-813,7
+812,6
@@
void session_release(struct urcu_ref *ref)
DBG("Destroying session %s (id %" PRIu64 ")", session->name, session->id);
DBG("Destroying session %s (id %" PRIu64 ")", session->name, session->id);
- consumer_output_put(session->consumer);
snapshot_destroy(&session->snapshot);
pthread_mutex_destroy(&session->lock);
snapshot_destroy(&session->snapshot);
pthread_mutex_destroy(&session->lock);
@@
-825,6
+823,7
@@
void session_release(struct urcu_ref *ref)
}
session_notify_destruction(session);
}
session_notify_destruction(session);
+ consumer_output_put(session->consumer);
kernel_free_session(ksess);
session->kernel_session = NULL;
if (usess) {
kernel_free_session(ksess);
session->kernel_session = NULL;
if (usess) {
@@
-964,7
+963,7
@@
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,
* 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;
{
int ret;
enum lttng_error_code ret_code;
@@
-1088,16
+1087,6
@@
enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid,
}
}
}
}
- 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;
new_session->uid = uid;
new_session->gid = gid;
@@
-1165,7
+1154,7
@@
int session_access_ok(struct ltt_session *session, uid_t uid, gid_t gid)
*
* Be careful of the result passed to this function. For instance,
* on failure to launch a rotation, a client will expect the rotation
*
* 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 occur
r
ed while the
* rotation was "ONGOING", result should be set to "ERROR", which will
* allow a client to report it.
*
* rotation was "ONGOING", result should be set to "ERROR", which will
* allow a client to report it.
*
This page took
0.035706 seconds
and
5
git commands to generate.