goto no_match;
}
- if (event->loglevel != key->loglevel) {
+ if (event->loglevel_value != key->loglevel_value) {
if (event->loglevel_type == LTTNG_EVENT_LOGLEVEL_ALL &&
- key->loglevel == 0 && event->loglevel == -1) {
+ key->loglevel_value == 0 &&
+ event->loglevel_value == -1) {
goto match;
}
goto no_match;
assert(event);
key.name = event->name;
- key.loglevel = event->loglevel;
+ key.loglevel_value = event->loglevel_value;
node_ptr = cds_lfht_add_unique(ht->ht,
ht->hash_fct(event->node.key, lttng_ht_seed),
}
memset(&msg, 0, sizeof(msg));
- msg.loglevel = event->loglevel;
+ msg.loglevel_value = event->loglevel_value;
msg.loglevel_type = event->loglevel_type;
strncpy(msg.name, event->name, sizeof(msg.name));
ret = send_payload(app->sock, &msg, sizeof(msg));
* Return a new object else NULL on error.
*/
struct agent_event *agent_create_event(const char *name,
- int loglevel, enum lttng_loglevel_type loglevel_type,
+ int loglevel_value, enum lttng_loglevel_type loglevel_type,
struct lttng_filter_bytecode *filter, char *filter_expression)
{
struct agent_event *event = NULL;
event->name[sizeof(event->name) - 1] = '\0';
lttng_ht_node_init_str(&event->node, event->name);
- event->loglevel = loglevel;
+ event->loglevel_value = loglevel_value;
event->loglevel_type = loglevel_type;
event->filter = filter;
event->filter_expression = filter_expression;
*
* Return object if found else NULL.
*/
-struct agent_event *agent_find_event(const char *name, int loglevel,
+struct agent_event *agent_find_event(const char *name, int loglevel_value,
struct agent *agt)
{
struct lttng_ht_node_str *node;
ht = agt->events;
key.name = name;
- key.loglevel = loglevel;
+ key.loglevel_value = loglevel_value;
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
ht_match_event, &key, &iter.iter);
struct agent_ht_key {
const char *name;
- int loglevel;
+ int loglevel_value;
};
/*
struct agent_event {
/* Name of the event. */
char name[LTTNG_SYMBOL_NAME_LEN];
- int loglevel;
+ int loglevel_value;
enum lttng_loglevel_type loglevel_type;
/*
strncpy(tmp_events[i].name, event->name, sizeof(tmp_events[i].name));
tmp_events[i].name[sizeof(tmp_events[i].name) - 1] = '\0';
tmp_events[i].enabled = event->enabled;
- tmp_events[i].loglevel = event->loglevel;
+ tmp_events[i].loglevel = event->loglevel_value;
tmp_events[i].loglevel_type = event->loglevel_type;
i++;
}
key.name = event->attr.name;
key.filter = (struct lttng_filter_bytecode *) event->filter;
- key.loglevel = event->attr.loglevel;
+ key.loglevel_type = event->attr.loglevel;
key.exclusion = event->exclusion;
node_ptr = cds_lfht_add_unique(ht->ht,
* event name (output,
* size LTTNG_UST_SYM_NAME_LEN)
*/
- int *loglevel,
+ int *loglevel_value,
char **signature, /*
* event signature
* (output, dynamically
}
ust_event->attr.loglevel_type = ust_loglevel_type;
- ust_event->attr.loglevel = agent_event->loglevel;
+ ust_event->attr.loglevel = agent_event->loglevel_value;
ust_event->filter_expression = agent_event->filter_expression;
ust_event->exclusion = agent_event->exclusion;
end:
{
struct ltt_ust_event *event;
const struct ltt_ust_ht_key *key;
+ int ev_loglevel_value;
assert(node);
assert(_key);
event = caa_container_of(node, struct ltt_ust_event, node.node);
key = _key;
+ ev_loglevel_value = event->attr.loglevel;
/* Match the 4 elements of the key: name, filter, loglevel, exclusions. */
}
/* Event loglevel. */
- if (event->attr.loglevel != key->loglevel) {
+ if (ev_loglevel_value != key->loglevel_type) {
if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
- && key->loglevel == 0 && event->attr.loglevel == -1) {
+ && key->loglevel_type == 0 && ev_loglevel_value == -1) {
/*
* Match is accepted. This is because on event creation, the
* loglevel is set to -1 if the event loglevel type is ALL so 0 and
* MUST be acquired before calling this.
*/
struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
- char *name, struct lttng_filter_bytecode *filter, int loglevel,
- struct lttng_event_exclusion *exclusion)
+ char *name, struct lttng_filter_bytecode *filter,
+ int loglevel_value, struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
key.name = name;
key.filter = filter;
- key.loglevel = loglevel;
+ key.loglevel_type = loglevel_value;
key.exclusion = exclusion;
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
struct ltt_ust_ht_key {
const char *name;
const struct lttng_filter_bytecode *filter;
- enum lttng_ust_loglevel_type loglevel;
+ enum lttng_ust_loglevel_type loglevel_type;
const struct lttng_event_exclusion *exclusion;
};
* Lookup functions. NULL is returned if not found.
*/
struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
- char *name, struct lttng_filter_bytecode *filter, int loglevel,
- struct lttng_event_exclusion *exclusion);
+ char *name, struct lttng_filter_bytecode *filter,
+ int loglevel_value, struct lttng_event_exclusion *exclusion);
struct ltt_ust_channel *trace_ust_find_channel_by_name(struct lttng_ht *ht,
char *name);
struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
return 0;
}
static inline struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
- char *name, struct lttng_filter_bytecode *filter, int loglevel,
- struct lttng_event_exclusion *exclusion)
+ char *name, struct lttng_filter_bytecode *filter,
+ int loglevel_value, struct lttng_event_exclusion *exclusion)
{
return NULL;
}
{
struct ust_app_event *event;
const struct ust_app_ht_key *key;
+ int ev_loglevel_value;
assert(node);
assert(_key);
event = caa_container_of(node, struct ust_app_event, node.node);
key = _key;
+ ev_loglevel_value = event->attr.loglevel;
/* Match the 4 elements of the key: name, filter, loglevel, exclusions */
}
/* Event loglevel. */
- if (event->attr.loglevel != key->loglevel) {
+ if (ev_loglevel_value != key->loglevel_type) {
if (event->attr.loglevel_type == LTTNG_UST_LOGLEVEL_ALL
- && key->loglevel == 0 && event->attr.loglevel == -1) {
+ && key->loglevel_type == 0 &&
+ ev_loglevel_value == -1) {
/*
* Match is accepted. This is because on event creation, the
* loglevel is set to -1 if the event loglevel type is ALL so 0 and
ht = ua_chan->events;
key.name = event->attr.name;
key.filter = event->filter;
- key.loglevel = event->attr.loglevel;
+ key.loglevel_type = event->attr.loglevel;
key.exclusion = event->exclusion;
node_ptr = cds_lfht_add_unique(ht->ht,
* Return an ust_app_event object or NULL on error.
*/
static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
- char *name, struct lttng_filter_bytecode *filter, int loglevel,
+ char *name, struct lttng_filter_bytecode *filter,
+ int loglevel_value,
const struct lttng_event_exclusion *exclusion)
{
struct lttng_ht_iter iter;
/* Setup key for event lookup. */
key.name = name;
key.filter = filter;
- key.loglevel = loglevel;
+ key.loglevel_type = loglevel_value;
/* lttng_event_exclusion and lttng_ust_event_exclusion structures are similar */
key.exclusion = exclusion;
* On success 0 is returned else a negative value.
*/
static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
- char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
- char *model_emf_uri)
+ char *sig, size_t nr_fields, struct ustctl_field *fields,
+ int loglevel_value, char *model_emf_uri)
{
int ret, ret_code;
uint32_t event_id = 0;
* three variables MUST NOT be read/write after this.
*/
ret_code = ust_registry_create_event(registry, chan_reg_key,
- sobjd, cobjd, name, sig, nr_fields, fields, loglevel,
- model_emf_uri, ua_sess->buffer_type, &event_id,
- app);
+ sobjd, cobjd, name, sig, nr_fields, fields,
+ loglevel_value, model_emf_uri, ua_sess->buffer_type,
+ &event_id, app);
/*
* The return value is returned to ustctl so in case of an error, the
switch (cmd) {
case USTCTL_NOTIFY_CMD_EVENT:
{
- int sobjd, cobjd, loglevel;
+ int sobjd, cobjd, loglevel_value;
char name[LTTNG_UST_SYM_NAME_LEN], *sig, *model_emf_uri;
size_t nr_fields;
struct ustctl_field *fields;
DBG2("UST app ustctl register event received");
- ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name, &loglevel,
- &sig, &nr_fields, &fields, &model_emf_uri);
+ ret = ustctl_recv_register_event(sock, &sobjd, &cobjd, name,
+ &loglevel_value, &sig, &nr_fields, &fields,
+ &model_emf_uri);
if (ret < 0) {
if (ret != -EPIPE && ret != -LTTNG_UST_ERR_EXITING) {
ERR("UST app recv event failed with ret %d", ret);
* to the this function.
*/
ret = add_event_ust_registry(sock, sobjd, cobjd, name, sig, nr_fields,
- fields, loglevel, model_emf_uri);
+ fields, loglevel_value, model_emf_uri);
if (ret < 0) {
goto error;
}
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef _LTT_UST_APP_H
+#ifndef _LTT_UST_APP_H
#define _LTT_UST_APP_H
#include <stdint.h>
struct ust_app_ht_key {
const char *name;
const struct lttng_filter_bytecode *filter;
- enum lttng_ust_loglevel_type loglevel;
+ enum lttng_ust_loglevel_type loglevel_type;
const struct lttng_event_exclusion *exclusion;
};
ret = lttng_metadata_printf(session,
" loglevel = %d;\n",
- event->loglevel);
+ event->loglevel_value);
if (ret)
goto end;
*/
static struct ust_registry_event *alloc_event(int session_objd,
int channel_objd, char *name, char *sig, size_t nr_fields,
- struct ustctl_field *fields, int loglevel, char *model_emf_uri,
- struct ust_app *app)
+ struct ustctl_field *fields, int loglevel_value,
+ char *model_emf_uri, struct ust_app *app)
{
struct ust_registry_event *event = NULL;
event->signature = sig;
event->nr_fields = nr_fields;
event->fields = fields;
- event->loglevel = loglevel;
+ event->loglevel_value = loglevel_value;
event->model_emf_uri = model_emf_uri;
if (name) {
/* Copy event name and force NULL byte. */
*/
int ust_registry_create_event(struct ust_registry_session *session,
uint64_t chan_key, int session_objd, int channel_objd, char *name,
- char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
- char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
- struct ust_app *app)
+ char *sig, size_t nr_fields, struct ustctl_field *fields,
+ int loglevel_value, char *model_emf_uri, int buffer_type,
+ uint32_t *event_id_p, struct ust_app *app)
{
int ret;
uint32_t event_id;
}
event = alloc_event(session_objd, channel_objd, name, sig, nr_fields,
- fields, loglevel, model_emf_uri, app);
+ fields, loglevel_value, model_emf_uri, app);
if (!event) {
ret = -ENOMEM;
goto error_free;
/* Name of the event returned by the tracer. */
char name[LTTNG_UST_SYM_NAME_LEN];
char *signature;
- int loglevel;
+ int loglevel_value;
size_t nr_fields;
struct ustctl_field *fields;
char *model_emf_uri;
int ust_registry_create_event(struct ust_registry_session *session,
uint64_t chan_key, int session_objd, int channel_objd, char *name,
- char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
- char *model_emf_uri, int buffer_type, uint32_t *event_id_p,
- struct ust_app *app);
+ char *sig, size_t nr_fields, struct ustctl_field *fields,
+ int loglevel_value, char *model_emf_uri, int buffer_type,
+ uint32_t *event_id_p, struct ust_app *app);
struct ust_registry_event *ust_registry_find_event(
struct ust_registry_channel *chan, char *name, char *sig);
void ust_registry_destroy_event(struct ust_registry_channel *chan,
static inline
int ust_registry_create_event(struct ust_registry_session *session,
uint64_t chan_key, int session_objd, int channel_objd, char *name,
- char *sig, size_t nr_fields, struct ustctl_field *fields, int loglevel,
- char *model_emf_uri, int buffer_type, uint32_t *event_id_p)
+ char *sig, size_t nr_fields, struct ustctl_field *fields,
+ int loglevel_value, char *model_emf_uri, int buffer_type,
+ uint32_t *event_id_p)
{
return 0;
}
* Enable event command payload.
*/
struct lttcomm_agent_enable {
- uint32_t loglevel;
+ uint32_t loglevel_value;
uint32_t loglevel_type;
char name[LTTNG_SYMBOL_NAME_LEN];
} LTTNG_PACKED;