projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: use a free running channel key between sessiond and kernel consumer
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
trace-kernel.c
diff --git
a/src/bin/lttng-sessiond/trace-kernel.c
b/src/bin/lttng-sessiond/trace-kernel.c
index 5769576cd0ea47f9d0f11255cadcbbc2aaf8e3b7..ef5abbab4c3b20fe8d39165012e27b756234a43e 100644
(file)
--- a/
src/bin/lttng-sessiond/trace-kernel.c
+++ b/
src/bin/lttng-sessiond/trace-kernel.c
@@
-221,6
+221,7
@@
struct ltt_kernel_channel *trace_kernel_create_channel(
lkc->stream_count = 0;
lkc->event_count = 0;
lkc->enabled = 1;
lkc->stream_count = 0;
lkc->event_count = 0;
lkc->enabled = 1;
+ lkc->published_to_notification_thread = false;
/* Init linked list */
CDS_INIT_LIST_HEAD(&lkc->events_list.head);
CDS_INIT_LIST_HEAD(&lkc->stream_list.head);
/* Init linked list */
CDS_INIT_LIST_HEAD(&lkc->events_list.head);
CDS_INIT_LIST_HEAD(&lkc->stream_list.head);
@@
-256,11
+257,33
@@
struct ltt_kernel_context *trace_kernel_create_context(
if (ctx) {
memcpy(&kctx->ctx, ctx, sizeof(kctx->ctx));
}
if (ctx) {
memcpy(&kctx->ctx, ctx, sizeof(kctx->ctx));
}
+error:
+ return kctx;
+}
+
+/*
+ * Allocate and init a kernel context object from an existing kernel context
+ * object.
+ *
+ * Return the allocated object or NULL on error.
+ */
+struct ltt_kernel_context *trace_kernel_copy_context(
+ struct ltt_kernel_context *kctx)
+{
+ struct ltt_kernel_context *kctx_copy;
- CDS_INIT_LIST_HEAD(&kctx->list);
+ assert(kctx);
+ kctx_copy = zmalloc(sizeof(*kctx_copy));
+ if (!kctx_copy) {
+ PERROR("zmalloc ltt_kernel_context");
+ goto error;
+ }
+
+ memcpy(kctx_copy, kctx, sizeof(*kctx_copy));
+ memset(&kctx_copy->list, 0, sizeof(kctx_copy->list));
error:
error:
- return kctx;
+ return kctx
_copy
;
}
/*
}
/*
@@
-478,7
+501,9
@@
void trace_kernel_destroy_context(struct ltt_kernel_context *ctx)
{
assert(ctx);
{
assert(ctx);
- cds_list_del(&ctx->list);
+ if (ctx->in_list) {
+ cds_list_del(&ctx->list);
+ }
free(ctx);
}
free(ctx);
}
@@
-522,10
+547,11
@@
void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
/* Remove from channel list */
cds_list_del(&channel->list);
/* Remove from channel list */
cds_list_del(&channel->list);
- if (notification_thread_handle) {
+ if (notification_thread_handle
+ && channel->published_to_notification_thread) {
status = notification_thread_command_remove_channel(
notification_thread_handle,
status = notification_thread_command_remove_channel(
notification_thread_handle,
- channel->
fd
, LTTNG_DOMAIN_KERNEL);
+ channel->
key
, LTTNG_DOMAIN_KERNEL);
assert(status == LTTNG_OK);
}
free(channel->channel->attr.extended.ptr);
assert(status == LTTNG_OK);
}
free(channel->channel->attr.extended.ptr);
This page took
0.024417 seconds
and
4
git commands to generate.