SoW-2020-0002: Trace Hit Counters: trigger error reporting integration
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.c
index 10e281d69315a638a24b96102b601415eeb18801..386685c2a593947b154bf87f91757a601d565d92 100644 (file)
@@ -418,7 +418,51 @@ int kernctl_stop_session(int fd)
                        LTTNG_KERNEL_SESSION_STOP);
 }
 
-int kernctl_filter(int fd, struct lttng_filter_bytecode *filter)
+int kernctl_create_trigger_group(int fd)
+{
+       return LTTNG_IOCTL_NO_CHECK(fd, LTTNG_KERNEL_TRIGGER_GROUP_CREATE);
+}
+
+int kernctl_create_trigger_group_notification_fd(int group_fd)
+{
+       return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_TRIGGER_GROUP_NOTIFICATION_FD);
+}
+
+int kernctl_create_trigger_group_error_counter(int group_fd, struct lttng_kernel_counter_conf *error_counter_conf)
+{
+       return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_COUNTER, error_counter_conf);
+}
+
+int kernctl_counter_get_value(int counter_fd, struct lttng_kernel_counter_value *value)
+{
+       return LTTNG_IOCTL_NO_CHECK(counter_fd, LTTNG_KERNEL_COUNTER_VALUE, value);
+}
+
+int kernctl_create_trigger(int group_fd, struct lttng_kernel_trigger *trigger)
+{
+               return LTTNG_IOCTL_NO_CHECK(group_fd, LTTNG_KERNEL_TRIGGER_CREATE, trigger);
+}
+
+int kernctl_capture(int fd, const struct lttng_bytecode *capture)
+{
+       struct lttng_kernel_capture_bytecode *kb;
+       uint32_t len;
+       int ret;
+
+       /* Translate bytecode to kernel bytecode */
+       kb = zmalloc(sizeof(*kb) + capture->len);
+       if (!kb)
+               return -ENOMEM;
+       kb->len = len = capture->len;
+       kb->reloc_offset = capture->reloc_table_offset;
+       kb->seqnum = capture->seqnum;
+       memcpy(kb->data, capture->data, len);
+       ret = LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_CAPTURE, kb);
+       free(kb);
+       return ret;
+}
+
+int kernctl_filter(int fd, const struct lttng_bytecode *filter)
 {
        struct lttng_kernel_filter_bytecode *kb;
        uint32_t len;
This page took 0.03262 seconds and 5 git commands to generate.