Calculate context length outside of retry loop
[lttng-ust.git] / liblttng-ust / lttng-ring-buffer-metadata-client.h
index f3c4a67c8843ea0e9514ff994e04ed16ef979c08..64940163d10250c4ba0e2dcbc60ee8df3f7e774d 100644 (file)
@@ -55,7 +55,8 @@ static inline
 size_t record_header_size(const struct lttng_ust_lib_ring_buffer_config *config,
                                 struct channel *chan, size_t offset,
                                 size_t *pre_header_padding,
-                                struct lttng_ust_lib_ring_buffer_ctx *ctx)
+                                struct lttng_ust_lib_ring_buffer_ctx *ctx,
+                                void *client_ctx)
 {
        return 0;
 }
@@ -72,7 +73,8 @@ static
 size_t client_record_header_size(const struct lttng_ust_lib_ring_buffer_config *config,
                                 struct channel *chan, size_t offset,
                                 size_t *pre_header_padding,
-                                struct lttng_ust_lib_ring_buffer_ctx *ctx)
+                                struct lttng_ust_lib_ring_buffer_ctx *ctx,
+                                void *client_ctx)
 {
        return 0;
 }
@@ -240,7 +242,18 @@ void lttng_channel_destroy(struct lttng_channel *chan)
 static
 int lttng_event_reserve(struct lttng_ust_lib_ring_buffer_ctx *ctx, uint32_t event_id)
 {
-       return lib_ring_buffer_reserve(&client_config, ctx);
+       int ret;
+
+       ret = lib_ring_buffer_reserve(&client_config, ctx, NULL);
+       if (ret)
+               return ret;
+       if (caa_likely(ctx->ctx_len
+                       >= sizeof(struct lttng_ust_lib_ring_buffer_ctx))) {
+               if (lib_ring_buffer_backend_get_pages(&client_config, ctx,
+                               &ctx->backend_pages))
+                       return -EPERM;
+       }
+       return 0;
 }
 
 static
This page took 0.029066 seconds and 4 git commands to generate.