Add new snapshot ustctl API
[lttng-tools.git] / src / bin / lttng-sessiond / lttng-ust-ctl.h
index fc5c794743646f5b38fb0b0b4eb5014732fdbd64..cba0e272d6a37a47d9e14b7893ef8aab0f0f861e 100644 (file)
 #ifndef _LTTNG_UST_CTL_H
 #define _LTTNG_UST_CTL_H
 
-#include <lttng/ust-abi.h>
 #include <sys/types.h>
 
+#include "lttng-ust-abi.h"
+
 #ifndef LTTNG_UST_UUID_LEN
 #define LTTNG_UST_UUID_LEN     16
 #endif
@@ -44,7 +45,7 @@ struct lttng_ust_lib_ring_buffer;
 
 struct ustctl_consumer_channel_attr {
        enum lttng_ust_chan_type type;
-       uint64_t subbuf_size;                   /* bytes */
+       uint64_t subbuf_size;                   /* bytes, power of 2 */
        uint64_t num_subbuf;                    /* power of 2 */
        int overwrite;                          /* 1: overwrite, 0: discard */
        unsigned int switch_timer_interval;     /* usec */
@@ -58,6 +59,17 @@ struct ustctl_consumer_channel_attr {
  * API used by sessiond.
  */
 
+struct lttng_ust_context_attr {
+       enum lttng_ust_context_type ctx;
+       union {
+               struct lttng_ust_perf_counter_ctx perf_counter;
+               struct {
+                       char *provider_name;
+                       char *ctx_name;
+               } app_ctx;
+       } u;
+};
+
 /*
  * Error values: all the following functions return:
  * >= 0: Success (LTTNG_UST_OK)
@@ -68,7 +80,7 @@ int ustctl_create_session(int sock);
 int ustctl_create_event(int sock, struct lttng_ust_event *ev,
                struct lttng_ust_object_data *channel_data,
                struct lttng_ust_object_data **event_data);
-int ustctl_add_context(int sock, struct lttng_ust_context *ctx,
+int ustctl_add_context(int sock, struct lttng_ust_context_attr *ctx,
                struct lttng_ust_object_data *obj_data,
                struct lttng_ust_object_data **context_data);
 int ustctl_set_filter(int sock, struct lttng_ust_filter_bytecode *bytecode,
@@ -112,8 +124,6 @@ int ustctl_wait_quiescent(int sock);
 
 int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object);
 
-int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate);
-
 /* Release object created by members of this API. */
 int ustctl_release_object(int sock, struct lttng_ust_object_data *data);
 /* Release handle returned by create session. */
@@ -205,6 +215,7 @@ int ustctl_put_next_subbuf(struct ustctl_consumer_stream *stream);
 /* snapshot */
 
 int ustctl_snapshot(struct ustctl_consumer_stream *stream);
+int ustctl_snapshot_sample_positions(struct ustctl_consumer_stream *stream);
 int ustctl_snapshot_get_consumed(struct ustctl_consumer_stream *stream,
                unsigned long *pos);
 int ustctl_snapshot_get_produced(struct ustctl_consumer_stream *stream,
@@ -226,6 +237,7 @@ enum ustctl_socket_type {
 enum ustctl_notify_cmd {
        USTCTL_NOTIFY_CMD_EVENT = 0,
        USTCTL_NOTIFY_CMD_CHANNEL = 1,
+       USTCTL_NOTIFY_CMD_ENUM = 2,
 };
 
 enum ustctl_channel_header {
@@ -259,7 +271,7 @@ struct ustctl_integer_type {
        uint32_t signedness;
        uint32_t reverse_byte_order;
        uint32_t base;          /* 2, 8, 10, 16, for pretty print */
-       enum ustctl_string_encodings encoding;
+       int32_t encoding;
        uint16_t alignment;     /* in bits */
        char padding[USTCTL_UST_INTEGER_TYPE_PADDING];
 } LTTNG_PACKED;
@@ -273,13 +285,39 @@ struct ustctl_float_type {
        char padding[USTCTL_UST_FLOAT_TYPE_PADDING];
 } LTTNG_PACKED;
 
+#define USTCTL_UST_ENUM_VALUE_PADDING  15
+struct ustctl_enum_value {
+       uint64_t value;
+       uint8_t signedness;
+       char padding[USTCTL_UST_ENUM_VALUE_PADDING];
+} LTTNG_PACKED;
+
+enum ustctl_ust_enum_entry_options {
+       USTCTL_UST_ENUM_ENTRY_OPTION_IS_AUTO = 1U << 0,
+};
+
+#define USTCTL_UST_ENUM_ENTRY_PADDING  32
+struct ustctl_enum_entry {
+       struct ustctl_enum_value start, end; /* start and end are inclusive */
+       char string[LTTNG_UST_SYM_NAME_LEN];
+       union {
+               struct {
+                       uint32_t options;
+               } LTTNG_PACKED extra;
+               char padding[USTCTL_UST_ENUM_ENTRY_PADDING];
+       } u;
+} LTTNG_PACKED;
+
 #define USTCTL_UST_BASIC_TYPE_PADDING  296
 union _ustctl_basic_type {
        struct ustctl_integer_type integer;
        struct {
-               enum ustctl_string_encodings encoding;
+               int32_t encoding;
        } string;
        struct ustctl_float_type _float;
+       struct {
+               char name[LTTNG_UST_SYM_NAME_LEN];
+       } enumeration;
        char padding[USTCTL_UST_BASIC_TYPE_PADDING];
 } LTTNG_PACKED;
 
@@ -355,7 +393,7 @@ int ustctl_recv_register_event(int sock,
                                         * event name (output,
                                         * size LTTNG_UST_SYM_NAME_LEN)
                                         */
-       int *loglevel,
+       int *loglevel_value,
        char **signature,               /*
                                         * event signature
                                         * (output, dynamically
@@ -374,6 +412,22 @@ int ustctl_reply_register_event(int sock,
        uint32_t id,                    /* event id (input) */
        int ret_code);                  /* return code. 0 ok, negative error */
 
+/*
+ * Returns 0 on success, negative UST or system error value on error.
+ */
+int ustctl_recv_register_enum(int sock,
+       int *session_objd,
+       char *enum_name,
+       struct ustctl_enum_entry **entries,
+       unsigned int *nr_entries);
+
+/*
+ * Returns 0 on success, negative error value on error.
+ */
+int ustctl_reply_register_enum(int sock,
+       int64_t id,                     /* enum id (input) */
+       int ret_code);
+
 /*
  * Returns 0 on success, negative UST or system error value on error.
  */
This page took 0.026479 seconds and 4 git commands to generate.