enum lttng_kernel_event_type {
LTTNG_KERNEL_EVENT_TYPE_RECORDER = 0,
LTTNG_KERNEL_EVENT_TYPE_NOTIFIER = 1,
+ LTTNG_KERNEL_EVENT_TYPE_COUNTER = 2
};
struct lttng_kernel_event_common {
bool lttng_id_tracker_lookup(struct lttng_kernel_id_tracker_rcu *p, int id);
+static inline
+struct lttng_kernel_channel_common *lttng_kernel_get_chan_common_from_event_common(
+ struct lttng_kernel_event_common *event)
+{
+ switch (event->type) {
+ case LTTNG_KERNEL_EVENT_TYPE_RECORDER:
+ {
+ struct lttng_kernel_event_recorder *event_recorder =
+ container_of(event, struct lttng_kernel_event_recorder, parent);
+ struct lttng_kernel_channel_buffer *chan_buf = event_recorder->chan;
+
+ return &chan_buf->parent;
+ }
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
+ {
+ struct lttng_kernel_event_counter *event_counter =
+ container_of(event, struct lttng_kernel_event_counter, parent);
+ struct lttng_kernel_channel_counter *chan_counter = event_counter->chan;
+
+ return &chan_counter->parent;
+ }
+ default:
+ return NULL;
+ }
+}
+
#endif /* _LTTNG_EVENTS_H */
static DEFINE_MUTEX(sessions_mutex);
static struct kmem_cache *event_recorder_cache;
static struct kmem_cache *event_recorder_private_cache;
+static struct kmem_cache *event_counter_cache;
+static struct kmem_cache *event_counter_private_cache;
static struct kmem_cache *event_notifier_cache;
static struct kmem_cache *event_notifier_private_cache;
kmem_cache_free(event_recorder_cache, event_recorder);
break;
}
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
+ {
+ struct lttng_kernel_event_counter *event_counter =
+ container_of(event, struct lttng_kernel_event_counter, parent);
+
+ kmem_cache_free(event_counter_private_cache, event_counter->priv);
+ kmem_cache_free(event_counter_cache, event_counter);
+ break;
+ }
case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
{
struct lttng_kernel_event_notifier *event_notifier =
case LTTNG_KERNEL_ABI_KRETPROBE:
switch (event->type) {
case LTTNG_KERNEL_EVENT_TYPE_RECORDER:
+ lttng_fallthrough;
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
ret = 0;
break;
case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
case LTTNG_KERNEL_ABI_KRETPROBE:
switch (event->type) {
case LTTNG_KERNEL_EVENT_TYPE_RECORDER:
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
lttng_kretprobes_unregister(event);
ret = 0;
break;
case LTTNG_KERNEL_ABI_NOOP:
switch (event->type) {
case LTTNG_KERNEL_EVENT_TYPE_RECORDER:
+ case LTTNG_KERNEL_EVENT_TYPE_COUNTER:
ret = 0;
break;
case LTTNG_KERNEL_EVENT_TYPE_NOTIFIER:
ret = -ENOMEM;
goto error_kmem_event_recorder_private;
}
+ event_counter_cache = KMEM_CACHE(lttng_kernel_event_counter, 0);
+ if (!event_counter_cache) {
+ ret = -ENOMEM;
+ goto error_kmem_event_counter;
+ }
+ event_counter_private_cache = KMEM_CACHE(lttng_kernel_event_counter_private, 0);
+ if (!event_counter_private_cache) {
+ ret = -ENOMEM;
+ goto error_kmem_event_counter_private;
+ }
event_notifier_cache = KMEM_CACHE(lttng_kernel_event_notifier, 0);
if (!event_notifier_cache) {
ret = -ENOMEM;
error_kmem_event_notifier_private:
kmem_cache_destroy(event_notifier_cache);
error_kmem_event_notifier:
+ kmem_cache_destroy(event_counter_private_cache);
+error_kmem_event_counter_private:
+ kmem_cache_destroy(event_counter_cache);
+error_kmem_event_counter:
kmem_cache_destroy(event_recorder_private_cache);
error_kmem_event_recorder_private:
kmem_cache_destroy(event_recorder_cache);
lttng_session_destroy(session_priv->pub);
kmem_cache_destroy(event_recorder_cache);
kmem_cache_destroy(event_recorder_private_cache);
+ kmem_cache_destroy(event_counter_cache);
+ kmem_cache_destroy(event_counter_private_cache);
kmem_cache_destroy(event_notifier_cache);
kmem_cache_destroy(event_notifier_private_cache);
lttng_tracepoint_exit();