#include <lttng-string-utils.h>
#include <wrapper/ringbuffer/backend.h>
#include <wrapper/ringbuffer/frontend.h>
+#include <wrapper/time.h>
#define METADATA_CACHE_DEFAULT_SIZE 4096
ret = -EINVAL;
break;
case LTTNG_KERNEL_KPROBE:
- case LTTNG_KERNEL_FUNCTION:
case LTTNG_KERNEL_UPROBE:
case LTTNG_KERNEL_NOOP:
WRITE_ONCE(event->enabled, 1);
case LTTNG_KERNEL_KRETPROBE:
ret = lttng_kretprobes_event_enable_state(event, 1);
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
ret = -EINVAL;
break;
case LTTNG_KERNEL_KPROBE:
- case LTTNG_KERNEL_FUNCTION:
case LTTNG_KERNEL_UPROBE:
case LTTNG_KERNEL_NOOP:
WRITE_ONCE(event->enabled, 0);
case LTTNG_KERNEL_KRETPROBE:
ret = lttng_kretprobes_event_enable_state(event, 0);
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
case LTTNG_KERNEL_KPROBE:
case LTTNG_KERNEL_UPROBE:
case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
case LTTNG_KERNEL_NOOP:
case LTTNG_KERNEL_SYSCALL:
event_name = event_param->name;
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through. */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
list_add(&event_return->list, &chan->session->events);
break;
}
- case LTTNG_KERNEL_FUNCTION:
- /*
- * Needs to be explicitly enabled after creation, since
- * we may want to apply filters.
- */
- event->enabled = 0;
- event->registered = 1;
- /*
- * Populate lttng_event structure before event
- * registration.
- */
- smp_wmb();
- ret = lttng_ftrace_register(event_name,
- event_param->u.ftrace.symbol_name,
- event);
- if (ret) {
- goto register_error;
- }
- ret = try_module_get(event->desc->owner);
- WARN_ON_ONCE(!ret);
- break;
case LTTNG_KERNEL_NOOP:
case LTTNG_KERNEL_SYSCALL:
/*
ret = try_module_get(event->desc->owner);
WARN_ON_ONCE(!ret);
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
ret = -EINVAL;
case LTTNG_KERNEL_KPROBE:
case LTTNG_KERNEL_UPROBE:
case LTTNG_KERNEL_KRETPROBE:
- case LTTNG_KERNEL_FUNCTION:
case LTTNG_KERNEL_NOOP:
ret = 0;
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
lttng_kretprobes_unregister(event);
ret = 0;
break;
- case LTTNG_KERNEL_FUNCTION:
- lttng_ftrace_unregister(event);
- ret = 0;
- break;
case LTTNG_KERNEL_SYSCALL:
ret = lttng_syscall_filter_disable(event->chan,
desc->name);
lttng_uprobes_unregister(event);
ret = 0;
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
module_put(event->desc->owner);
lttng_kretprobes_destroy_private(event);
break;
- case LTTNG_KERNEL_FUNCTION:
- module_put(event->desc->owner);
- lttng_ftrace_destroy_private(event);
- break;
case LTTNG_KERNEL_NOOP:
case LTTNG_KERNEL_SYSCALL:
break;
module_put(event->desc->owner);
lttng_uprobes_destroy_private(event);
break;
+ case LTTNG_KERNEL_FUNCTION: /* Fall-through */
default:
WARN_ON_ONCE(1);
}
* in future versions.
* This function may return a negative offset. It may happen if the
* system sets the REALTIME clock to 0 after boot.
+ *
+ * Use 64bit timespec on kernels that have it, this makes 32bit arch
+ * y2038 compliant.
*/
static
int64_t measure_clock_offset(void)
uint64_t monotonic_avg, monotonic[2], realtime;
uint64_t tcf = trace_clock_freq();
int64_t offset;
- struct timespec rts = { 0, 0 };
unsigned long flags;
+#ifdef LTTNG_KERNEL_HAS_TIMESPEC64
+ struct timespec64 rts = { 0, 0 };
+#else
+ struct timespec rts = { 0, 0 };
+#endif
/* Disable interrupts to increase correlation precision. */
local_irq_save(flags);
monotonic[0] = trace_clock_read64();
+#ifdef LTTNG_KERNEL_HAS_TIMESPEC64
+ ktime_get_real_ts64(&rts);
+#else
getnstimeofday(&rts);
+#endif
monotonic[1] = trace_clock_read64();
local_irq_restore(flags);
static
int print_escaped_ctf_string(struct lttng_session *session, const char *string)
{
- int ret;
+ int ret = 0;
size_t i;
char cur;