Implement event notifier error counter
[lttng-modules.git] / include / lttng / abi.h
index 7456f4a12550b1ef3f31d6c9a31265b1b5ff660e..843acbe72fc5f51af91c679eba6f27793d872bb3 100644 (file)
@@ -11,6 +11,7 @@
 #define _LTTNG_ABI_H
 
 #include <linux/fs.h>
+#include <linux/types.h>
 
 /*
  * Major/minor version of ABI exposed to lttng tools. Major number
@@ -50,7 +51,7 @@ struct lttng_kernel_channel {
        uint64_t num_subbuf;
        unsigned int switch_timer_interval;     /* usecs */
        unsigned int read_timer_interval;       /* usecs */
-       enum lttng_kernel_output output;        /* splice, mmap */
+       uint32_t output;                        /* enum lttng_kernel_output (splice, mmap) */
        int overwrite;                          /* 1: overwrite, 0: discard */
        char padding[LTTNG_KERNEL_CHANNEL_PADDING];
 } __attribute__((packed));
@@ -90,14 +91,40 @@ struct lttng_kernel_event_callsite {
        } u;
 } __attribute__((packed));
 
+enum lttng_kernel_syscall_entryexit {
+       LTTNG_KERNEL_SYSCALL_ENTRYEXIT  = 0,
+       LTTNG_KERNEL_SYSCALL_ENTRY      = 1,
+       LTTNG_KERNEL_SYSCALL_EXIT       = 2,
+};
+
+enum lttng_kernel_syscall_abi {
+       LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
+       LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,
+       LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,
+};
+
+enum lttng_kernel_syscall_match {
+       LTTNG_KERNEL_SYSCALL_MATCH_NAME = 0,
+       LTTNG_KERNEL_SYSCALL_MATCH_NR = 1,              /* Not implemented. */
+};
+
+struct lttng_kernel_syscall {
+       uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
+       uint8_t abi;            /* enum lttng_kernel_syscall_abi */
+       uint8_t match;          /* enum lttng_kernel_syscall_match */
+       uint8_t padding;
+       uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
+} __attribute__((packed));
+
 /*
  * For syscall tracing, name = "*" means "enable all".
  */
-#define LTTNG_KERNEL_EVENT_PADDING1    16
+#define LTTNG_KERNEL_EVENT_PADDING1    8
 #define LTTNG_KERNEL_EVENT_PADDING2    LTTNG_KERNEL_SYM_NAME_LEN + 32
 struct lttng_kernel_event {
        char name[LTTNG_KERNEL_SYM_NAME_LEN];   /* event name */
-       enum lttng_kernel_instrumentation instrumentation;
+       uint32_t instrumentation;               /* enum lttng_kernel_instrumentation */
+       uint64_t token;                         /* User-provided token */
        char padding[LTTNG_KERNEL_EVENT_PADDING1];
 
        /* Per instrumentation type configuration */
@@ -106,10 +133,84 @@ struct lttng_kernel_event {
                struct lttng_kernel_kprobe kprobe;
                struct lttng_kernel_function_tracer ftrace;
                struct lttng_kernel_uprobe uprobe;
+               struct lttng_kernel_syscall syscall;
                char padding[LTTNG_KERNEL_EVENT_PADDING2];
        } u;
 } __attribute__((packed));
 
