trackers: support tracking feature
[lttng-tools.git] / src / bin / lttng-sessiond / trace-kernel.c
index dcb1bd647b9a0a622b6cbd39c94979d1e0d30e1a..22c602ceec7f714ef83666c45b82169b927e7698 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <common/common.h>
 #include <common/defaults.h>
+#include <common/trace-chunk.h>
 
 #include "consumer.h"
 #include "trace-kernel.h"
@@ -38,7 +39,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 +164,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 +196,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:
@@ -328,8 +359,8 @@ enum lttng_error_code trace_kernel_create_event(
                break;
        case LTTNG_EVENT_USERSPACE_PROBE:
        {
-               struct lttng_userspace_probe_location* location = NULL;
-               struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
+               const struct lttng_userspace_probe_location* location = NULL;
+               const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
 
                location = lttng_event_get_userspace_probe_location(ev);
                if (!location) {
@@ -709,9 +740,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);
 }
This page took 0.02542 seconds and 5 git commands to generate.