tracectl cleanup v3
[ust.git] / libust / marker-control.c
index f064316186055fac620d5ee6a2dc61a892b2ddb8..db7311a347030d485b24920776bd91d3074c554e 100644 (file)
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  *
- * LTT marker control module over /proc
  */
 
-//ust// #include <linux/proc_fs.h>
-//ust// #include <linux/module.h>
-//ust// #include <linux/stat.h>
-//ust// #include <linux/vmalloc.h>
-//ust// #include <linux/marker.h>
-//ust// #include <linux/ltt-tracer.h>
-//ust// #include <linux/uaccess.h>
-//ust// #include <linux/string.h>
-//ust// #include <linux/ctype.h>
-//ust// #include <linux/list.h>
-//ust// #include <linux/mutex.h>
-//ust// #include <linux/seq_file.h>
-//ust// #include <linux/slab.h>
+/* This file contains a high-level API for activating and deactivating markers,
+ * and making sure markers in a given library can be released when the library
+ * is unloaded.
+ */
+
 #include <ctype.h>
+#include <stdlib.h>
 
-#include "kernelcompat.h"
-//#include "list.h"
 #include "tracer.h"
-#include "localerr.h"
+#include "usterr.h"
 
 #define DEFAULT_CHANNEL "cpu"
 #define DEFAULT_PROBE "default"
@@ -117,7 +107,7 @@ int ltt_probe_register(struct ltt_available_probe *pdata)
        int comparison;
        struct ltt_available_probe *iter;
 
-       mutex_lock(&probes_mutex);
+       pthread_mutex_lock(&probes_mutex);
        list_for_each_entry_reverse(iter, &probes_registered_list, node) {
                comparison = strcmp(pdata->name, iter->name);
                if (!comparison) {
@@ -132,7 +122,7 @@ int ltt_probe_register(struct ltt_available_probe *pdata)
        /* Should be added at the head of the list */
        list_add(&pdata->node, &probes_registered_list);
 end:
-       mutex_unlock(&probes_mutex);
+       pthread_mutex_unlock(&probes_mutex);
        return ret;
 }
 
@@ -144,7 +134,7 @@ int ltt_probe_unregister(struct ltt_available_probe *pdata)
        int ret = 0;
        struct ltt_active_marker *amark, *tmp;
 
-       mutex_lock(&probes_mutex);
+       pthread_mutex_lock(&probes_mutex);
        list_for_each_entry_safe(amark, tmp, &markers_loaded_list, node) {
                if (amark->probe == pdata) {
                        ret = marker_probe_unregister_private_data(
@@ -157,7 +147,7 @@ int ltt_probe_unregister(struct ltt_available_probe *pdata)
        }
        list_del(&pdata->node);
 end:
-       mutex_unlock(&probes_mutex);
+       pthread_mutex_unlock(&probes_mutex);
        return ret;
 }
 
@@ -174,7 +164,7 @@ int ltt_marker_connect(const char *channel, const char *mname,
        struct ltt_available_probe *probe;
 
        ltt_lock_traces();
-       mutex_lock(&probes_mutex);
+       pthread_mutex_lock(&probes_mutex);
        probe = get_probe_from_name(pname);
        if (!probe) {
                ret = -ENOENT;
@@ -201,7 +191,7 @@ int ltt_marker_connect(const char *channel, const char *mname,
        else
                list_add(&pdata->node, &markers_loaded_list);
 end:
-       mutex_unlock(&probes_mutex);
+       pthread_mutex_unlock(&probes_mutex);
        ltt_unlock_traces();
        return ret;
 }
@@ -216,7 +206,7 @@ int ltt_marker_disconnect(const char *channel, const char *mname,
        struct ltt_available_probe *probe;
        int ret = 0;
 
-       mutex_lock(&probes_mutex);
+       pthread_mutex_lock(&probes_mutex);
        probe = get_probe_from_name(pname);
        if (!probe) {
                ret = -ENOENT;
@@ -241,7 +231,7 @@ int ltt_marker_disconnect(const char *channel, const char *mname,
                free(pdata);
        }
 end:
-       mutex_unlock(&probes_mutex);
+       pthread_mutex_unlock(&probes_mutex);
        return ret;
 }
 
This page took 0.026745 seconds and 4 git commands to generate.