X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Ftrace-kernel.c;h=52f819b3001390fba5fb71c253a6321497649a01;hp=b9d03a72e002ca0042764a877f0ae556e87f1faa;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hpb=87597c2c3bbaa1502ad2025cbf16704829f3b464 diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index b9d03a72e..52f819b30 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2011 - David Goulet + * Copyright (C) 2011 David Goulet * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -28,6 +18,7 @@ #include #include +#include #include "consumer.h" #include "trace-kernel.h" @@ -38,7 +29,7 @@ * Find the channel name for the given kernel session. */ struct ltt_kernel_channel *trace_kernel_get_channel_by_name( - char *name, struct ltt_kernel_session *session) + const char *name, struct ltt_kernel_session *session) { struct ltt_kernel_channel *chan; @@ -163,6 +154,30 @@ struct ltt_kernel_session *trace_kernel_create_session(void) lks->metadata = NULL; CDS_INIT_LIST_HEAD(&lks->channel_list.head); + lks->tracker_list_pid = lttng_tracker_list_create(); + if (!lks->tracker_list_pid) { + goto error; + } + lks->tracker_list_vpid = lttng_tracker_list_create(); + if (!lks->tracker_list_vpid) { + goto error; + } + lks->tracker_list_uid = lttng_tracker_list_create(); + if (!lks->tracker_list_uid) { + goto error; + } + lks->tracker_list_vuid = lttng_tracker_list_create(); + if (!lks->tracker_list_vuid) { + goto error; + } + lks->tracker_list_gid = lttng_tracker_list_create(); + if (!lks->tracker_list_gid) { + goto error; + } + lks->tracker_list_vgid = lttng_tracker_list_create(); + if (!lks->tracker_list_vgid) { + goto error; + } lks->consumer = consumer_create_output(CONSUMER_DST_LOCAL); if (lks->consumer == NULL) { goto error; @@ -171,6 +186,12 @@ struct ltt_kernel_session *trace_kernel_create_session(void) return lks; error: + lttng_tracker_list_destroy(lks->tracker_list_pid); + lttng_tracker_list_destroy(lks->tracker_list_vpid); + lttng_tracker_list_destroy(lks->tracker_list_uid); + lttng_tracker_list_destroy(lks->tracker_list_vuid); + lttng_tracker_list_destroy(lks->tracker_list_gid); + lttng_tracker_list_destroy(lks->tracker_list_vgid); free(lks); alloc_error: @@ -709,9 +730,20 @@ void trace_kernel_destroy_session(struct ltt_kernel_session *session) cds_list_for_each_entry_safe(channel, ctmp, &session->channel_list.head, list) { trace_kernel_destroy_channel(channel); } +} +/* Free elements needed by destroy notifiers. */ +void trace_kernel_free_session(struct ltt_kernel_session *session) +{ /* Wipe consumer output object */ consumer_output_put(session->consumer); + lttng_tracker_list_destroy(session->tracker_list_pid); + lttng_tracker_list_destroy(session->tracker_list_vpid); + lttng_tracker_list_destroy(session->tracker_list_uid); + lttng_tracker_list_destroy(session->tracker_list_vuid); + lttng_tracker_list_destroy(session->tracker_list_gid); + lttng_tracker_list_destroy(session->tracker_list_vgid); + free(session); }