futex error should be a warning
[lttng-ust.git] / libustctl / ustctl.c
index 735e63cb6f7d2cb58f182585b07620b087df8457..429cc445a0333b046eaad68247f188daacf53e1b 100644 (file)
 #include <ust/lttng-ust-ctl.h>
 #include <ust/lttng-ust-abi.h>
 #include <ust/usterr-signal-safe.h>
-#include "lttng-ust-comm.h"
+#include <ust/lttng-ust-comm.h>
 
 #include "../libringbuffer/backend.h"
 #include "../libringbuffer/frontend.h"
 
+volatile enum ust_loglevel ust_loglevel;
+
 static
 void init_object(struct object_data *data)
 {
@@ -53,6 +55,32 @@ void release_object(int sock, struct object_data *data)
        free(data);
 }
 
+/*
+ * Send registration done packet to the application.
+ */
+int ustctl_register_done(int sock)
+{
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+       int ret;
+
+       DBG("Sending register done command to %d", sock);
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = LTTNG_UST_ROOT_HANDLE;
+       lum.cmd = LTTNG_UST_REGISTER_DONE;
+       ret = ustcomm_send_app_cmd(sock, &lum, &lur);
+       if (ret)
+               return ret;
+       if (lur.ret_code != USTCOMM_OK) {
+               DBG("Return code: %s", ustcomm_get_readable_code(lur.ret_code));
+               goto error;
+       }
+       return 0;
+
+error:
+       return -1;
+}
+
 /*
  * returns session handle.
  */
@@ -263,7 +291,7 @@ int ustctl_create_event(int sock, struct lttng_ust_event *ev,
 }
 
 int ustctl_add_context(int sock, struct lttng_ust_context *ctx,
-               struct object_data *channel_data,
+               struct object_data *obj_data,
                struct object_data **_context_data)
 {
        struct ustcomm_ust_msg lum;
@@ -276,7 +304,7 @@ int ustctl_add_context(int sock, struct lttng_ust_context *ctx,
                return -ENOMEM;
        init_object(context_data);
        memset(&lum, 0, sizeof(lum));
-       lum.handle = channel_data->handle;
+       lum.handle = obj_data->handle;
        lum.cmd = LTTNG_UST_CONTEXT;
        lum.u.context.ctx = ctx->ctx;
        ret = ustcomm_send_app_cmd(sock, &lum, &lur);
@@ -324,14 +352,20 @@ int ustctl_disable(int sock, struct object_data *object)
        return 0;
 }
 
-int ustctl_start_session(int sock, struct object_data *object)
+int ustctl_start_session(int sock, int handle)
 {
-       return ustctl_enable(sock, object);
+       struct object_data obj;
+
+       obj.handle = handle;
+       return ustctl_enable(sock, &obj);
 }
 
-int ustctl_stop_session(int sock, struct object_data *object)
+int ustctl_stop_session(int sock, int handle)
 {
-       return ustctl_disable(sock, object);
+       struct object_data obj;
+
+       obj.handle = handle;
+       return ustctl_disable(sock, &obj);
 }
 
 
@@ -373,6 +407,17 @@ int ustctl_wait_quiescent(int sock)
        return 0;
 }
 
+int ustctl_flush_buffer(int sock, struct object_data *channel_data)
+{
+       struct ustcomm_ust_msg lum;
+       struct ustcomm_ust_reply lur;
+
+       memset(&lum, 0, sizeof(lum));
+       lum.handle = channel_data->handle;
+       lum.cmd = LTTNG_UST_FLUSH_BUFFER;
+       return ustcomm_send_app_cmd(sock, &lum, &lur);
+}
+
 int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate)
 {
        return -ENOSYS;
This page took 0.024851 seconds and 4 git commands to generate.