+#define LTTNG_KERNEL_EVENT_NOTIFIER_PADDING1   16
+struct lttng_kernel_event_notifier {
+       struct lttng_kernel_event event;
+       uint64_t error_counter_index;
+
+       char padding[LTTNG_KERNEL_EVENT_NOTIFIER_PADDING1];
+} __attribute__((packed));
+
+enum lttng_kernel_counter_arithmetic {
+    LTTNG_KERNEL_COUNTER_ARITHMETIC_MODULAR = 1,
+};
+
+enum lttng_kernel_counter_bitness {
+    LTTNG_KERNEL_COUNTER_BITNESS_32 = 1,
+    LTTNG_KERNEL_COUNTER_BITNESS_64 = 2,
+};
+
+struct lttng_kernel_counter_dimension {
+       uint64_t size;
+       uint64_t underflow_index;
+       uint64_t overflow_index;
+       uint8_t has_underflow;
+       uint8_t has_overflow;
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_COUNTER_DIMENSION_MAX 4
+struct lttng_kernel_counter_conf {
+       uint32_t arithmetic;    /* enum lttng_kernel_counter_arithmetic */
+       uint32_t bitness;       /* enum lttng_kernel_counter_bitness */
+       uint32_t number_dimensions;
+       int64_t global_sum_step;
+       struct lttng_kernel_counter_dimension dimensions[LTTNG_KERNEL_COUNTER_DIMENSION_MAX];
+} __attribute__((packed));
+
+struct lttng_kernel_counter_index {
+       uint32_t number_dimensions;
+       uint64_t dimension_indexes[LTTNG_KERNEL_COUNTER_DIMENSION_MAX];
+} __attribute__((packed));
+
+struct lttng_kernel_counter_value {
+       int64_t value;
+       uint8_t underflow;
+       uint8_t overflow;
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_COUNTER_READ_PADDING 32
+struct lttng_kernel_counter_read {
+       struct lttng_kernel_counter_index index;
+       int32_t cpu;    /* -1 for global counter, >= 0 for specific cpu. */
+       struct lttng_kernel_counter_value value;        /* output */
+       char padding[LTTNG_KERNEL_COUNTER_READ_PADDING];
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_COUNTER_AGGREGATE_PADDING 32
+struct lttng_kernel_counter_aggregate {
+       struct lttng_kernel_counter_index index;
+       struct lttng_kernel_counter_value value;        /* output */
+       char padding[LTTNG_KERNEL_COUNTER_AGGREGATE_PADDING];
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_COUNTER_CLEAR_PADDING 32
+struct lttng_kernel_counter_clear {
+       struct lttng_kernel_counter_index index;
+       char padding[LTTNG_KERNEL_COUNTER_CLEAR_PADDING];
+} __attribute__((packed));
+
+#define LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING 32
+struct lttng_kernel_event_notifier_notification {
+       uint64_t token;
+       uint16_t capture_buf_size;
+       char padding[LTTNG_KERNEL_EVENT_NOTIFIER_NOTIFICATION_PADDING];
+} __attribute__((packed));
+
 struct lttng_kernel_tracer_version {
        uint32_t major;
        uint32_t minor;
@@ -134,7 +235,7 @@ enum lttng_kernel_calibrate_type {
 };
 
 struct lttng_kernel_calibrate {
-       enum lttng_kernel_calibrate_type type;  /* type (input) */
+       uint32_t type;  /* enum lttng_kernel_calibrate_type (input) */
 } __attribute__((packed));
 
 struct lttng_kernel_syscall_mask {
@@ -192,7 +293,7 @@ struct lttng_kernel_perf_counter_ctx {
 #define LTTNG_KERNEL_CONTEXT_PADDING1  16
 #define LTTNG_KERNEL_CONTEXT_PADDING2  LTTNG_KERNEL_SYM_NAME_LEN + 32
 struct lttng_kernel_context {
-       enum lttng_kernel_context_type ctx;
+       uint32_t ctx;   /*enum lttng_kernel_context_type */
        char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
 
        union {
@@ -209,6 +310,14 @@ struct lttng_kernel_filter_bytecode {
        char data[0];
 } __attribute__((packed));
 
+#define LTTNG_KERNEL_CAPTURE_BYTECODE_MAX_LEN          65536
+struct lttng_kernel_capture_bytecode {
+       uint32_t len;
+       uint32_t reloc_offset;
+       uint64_t seqnum;
+       char data[0];
+} __attribute__((packed));
+
 enum lttng_kernel_tracker_type {
        LTTNG_KERNEL_TRACKER_UNKNOWN            = -1,
 
@@ -221,7 +330,7 @@ enum lttng_kernel_tracker_type {
 };
 
 struct lttng_kernel_tracker_args {
-       enum lttng_kernel_tracker_type type;
+       uint32_t type;  /* enum lttng_kernel_tracker_type */
        int32_t id;
 };
 
@@ -237,6 +346,7 @@ struct lttng_kernel_tracker_args {
 #define LTTNG_KERNEL_SYSCALL_LIST              _IO(0xF6, 0x4A)
 #define LTTNG_KERNEL_TRACER_ABI_VERSION                \
        _IOR(0xF6, 0x4B, struct lttng_kernel_tracer_abi_version)
+#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_CREATE    _IO(0xF6, 0x4C)
 
 /* Session FD ioctl */
 /* lttng/abi-old.h reserve 0x50, 0x51, 0x52, and 0x53. */
@@ -279,12 +389,16 @@ struct lttng_kernel_tracker_args {
 #define LTTNG_KERNEL_CONTEXT                   \
        _IOW(0xF6, 0x71, struct lttng_kernel_context)
 
-/* Event, Channel and Session ioctl */
+/* Event, Event notifier, Channel, Counter and Session ioctl */
 /* lttng/abi-old.h reserve 0x80 and 0x81. */
 #define LTTNG_KERNEL_ENABLE                    _IO(0xF6, 0x82)
 #define LTTNG_KERNEL_DISABLE                   _IO(0xF6, 0x83)
 
-/* Event FD ioctl */
+/* Trigger group and session ioctl */
+#define LTTNG_KERNEL_COUNTER \
+       _IOW(0xF6, 0x84, struct lttng_kernel_counter_conf)
+
+/* Event and Event notifier FD ioctl */
 #define LTTNG_KERNEL_FILTER                    _IO(0xF6, 0x90)
 #define LTTNG_KERNEL_ADD_CALLSITE              _IO(0xF6, 0x91)
 
@@ -296,6 +410,24 @@ struct lttng_kernel_tracker_args {
 #define LTTNG_KERNEL_SESSION_UNTRACK_ID                \
        _IOR(0xF6, 0xA2, struct lttng_kernel_tracker_args)
 
+/* Event notifier group file descriptor ioctl */
+#define LTTNG_KERNEL_EVENT_NOTIFIER_CREATE \
+       _IOW(0xF6, 0xB0, struct lttng_kernel_event_notifier)
+#define LTTNG_KERNEL_EVENT_NOTIFIER_GROUP_NOTIFICATION_FD \
+       _IO(0xF6, 0xB1)
+
+/* Event notifier file descriptor ioctl */
+#define LTTNG_KERNEL_CAPTURE                   _IO(0xF6, 0xB8)
+
+/* Counter file descriptor ioctl */
+#define LTTNG_KERNEL_COUNTER_READ \
+       _IOWR(0xF6, 0xC0, struct lttng_kernel_counter_read)
+#define LTTNG_KERNEL_COUNTER_AGGREGATE \
+       _IOWR(0xF6, 0xC1, struct lttng_kernel_counter_aggregate)
+#define LTTNG_KERNEL_COUNTER_CLEAR \
+       _IOW(0xF6, 0xC2, struct lttng_kernel_counter_clear)
+
+
 /*
  * LTTng-specific ioctls for the lib ringbuffer.
  *
This page took 0.027492 seconds and 4 git commands to generate.