projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: lttng list of channels should return errors
[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 29432de49a0355b16863ab69189929a6c37719f3..5769576cd0ea47f9d0f11255cadcbbc2aaf8e3b7 100644
(file)
--- a/
src/bin/lttng-sessiond/trace-kernel.c
+++ b/
src/bin/lttng-sessiond/trace-kernel.c
@@
-26,6
+26,8
@@
#include "consumer.h"
#include "trace-kernel.h"
#include "consumer.h"
#include "trace-kernel.h"
+#include "lttng-sessiond.h"
+#include "notification-thread-commands.h"
/*
* Find the channel name for the given kernel session.
/*
* Find the channel name for the given kernel session.
@@
-179,6
+181,7
@@
struct ltt_kernel_channel *trace_kernel_create_channel(
struct lttng_channel *chan)
{
struct ltt_kernel_channel *lkc;
struct lttng_channel *chan)
{
struct ltt_kernel_channel *lkc;
+ struct lttng_channel_extended *extended = NULL;
assert(chan);
assert(chan);
@@
-191,10
+194,18
@@
struct ltt_kernel_channel *trace_kernel_create_channel(
lkc->channel = zmalloc(sizeof(struct lttng_channel));
if (lkc->channel == NULL) {
PERROR("lttng_channel zmalloc");
lkc->channel = zmalloc(sizeof(struct lttng_channel));
if (lkc->channel == NULL) {
PERROR("lttng_channel zmalloc");
- free(lkc);
+ goto error;
+ }
+
+ extended = zmalloc(sizeof(struct lttng_channel_extended));
+ if (!extended) {
+ PERROR("lttng_channel_channel zmalloc");
goto error;
}
memcpy(lkc->channel, chan, sizeof(struct lttng_channel));
goto error;
}
memcpy(lkc->channel, chan, sizeof(struct lttng_channel));
+ memcpy(extended, chan->attr.extended.ptr, sizeof(struct lttng_channel_extended));
+ lkc->channel->attr.extended.ptr = extended;
+ extended = NULL;
/*
* If we receive an empty string for channel name, it means the
/*
* If we receive an empty string for channel name, it means the
@@
-218,6
+229,11
@@
struct ltt_kernel_channel *trace_kernel_create_channel(
return lkc;
error:
return lkc;
error:
+ if (lkc) {
+ free(lkc->channel);
+ }
+ free(extended);
+ free(lkc);
return NULL;
}
return NULL;
}
@@
-475,6
+491,7
@@
void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
struct ltt_kernel_event *event, *etmp;
struct ltt_kernel_context *ctx, *ctmp;
int ret;
struct ltt_kernel_event *event, *etmp;
struct ltt_kernel_context *ctx, *ctmp;
int ret;
+ enum lttng_error_code status;
assert(channel);
assert(channel);
@@
-505,6
+522,13
@@
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) {
+ status = notification_thread_command_remove_channel(
+ notification_thread_handle,
+ channel->fd, LTTNG_DOMAIN_KERNEL);
+ assert(status == LTTNG_OK);
+ }
+ free(channel->channel->attr.extended.ptr);
free(channel->channel);
free(channel);
}
free(channel->channel);
free(channel);
}
This page took
0.024954 seconds
and
4
git commands to generate.