X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=ltt-sessiond%2Ftrace-ust.h;h=518eafbe67a06b4950a93c195ff5a3e653355f9e;hp=fa86cb94f5fa921a263c2bcff484d8ac71b4ae0c;hb=48842b309b2000205367409c0f29ca40ec3e251c;hpb=f8f0c3d1337c4eda5fb76a323ffe6c21c926a21e diff --git a/ltt-sessiond/trace-ust.h b/ltt-sessiond/trace-ust.h index fa86cb94f..518eafbe6 100644 --- a/ltt-sessiond/trace-ust.h +++ b/ltt-sessiond/trace-ust.h @@ -19,76 +19,114 @@ #ifndef _LTT_TRACE_UST_H #define _LTT_TRACE_UST_H +#include #include +#include #include - #include -#include -/* UST event list */ -struct ltt_ust_event_list { +#include "ust-ctl.h" + +#include "../hashtable/rculfhash.h" + +/* UST Stream list */ +struct ltt_ust_stream_list { unsigned int count; struct cds_list_head head; }; -/* UST Channel list */ -struct ltt_ust_channel_list { - unsigned int count; - struct cds_list_head head; +/* Context hash table nodes */ +struct ltt_ust_context { + struct lttng_ust_context ctx; + struct cds_lfht_node node; }; /* UST event */ struct ltt_ust_event { + struct lttng_ust_event attr; + struct cds_lfht *ctx; + struct cds_lfht_node node; +}; + +/* UST stream */ +struct ltt_ust_stream { int handle; - int enabled; - struct lttng_ust_context *ctx; - struct lttng_ust_event *event; - struct cds_list_head list; + char pathname[PATH_MAX]; + struct object_data *obj; + struct cds_lfht_node node; }; /* UST channel */ struct ltt_ust_channel { - int handle; - int enabled; - char *name; - char *trace_path; /* Trace file path name */ - struct lttng_ust_context *ctx; - struct lttng_ust_channel *attr; - struct ltt_ust_event_list events; - struct cds_list_head list; + char name[LTTNG_UST_SYM_NAME_LEN]; + char pathname[PATH_MAX]; + struct lttng_ust_channel attr; + struct cds_lfht *ctx; + struct cds_lfht *events; + struct cds_lfht_node node; }; /* UST Metadata */ struct ltt_ust_metadata { int handle; - char *trace_path; /* Trace file path name */ - struct lttng_ust_channel *attr; + struct object_data *obj; + char pathname[PATH_MAX]; /* Trace file path name */ + struct lttng_ust_channel attr; + struct object_data *stream_obj; +}; + +/* UST domain global (LTTNG_DOMAIN_UST) */ +struct ltt_ust_domain_global { + struct cds_lfht *channels; +}; + +/* UST domain pid (LTTNG_DOMAIN_UST_PID) */ +struct ltt_ust_domain_pid { + pid_t pid; + struct cds_lfht *channels; + struct cds_lfht_node node; +}; + +/* UST domain exec name (LTTNG_DOMAIN_UST_EXEC_NAME) */ +struct ltt_ust_domain_exec { + char exec_name[LTTNG_UST_SYM_NAME_LEN]; + struct cds_lfht *channels; + struct cds_lfht_node node; }; /* UST session */ struct ltt_ust_session { - int handle; - int enabled; - int uconsumer_fds_sent; - char *path; - struct ltt_ust_metadata *metadata; - struct ltt_ust_channel_list channels; + int uid; /* Unique identifier of session */ + int consumer_fds_sent; + int consumer_fd; + char pathname[PATH_MAX]; + struct ltt_ust_domain_global domain_global; + /* + * Those two hash tables contains data for a specific UST domain and each + * contains a HT of channels. See ltt_ust_domain_exec and + * ltt_ust_domain_pid data structures. + */ + struct cds_lfht *domain_pid; + struct cds_lfht *domain_exec; }; +#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST + /* * Lookup functions. NULL is returned if not found. */ -struct ltt_ust_event *trace_ust_get_event_by_name( - char *name, struct ltt_ust_channel *channel); -struct ltt_ust_channel *trace_ust_get_channel_by_name( - char *name, struct ltt_ust_session *session); +struct ltt_ust_event *trace_ust_find_event_by_name(struct cds_lfht *ht, + char *name); +struct ltt_ust_channel *trace_ust_find_channel_by_name(struct cds_lfht *ht, + char *name); /* * Create functions malloc() the data structure. */ -struct ltt_ust_session *trace_ust_create_session(void); -struct ltt_ust_channel *trace_ust_create_channel(char *name, char *path, - struct lttng_ust_channel *attr); +struct ltt_ust_session *trace_ust_create_session(char *path, unsigned int uid, + struct lttng_domain *domain); +struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr, + char *path); struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev); struct ltt_ust_metadata *trace_ust_create_metadata(char *path); @@ -101,4 +139,65 @@ void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata); void trace_ust_destroy_channel(struct ltt_ust_channel *channel); void trace_ust_destroy_event(struct ltt_ust_event *event); +#else + +static inline +struct ltt_ust_event *trace_ust_find_event_by_name(struct cds_lfht *ht, + char *name) +{ + return NULL; +} + +static inline +struct ltt_ust_channel *trace_ust_find_channel_by_name(struct cds_lfht *ht, + char *name) +{ + return NULL; +} + +static inline +struct ltt_ust_session *trace_ust_create_session(char *path, pid_t pid, + struct lttng_domain *domain) +{ + return NULL; +} +static inline +struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr, + char *path) +{ + return NULL; +} +static inline +struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev) +{ + return NULL; +} +static inline +struct ltt_ust_metadata *trace_ust_create_metadata(char *path) +{ + return NULL; +} + +static inline +void trace_ust_destroy_session(struct ltt_ust_session *session) +{ +} + +static inline +void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata) +{ +} + +static inline +void trace_ust_destroy_channel(struct ltt_ust_channel *channel) +{ +} + +static inline +void trace_ust_destroy_event(struct ltt_ust_event *event) +{ +} + +#endif /* CONFIG_CONFIG_LTTNG_TOOLS_HAVE_UST */ + #endif /* _LTT_TRACE_UST_H */