-/*
+/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
+ *
* lttng-probes.c
*
* Holds LTTng probes registry.
*
* Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * 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; only
- * version 2.1 of the License.
- *
- * 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
- * Lesser General Public License for more details.
- *
- * 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
*/
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
-#include "lttng-events.h"
+#include <lttng-events.h>
/*
* probe list is protected by sessions lock.
*/
static int lazy_nesting;
+DEFINE_PER_CPU(struct lttng_dynamic_len_stack, lttng_dynamic_len_stack);
+
+EXPORT_PER_CPU_SYMBOL_GPL(lttng_dynamic_len_stack);
+
/*
* Called under sessions lock.
*/
}
ret = lttng_fix_pending_events();
WARN_ON_ONCE(ret);
+ ret = lttng_fix_pending_triggers();
+ WARN_ON_ONCE(ret);
lazy_nesting--;
}
* the probe immediately, since we cannot delay event
* registration because they are needed ASAP.
*/
- if (lttng_session_active())
+ if (lttng_session_active() || lttng_trigger_active())
fixup_lazy_probes();
end:
lttng_unlock_sessions();
* Called with sessions lock held.
*/
static
-const struct lttng_event_desc *find_event(const char *name)
+const struct lttng_event_desc *find_event_desc(const char *name)
{
struct lttng_probe_desc *probe_desc;
int i;
/*
* Called with sessions lock held.
*/
-const struct lttng_event_desc *lttng_event_get(const char *name)
+const struct lttng_event_desc *lttng_event_desc_get(const char *name)
{
- const struct lttng_event_desc *event;
+ const struct lttng_event_desc *event_desc;
int ret;
- event = find_event(name);
- if (!event)
+ event_desc = find_event_desc(name);
+ if (!event_desc)
return NULL;
- ret = try_module_get(event->owner);
+ ret = try_module_get(event_desc->owner);
WARN_ON_ONCE(!ret);
- return event;
+ return event_desc;
}
-EXPORT_SYMBOL_GPL(lttng_event_get);
+EXPORT_SYMBOL_GPL(lttng_event_desc_get);
/*
* Called with sessions lock held.
*/
-void lttng_event_put(const struct lttng_event_desc *event)
+void lttng_event_desc_put(const struct lttng_event_desc *event_desc)
{
- module_put(event->owner);
+ module_put(event_desc->owner);
}
-EXPORT_SYMBOL_GPL(lttng_event_put);
+EXPORT_SYMBOL_GPL(lttng_event_desc_put);
static
void *tp_list_start(struct seq_file *m, loff_t *pos)
{
struct lttng_probe_desc *probe_desc;
+ struct list_head *probe_list;
int iter = 0, i;
lttng_lock_sessions();
- list_for_each_entry(probe_desc, &_probe_list, head) {
+ probe_list = lttng_get_probe_list_head();
+ list_for_each_entry(probe_desc, probe_list, head) {
for (i = 0; i < probe_desc->nr_events; i++) {
if (iter++ >= *pos)
return (void *) probe_desc->event_desc[i];
void *tp_list_next(struct seq_file *m, void *p, loff_t *ppos)
{
struct lttng_probe_desc *probe_desc;
+ struct list_head *probe_list;
int iter = 0, i;
(*ppos)++;
- list_for_each_entry(probe_desc, &_probe_list, head) {
+ probe_list = lttng_get_probe_list_head();
+ list_for_each_entry(probe_desc, probe_list, head) {
for (i = 0; i < probe_desc->nr_events; i++) {
if (iter++ >= *ppos)
return (void *) probe_desc->event_desc[i];
.llseek = seq_lseek,
.release = seq_release,
};
+
+int lttng_probes_init(void)
+{
+ int cpu;
+
+ for_each_possible_cpu(cpu)
+ per_cpu_ptr(<tng_dynamic_len_stack, cpu)->offset = 0;
+ return 0;
+}