projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests fix: initialize UST extended channel attributes
[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 33a9e7e5578daf8454e5ccc97bc3d97d85e7934f..d6ee8e8afb23401b2420e430bdd892dd0acc714d 100644
(file)
--- a/
src/bin/lttng-sessiond/trace-kernel.c
+++ b/
src/bin/lttng-sessiond/trace-kernel.c
@@
-15,7
+15,6
@@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
#define _LGPL_SOURCE
#include <stdio.h>
#include <stdlib.h>
#define _LGPL_SOURCE
#include <stdio.h>
#include <stdlib.h>
@@
-27,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.
@@
-162,14
+163,6
@@
struct ltt_kernel_session *trace_kernel_create_session(void)
goto error;
}
goto error;
}
- /*
- * The tmp_consumer stays NULL until a set_consumer_uri command is
- * executed. At this point, the consumer should be nullify until an
- * enable_consumer command. This assignment is symbolic since we've zmalloc
- * the struct.
- */
- lks->tmp_consumer = NULL;
-
return lks;
error:
return lks;
error:
@@
-188,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;
assert(chan);
assert(chan);
@@
-200,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
@@
-227,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;
}
@@
-258,6
+265,7
@@
error:
/*
* Allocate and initialize a kernel event. Set name and event type.
/*
* Allocate and initialize a kernel event. Set name and event type.
+ * We own filter_expression, and filter.
*
* Return pointer to structure or NULL.
*/
*
* Return pointer to structure or NULL.
*/
@@
-327,6
+335,8
@@
struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev,
return lke;
error:
return lke;
error:
+ free(filter_expression);
+ free(filter);
free(lke);
free(attr);
return NULL;
free(lke);
free(attr);
return NULL;
@@
-481,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);
@@
-511,6
+522,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);
+ 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);
}
@@
-575,8
+591,7
@@
void trace_kernel_destroy_session(struct ltt_kernel_session *session)
}
/* Wipe consumer output object */
}
/* Wipe consumer output object */
- consumer_destroy_output(session->consumer);
- consumer_destroy_output(session->tmp_consumer);
+ consumer_output_put(session->consumer);
free(session);
}
free(session);
}
This page took
0.025243 seconds
and
4
git commands to generate.