Implement capturing payload on event notifiers
[deliverable/lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index 744f66ba6dc9824c00329540d41c88294644bb2c..b2fa8258163961c799d868c4f02f798c3e262558 100644 (file)
@@ -333,6 +333,37 @@ int ustctl_set_filter(int sock, struct lttng_ust_filter_bytecode *bytecode,
        return ustcomm_recv_app_reply(sock, &lur, lum.handle, lum.cmd);
 }
 
+int ustctl_set_capture(int sock, struct lttng_ust_capture_bytecode *bytecode,
+               struct lttng_ust_object_data *obj_data)
+{
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+       int ret;
+
+       if (!obj_data)
+               return -EINVAL;
+
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = obj_data->handle;
+       lum.cmd = LTTNG_UST_CAPTURE;
+       lum.u.capture.data_size = bytecode->len;
+       lum.u.capture.reloc_offset = bytecode->reloc_offset;
+       lum.u.capture.seqnum = bytecode->seqnum;
+
+       ret = ustcomm_send_app_msg(sock, &lum);
+       if (ret)
+               return ret;
+       /* send var len bytecode */
+       ret = ustcomm_send_unix_sock(sock, bytecode->data,
+                               bytecode->len);
+       if (ret < 0) {
+               return ret;
+       }
+       if (ret != bytecode->len)
+               return -EINVAL;
+       return ustcomm_recv_app_reply(sock, &lur, lum.handle, lum.cmd);
+}
+
 int ustctl_set_exclusion(int sock, struct lttng_ust_event_exclusion *exclusion,
                struct lttng_ust_object_data *obj_data)
 {
This page took 0.041759 seconds and 5 git commands to generate.