X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fsession.h;h=b008c967ec21b610651c5c4071842b236c2d2360;hb=2a85be8e0e679da996b48252b1d9aebb9bb29126;hp=b1ca2504e6d86b722fef2bc0c4c3b7ae048e7872;hpb=a9577b7628a85b064c3f249c3504bad989848b49;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/session.h b/src/bin/lttng-sessiond/session.h index b1ca2504e..b008c967e 100644 --- a/src/bin/lttng-sessiond/session.h +++ b/src/bin/lttng-sessiond/session.h @@ -47,6 +47,11 @@ struct ltt_session_list { * iterate or/and do any actions on that list. */ pthread_mutex_t lock; + /* + * This condition variable is signaled on every removal from + * the session list. + */ + pthread_cond_t removal_cond; /* * Session unique ID generator. The session list lock MUST be @@ -64,9 +69,12 @@ struct ltt_session_list { */ struct ltt_session { char name[NAME_MAX]; + bool has_auto_generated_name; char hostname[HOST_NAME_MAX]; /* Local hostname. */ + time_t creation_time; struct ltt_kernel_session *kernel_session; struct ltt_ust_session *ust_session; + struct urcu_ref ref; /* * Protect any read/write on this session data structure. This lock must be * acquired *before* using any public functions declared below. Use @@ -75,6 +83,10 @@ struct ltt_session { pthread_mutex_t lock; struct cds_list_head list; uint64_t id; /* session unique identifier */ + /* Indicates if the session has been added to the session list and ht.*/ + bool published; + /* Indicates if a destroy command has been applied to this session. */ + bool destroyed; /* UID/GID of the user owning the session */ uid_t uid; gid_t gid; @@ -90,7 +102,11 @@ struct ltt_session { * copied into those sessions. */ struct consumer_output *consumer; - + /* + * Indicates whether or not the user has specified an output directory + * or if it was configured using the default configuration. + */ + bool has_user_specified_directory; /* Did at least ONE start command has been triggered?. */ unsigned int has_been_started:1; /* @@ -104,11 +120,19 @@ struct ltt_session { /* Indicate if the session has to output the traces or not. */ unsigned int output_traces; /* - * This session is in snapshot mode. This means that every channel enabled - * will be set in overwrite mode and mmap. It is considered exclusively for - * snapshot purposes. + * This session is in snapshot mode. This means that channels enabled + * will be set in overwrite mode by default and must be in mmap + * output mode. Note that snapshots can be taken on a session that + * is not in "snapshot_mode". This parameter only affects channel + * creation defaults. */ unsigned int snapshot_mode; + /* + * A session that has channels that don't use 'mmap' output can't be + * used to capture snapshots. This is set to true whenever a + * 'splice' kernel channel is enabled. + */ + bool has_non_mmap_channel; /* * Timer set when the session is created for live reading. */ @@ -204,15 +228,19 @@ struct ltt_session { }; /* Prototypes */ -int session_create(char *name, uid_t uid, gid_t gid); -int session_destroy(struct ltt_session *session); - +enum lttng_error_code session_create(const char *name, uid_t uid, gid_t gid, + struct ltt_session **out_session); void session_lock(struct ltt_session *session); void session_lock_list(void); int session_trylock_list(void); void session_unlock(struct ltt_session *session); void session_unlock_list(void); +void session_destroy(struct ltt_session *session); + +bool session_get(struct ltt_session *session); +void session_put(struct ltt_session *session); + enum consumer_dst_type session_get_consumer_destination_type( const struct ltt_session *session); const char *session_get_net_consumer_hostname( @@ -225,7 +253,9 @@ struct lttng_trace_archive_location *session_get_trace_archive_location( struct ltt_session *session_find_by_name(const char *name); struct ltt_session *session_find_by_id(uint64_t id); + struct ltt_session_list *session_get_list(void); +void session_list_wait_empty(void); int session_access_ok(struct ltt_session *session, uid_t uid, gid_t gid);