X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=liblttng-ust%2Fust-core.c;h=e8dff983279e3ec869ca9bb7b15274852e300919;hb=f52e590232f939bd6b5c88a483765c03e37fc733;hp=60751dc32a9aa56058e1452f3e9ddec4a395981b;hpb=c785c634a51956094130218c2bffeff32756cb69;p=deliverable%2Flttng-ust.git diff --git a/liblttng-ust/ust-core.c b/liblttng-ust/ust-core.c index 60751dc3..e8dff983 100644 --- a/liblttng-ust/ust-core.c +++ b/liblttng-ust/ust-core.c @@ -18,12 +18,17 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define _LGPL_SOURCE +#include +#include #include #include #include +#include "lttng-tracer-core.h" #include "jhash.h" static CDS_LIST_HEAD(lttng_transport_list); +static CDS_LIST_HEAD(lttng_counter_transport_list); struct lttng_transport *lttng_transport_find(const char *name) { @@ -36,6 +41,17 @@ struct lttng_transport *lttng_transport_find(const char *name) return NULL; } +struct lttng_counter_transport *lttng_counter_transport_find(const char *name) +{ + struct lttng_counter_transport *transport; + + cds_list_for_each_entry(transport, <tng_counter_transport_list, node) { + if (!strcmp(transport->name, name)) + return transport; + } + return NULL; +} + /** * lttng_transport_register - LTT transport registration * @transport: transport structure @@ -58,25 +74,79 @@ void lttng_transport_unregister(struct lttng_transport *transport) cds_list_del(&transport->node); } +/** + * lttng_counter_transport_register - LTTng counter transport registration + * @transport: transport structure + * + * Registers a counter transport which can be used as output to extract + * the data out of LTTng. Called with ust_lock held. + */ +void lttng_counter_transport_register(struct lttng_counter_transport *transport) +{ + cds_list_add_tail(&transport->node, <tng_counter_transport_list); +} + +/** + * lttng_counter_transport_unregister - LTTng counter transport unregistration + * @transport: transport structure + * Called with ust_lock held. + */ +void lttng_counter_transport_unregister(struct lttng_counter_transport *transport) +{ + cds_list_del(&transport->node); +} + /* * Needed by comm layer. */ -struct lttng_enum *lttng_ust_enum_get(struct lttng_session *session, - const char *enum_name) +struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_session *session, + const struct lttng_enum_desc *enum_desc) { struct lttng_enum *_enum; struct cds_hlist_head *head; struct cds_hlist_node *node; - size_t name_len = strlen(enum_name); + size_t name_len = strlen(enum_desc->name); uint32_t hash; - hash = jhash(enum_name, name_len, 0); + hash = jhash(enum_desc->name, name_len, 0); head = &session->enums_ht.table[hash & (LTTNG_UST_ENUM_HT_SIZE - 1)]; cds_hlist_for_each_entry(_enum, node, head, hlist) { assert(_enum->desc); - if (!strncmp(_enum->desc->name, enum_name, - LTTNG_UST_SYM_NAME_LEN - 1)) + if (_enum->desc == enum_desc) return _enum; } return NULL; } + +size_t lttng_ust_dummy_get_size(struct lttng_ctx_field *field, size_t offset) +{ + size_t size = 0; + + size += lib_ring_buffer_align(offset, lttng_alignof(char)); + size += sizeof(char); /* tag */ + return size; +} + +void lttng_ust_dummy_record(struct lttng_ctx_field *field, + struct lttng_ust_lib_ring_buffer_ctx *ctx, + struct lttng_channel *chan) +{ + char sel_char = (char) LTTNG_UST_DYNAMIC_TYPE_NONE; + + lib_ring_buffer_align_ctx(ctx, lttng_alignof(sel_char)); + chan->ops->event_write(ctx, &sel_char, sizeof(sel_char)); +} + +void lttng_ust_dummy_get_value(struct lttng_ctx_field *field, + struct lttng_ctx_value *value) +{ + value->sel = LTTNG_UST_DYNAMIC_TYPE_NONE; +} + +int lttng_context_is_app(const char *name) +{ + if (strncmp(name, "$app.", strlen("$app.")) != 0) { + return 0; + } + return 1; +}