event->type = LTTNG_EVENT_SYSCALL;
}
+/*
+ * Return 1 if loglevels match or 0 on failure.
+ */
+static int loglevel_match(struct ltt_ust_event *uevent,
+ enum lttng_ust_loglevel_type log_type, int loglevel)
+{
+ if (uevent == NULL || uevent->attr.loglevel_type != log_type ||
+ uevent->attr.loglevel != loglevel) {
+ goto no_match;
+ }
+
+ return 1;
+
+no_match:
+ return 0;
+}
+
/*
* Disable kernel tracepoint event for a channel from the kernel session.
*/
to_create = 1;
}
+ /* Check loglevels */
+ ret = loglevel_match(uevent, event->loglevel_type, event->loglevel);
+ if (ret == 0) {
+ /*
+ * No match meaning that the user tried to enable a known event but
+ * with a different loglevel.
+ */
+ DBG("Enable event %s does not match existing event %s with loglevel "
+ "respectively of %d and %d", event->name, uevent->attr.name,
+ uevent->attr.loglevel, event->loglevel);
+ ret = LTTCOMM_EVENT_EXIST_LOGLEVEL;
+ goto error;
+ }
+
if (uevent->enabled) {
/* It's already enabled so everything is OK */
+ ret = LTTCOMM_OK;
goto end;
}
[ LTTCOMM_ERR_INDEX(LTTCOMM_INVALID) ] = "Invalid parameter",
[ LTTCOMM_ERR_INDEX(LTTCOMM_NO_USTCONSUMERD) ] = "No UST consumer detected",
[ LTTCOMM_ERR_INDEX(LTTCOMM_NO_KERNCONSUMERD) ] = "No kernel consumer detected",
+ [ LTTCOMM_ERR_INDEX(LTTCOMM_EVENT_EXIST_LOGLEVEL) ] = "Event already enabled with different loglevel",
};
/*
LTTCOMM_INVALID, /* Invalid parameter */
LTTCOMM_NO_USTCONSUMERD, /* No UST consumer detected */
LTTCOMM_NO_KERNCONSUMERD, /* No Kernel consumer detected */
+ LTTCOMM_EVENT_EXIST_LOGLEVEL, /* Event already enabled with different loglevel */
/* MUST be last element */
LTTCOMM_NR, /* Last element */