X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libust%2Fmarker-control.c;h=b4b7ce1a72d7d017cc34c6b05050efc2f0fb3773;hb=f7b16408b00ecce757bdde940853a48534b25edd;hp=29c43b09816e9ccf196b883335756b0999e90faf;hpb=b4512257eb71d0432554047acf6278dc42a15a75;p=ust.git diff --git a/libust/marker-control.c b/libust/marker-control.c index 29c43b0..b4b7ce1 100644 --- a/libust/marker-control.c +++ b/libust/marker-control.c @@ -1,40 +1,28 @@ /* * Copyright (C) 2007 Mathieu Desnoyers * - * 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 library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library 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. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser 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. + * You should have received a copy of the GNU Lesser General Public + * 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 -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -//ust// #include -#include "kernelcompat.h" -#include "list.h" +#include +#include + #include "tracer.h" -#include "localerr.h" +#include "usterr.h" #define DEFAULT_CHANNEL "cpu" #define DEFAULT_PROBE "default" @@ -85,6 +73,7 @@ static struct ltt_available_probe *get_probe_from_name(const char *pname) return NULL; } +/* (unused) static char *skip_spaces(char *buf) { while (*buf != '\0' && isspace(*buf)) @@ -106,6 +95,7 @@ static void get_marker_string(char *buf, char **start, *end = skip_nonspaces(*start); **end = '\0'; } +*/ int ltt_probe_register(struct ltt_available_probe *pdata) { @@ -113,7 +103,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) { @@ -128,10 +118,9 @@ 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; } -EXPORT_SYMBOL_GPL(ltt_probe_register); /* * Called when a probe does not want to be called anymore. @@ -141,7 +130,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( @@ -154,10 +143,9 @@ 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; } -EXPORT_SYMBOL_GPL(ltt_probe_unregister); /* * Connect marker "mname" to probe "pname". @@ -172,7 +160,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; @@ -199,11 +187,10 @@ 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; } -EXPORT_SYMBOL_GPL(ltt_marker_connect); /* * Disconnect marker "mname", probe "pname". @@ -215,7 +202,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; @@ -240,10 +227,9 @@ int ltt_marker_disconnect(const char *channel, const char *mname, free(pdata); } end: - mutex_unlock(&probes_mutex); + pthread_mutex_unlock(&probes_mutex); return ret; } -EXPORT_SYMBOL_GPL(ltt_marker_disconnect); /* * function handling proc entry write. @@ -435,7 +421,7 @@ void __attribute__((constructor)) init_marker_control(void) } //ust// module_init(marker_control_init); -static void __exit marker_control_exit(void) +static void __attribute__((destructor)) marker_control_exit(void) { int ret;