Example #1
0
/*
 * Find an event using the name and signature in the given registry. RCU read
 * side lock MUST be acquired before calling this function and as long as the
 * event reference is kept by the caller.
 *
 * On success, the event pointer is returned else NULL.
 */
struct ust_registry_event *ust_registry_find_event(
		struct ust_registry_channel *chan, char *name, char *sig)
{
	struct lttng_ht_node_u64 *node;
	struct lttng_ht_iter iter;
	struct ust_registry_event *event = NULL;
	struct ust_registry_event key;

	assert(chan);
	assert(name);
	assert(sig);

	/* Setup key for the match function. */
	strncpy(key.name, name, sizeof(key.name));
	key.name[sizeof(key.name) - 1] = '\0';
	key.signature = sig;

	cds_lfht_lookup(chan->ht->ht, chan->ht->hash_fct(&key, lttng_ht_seed),
			chan->ht->match_fct, &key, &iter.iter);
	node = lttng_ht_iter_get_node_u64(&iter);
	if (!node) {
		goto end;
	}
	event = caa_container_of(node, struct ust_registry_event, node);

end:
	return event;
}
Example #2
0
/*
 * Find viewer stream by id. RCU read side lock MUST be acquired.
 *
 * Return stream if found else NULL.
 */
struct relay_viewer_stream *viewer_stream_find_by_id(uint64_t id)
{
    struct lttng_ht_node_u64 *node;
    struct lttng_ht_iter iter;
    struct relay_viewer_stream *stream = NULL;

    lttng_ht_lookup(viewer_streams_ht, &id, &iter);
    node = lttng_ht_iter_get_node_u64(&iter);
    if (!node) {
        DBG("Relay viewer stream %" PRIu64 " not found", id);
        goto end;
    }
    stream = caa_container_of(node, struct relay_viewer_stream, stream_n);

end:
    return stream;
}