#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)
{
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.
*/
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;
channel_destroy(chan, handle, 1);
}
+struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle,
+ int cpu)
+{
+ struct channel *chan = handle->shadow_chan;
+ int shm_fd, wait_fd;
+ uint64_t memory_map_size;
+ struct lib_ring_buffer *buf;
+ int ret;
+
+ buf = channel_get_ring_buffer(&chan->backend.config,
+ chan, cpu, handle, &shm_fd, &wait_fd, &memory_map_size);
+ if (!buf)
+ return NULL;
+ ret = lib_ring_buffer_open_read(buf, handle, 1);
+ if (ret)
+ return NULL;
+ return buf;
+}
+
+void ustctl_close_stream_read(struct shm_handle *handle,
+ struct lib_ring_buffer *buf)
+{
+ lib_ring_buffer_release_read(buf, handle, 1);
+}
+
/* For mmap mode, readable without "get" operation */
+void *ustctl_get_mmap_base(struct shm_handle *handle,
+ struct lib_ring_buffer *buf)
+{
+ return shmp(handle, buf->backend.memory_map);
+}
+
/* returns the length to mmap. */
int ustctl_get_mmap_len(struct shm_handle *handle,
struct lib_ring_buffer *buf,