libustcomm: change char * to const char * where relevant
[ust.git] / libust / marker.c
index cebf07dde412e18dc34353a1216f6a1f9ac2b9de..8e2a398ef23f915b6e7e8cf7e76cba5cd9c0d2a8 100644 (file)
@@ -33,7 +33,7 @@
 #define _LGPL_SOURCE
 #include <urcu-bp.h>
 
-#include "kernelcompat.h"
+#include <ust/kernelcompat.h>
 
 #include <ust/marker.h>
 #include "usterr.h"
@@ -41,6 +41,9 @@
 #include "tracercore.h"
 #include "tracer.h"
 
+__thread long ust_reg_stack[500];
+volatile __thread long *ust_reg_stack_ptr = (long *) 0;
+
 extern struct marker __start___markers[] __attribute__((visibility("hidden")));
 extern struct marker __stop___markers[] __attribute__((visibility("hidden")));
 
@@ -87,7 +90,7 @@ struct marker_entry {
        char *format;
        char *name;
                        /* Probe wrapper */
-       void (*call)(const struct marker *mdata, void *call_private, ...);
+       void (*call)(const struct marker *mdata, void *call_private, struct registers *regs, ...);
        struct marker_probe_closure single;
        struct marker_probe_closure *multi;
        int refcount;   /* Number of times armed. 0 if disarmed. */
@@ -123,7 +126,7 @@ static void marker_update_processes(void)
  * operations that modifies the execution flow of preemptible code.
  */
 notrace void __mark_empty_function(const struct marker *mdata,
-       void *probe_private, void *call_private, const char *fmt, va_list *args)
+       void *probe_private, struct registers *regs, void *call_private, const char *fmt, va_list *args)
 {
 }
 //ust// EXPORT_SYMBOL_GPL(__mark_empty_function);
@@ -139,7 +142,7 @@ notrace void __mark_empty_function(const struct marker *mdata,
  * rcu_dereference() for the pointer read.
  */
 notrace void marker_probe_cb(const struct marker *mdata,
-               void *call_private, ...)
+               void *call_private, struct registers *regs, ...)
 {
        va_list args;
        char ptype;
@@ -160,8 +163,8 @@ notrace void marker_probe_cb(const struct marker *mdata,
                /* Must read the ptr before private data. They are not data
                 * dependant, so we put an explicit smp_rmb() here. */
                smp_rmb();
-               va_start(args, call_private);
-               func(mdata, mdata->single.probe_private, call_private,
+               va_start(args, regs);
+               func(mdata, mdata->single.probe_private, regs, call_private,
                        mdata->format, &args);
                va_end(args);
        } else {
@@ -181,9 +184,9 @@ notrace void marker_probe_cb(const struct marker *mdata,
                 */
                smp_read_barrier_depends();
                for (i = 0; multi[i].func; i++) {
-                       va_start(args, call_private);
+                       va_start(args, regs);
                        multi[i].func(mdata, multi[i].probe_private,
-                               call_private, mdata->format, &args);
+                               regs, call_private, mdata->format, &args);
                        va_end(args);
                }
        }
@@ -200,7 +203,7 @@ notrace void marker_probe_cb(const struct marker *mdata,
  * Should be connected to markers "MARK_NOARGS".
  */
 static notrace void marker_probe_cb_noarg(const struct marker *mdata,
-               void *call_private, ...)
+               void *call_private, struct registers *regs, ...)
 {
        va_list args;   /* not initialized */
        char ptype;
@@ -216,7 +219,7 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata,
                /* Must read the ptr before private data. They are not data
                 * dependant, so we put an explicit smp_rmb() here. */
                smp_rmb();
-               func(mdata, mdata->single.probe_private, call_private,
+               func(mdata, mdata->single.probe_private, regs, call_private,
                        mdata->format, &args);
        } else {
                struct marker_probe_closure *multi;
@@ -235,7 +238,7 @@ static notrace void marker_probe_cb_noarg(const struct marker *mdata,
                 */
                smp_read_barrier_depends();
                for (i = 0; multi[i].func; i++)
-                       multi[i].func(mdata, multi[i].probe_private,
+                       multi[i].func(mdata, multi[i].probe_private, regs,
                                call_private, mdata->format, &args);
        }
 //ust//        rcu_read_unlock_sched_notrace();
@@ -664,6 +667,24 @@ static void disable_marker(struct marker *elem)
         */
 }
 
+/*
+ * is_marker_enabled - Check if a marker is enabled
+ * @channel: channel name
+ * @name: marker name
+ *
+ * Returns 1 if the marker is enabled, 0 if disabled.
+ */
+int is_marker_enabled(const char *channel, const char *name)
+{
+       struct marker_entry *entry;
+
+       mutex_lock(&markers_mutex);
+       entry = get_marker(channel, name);
+       mutex_unlock(&markers_mutex);
+
+       return entry && !!entry->refcount;
+}
+
 /**
  * marker_update_probe_range - Update a probe range
  * @begin: beginning of the range
@@ -823,6 +844,7 @@ int marker_probe_register(const char *channel, const char *name,
        }
        mutex_unlock(&markers_mutex);
 
+       /* Activate marker if necessary */
        marker_update_probes();
 
        mutex_lock(&markers_mutex);
@@ -1498,6 +1520,7 @@ static void new_markers(struct marker *start, struct marker *end)
 int marker_register_lib(struct marker *markers_start, int markers_count)
 {
        struct lib *pl;
+       struct marker_addr *addr;
 
        pl = (struct lib *) malloc(sizeof(struct lib));
 
@@ -1533,7 +1556,7 @@ void __attribute__((constructor)) init_markers(void)
 {
        if(!initialized) {
                marker_register_lib(__start___markers, (((long)__stop___markers)-((long)__start___markers))/sizeof(struct marker));
-               DBG("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
+               //DBG("markers_start: %p, markers_stop: %p\n", __start___markers, __stop___markers);
                initialized = 1;
        }
 }
This page took 0.025104 seconds and 4 git commands to generate.