X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt-sessiond%2Fsession.h;h=f6a9fff4de0a2351f004ca24fdea5ec409a0b3bc;hb=a183785e7c3c29db9356fe65ad4364326f5dba1b;hp=9eaa1c535e783897f0ed0ce90bf806b89f7e5e30;hpb=b5541356f517dba006af9f676df8131dcb68f132;p=lttng-tools.git diff --git a/ltt-sessiond/session.h b/ltt-sessiond/session.h index 9eaa1c535..f6a9fff4d 100644 --- a/ltt-sessiond/session.h +++ b/ltt-sessiond/session.h @@ -3,8 +3,8 @@ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * as published by the Free Software Foundation; only version 2 + * of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,14 +19,17 @@ #ifndef _LTT_SESSION_H #define _LTT_SESSION_H -#include +#include #include +#include "trace-kernel.h" +#include "trace-ust.h" + /* * Tracing session list * * Statically declared in session.c and can be accessed by using - * get_session_list() function that returns the pointer to the list. + * session_get_list() function that returns the pointer to the list. */ struct ltt_session_list { /* @@ -37,10 +40,14 @@ struct ltt_session_list { * actions on that list. */ pthread_mutex_t lock; + /* - * Number of element in the list. + * Number of element in the list. The session list lock MUST be acquired if + * this counter is used when iterating over the session list. */ unsigned int count; + + /* Linked list head */ struct cds_list_head head; }; @@ -49,28 +56,29 @@ struct ltt_session_list { * session for both LTTng and UST. */ struct ltt_session { - char *name; - char *path; + char name[NAME_MAX]; + char path[PATH_MAX]; struct ltt_kernel_session *kernel_session; - struct cds_list_head ust_traces; - unsigned int ust_trace_count; + struct ltt_ust_session *ust_session; /* * Protect any read/write on this session data structure. This lock must be * acquired *before* using any public functions declared below. Use - * lock_session() and unlock_session() for that. + * session_lock() and session_unlock() for that. */ pthread_mutex_t lock; struct cds_list_head list; }; /* Prototypes */ -int create_session(char *name, char *path); -int destroy_session(char *name); -void get_lttng_session(struct lttng_session *sessions); -void lock_session(struct ltt_session *session); -void unlock_session(struct ltt_session *session); -struct ltt_session *find_session_by_name(char *name); -unsigned int get_session_count(void); -struct ltt_session_list *get_session_list(void); +int session_create(char *name, char *path); +int session_destroy(struct ltt_session *session); + +void session_lock(struct ltt_session *session); +void session_lock_list(void); +void session_unlock(struct ltt_session *session); +void session_unlock_list(void); + +struct ltt_session *session_find_by_name(char *name); +struct ltt_session_list *session_get_list(void); #endif /* _LTT_SESSION_H */