Add trace C file called trace.c
authorDavid Goulet <david.goulet@polymtl.ca>
Mon, 2 May 2011 17:41:21 +0000 (13:41 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Mon, 2 May 2011 17:50:14 +0000 (13:50 -0400)
This file contains every useful fct to manage and deal
with lttng-tools' trace data structures.

Add missing headers to session.h to resolve the compiling
issues with trace.c.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/Makefile.am
ltt-sessiond/session.h
ltt-sessiond/trace.c [new file with mode: 0644]
ltt-sessiond/trace.h

index 4f4669da587cfdc82c67ebcda7df985a2a56c645..d24a23aec8ad04afc503fa03df140eb6380b4c0a 100644 (file)
@@ -3,7 +3,7 @@ AM_CFLAGS = -fno-strict-aliasing
 
 bin_PROGRAMS = ltt-sessiond
 
-ltt_sessiond_SOURCES = session.c traceable-app.c main.c
+ltt_sessiond_SOURCES = session.c trace.c traceable-app.c main.c
 
 ltt_sessiond_LDADD = \
                 $(top_builddir)/liblttsessiondcomm/liblttsessiondcomm.la
index 72183ef4b66d0396505ed6373aeb29b0999b5a57..6bc7c47994f1d0e2df439a8dc87cf777fddbe274 100644 (file)
@@ -19,6 +19,9 @@
 #ifndef _LTT_SESSION_H
 #define _LTT_SESSION_H
 
+#include <lttng/liblttngctl.h>
+#include <uuid/uuid.h>
+
 /* Global session list */
 struct ltt_session_list {
        struct cds_list_head head;
diff --git a/ltt-sessiond/trace.c b/ltt-sessiond/trace.c
new file mode 100644 (file)
index 0000000..7d9c40c
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+#define _GNU_SOURCE
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <urcu/list.h>
+
+#include "lttngerr.h"
+#include "trace.h"
+#include "session.h"
+
+/*
+ *  find_session_ust_trace_by_pid
+ *
+ *  Iterate over the session ust_traces and
+ *  return a pointer or NULL if not found.
+ */
+struct ltt_ust_trace *find_session_ust_trace_by_pid(struct ltt_session *session, pid_t pid)
+{
+       struct ltt_ust_trace *iter;
+
+       cds_list_for_each_entry(iter, &session->ust_traces, list) {
+               if (iter->pid == pid) {
+                       /* Found */
+                       return iter;
+               }
+       }
+
+       return NULL;
+}
+
index 9cbdaffd1dbb1da13f02d3ff80e6444b6b98df95..36b2f2270eef69bedd70aa570027da7f61660f22 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef _LTT_TRACE_H
 #define _LTT_TRACE_H
 
+#include "session.h"
+
 /* LTTng trace representation */
 struct ltt_lttng_trace {
        struct cds_list_head list;
@@ -40,4 +42,6 @@ struct ltt_ust_marker {
        char *channel;
 };
 
+struct ltt_ust_trace *find_session_ust_trace_by_pid(struct ltt_session *session, pid_t pid);
+
 #endif /* _LTT_TRACE_H */
This page took 0.04162 seconds and 4 git commands to generate.