Add cscope to gitignore

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: OOT lttng_logger tracepoint not visible with signed kernels

For the same reason as commit dd8d5afb3fabf853cb4c88c0a1a97f470090fe20,
the lttng_logger event was not working on signed kernels with non-signed
lttng modules.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Modernize README using Markdown

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: handle concurrent flush vs get_next_subbuf on metadata cache

The "flush" operation can be performed on the metadata file descriptor
concurrently with get_next_subbuffer operations by different processes
(e.g. lttng session daemon issuing flush at "stop" concurrently with
consumer daemon issuing get_next_subbuf for metadata I/O). We need
to protect the metadata cache from those concurrent use by introducing a
mutex.

This fixes a race where metadata from a kernel trace is corrupted due to
this scenario. The corruption shows up like the same metadata content (a
metadata packet) being written twice consecutively in the metadata
stream, thus triggering a babeltrace "parse error" when trying to read
the trace.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: lttng-modules teardown NULL pointer OOPS

Accessing the lttng channel and lttng session from the metadata ring
buffer client is a bad idea, because we don't have any reference
ensuring those are valid for the lifetime of the metadata cache.
Therefore, rather than keeping a lttng channel as private data pointer
for the metadata ring buffer channel, keep a pointer to the metadata
cache instead: this will ensure we don't shoot ourself in the foot and
access data we for which coherency is not guaranteed (we don't hold any
reference to it).

Anyway, the only reason why we needed to access the lttng session from
the metadata client in the first place was the UUID of the session. Copy
it into the metadata cache instead.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
asoc.h: fix build with v3.17 kernel

The snd_soc_codec structure has changed in the v3.17 kernel. Some
of the redundant fields have been removed. To be specific this commit
from the v3.17 kernel causes the build failure for lttng-modules.

|commit f4333203ec933f9272c90c7add01774ec2cf94d3
|Author: Lars-Peter Clausen <lars@metafoo.de>
|Date:   Mon Jun 16 18:13:02 2014 +0200
|
|    ASoC: Move name and id from CODEC/platform to component
|
|    The component struct already has a name and id field which are initialized to
|    the same values as the same fields in the CODEC and platform structs. So remove
|    them from the CODEC and platform structs and used the ones from the component
|    struct instead.
|
|    Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
|    Signed-off-by: Mark Brown <broonie@linaro.org>

The asoc.h is changed according to the change in the above kernel commit
to fix the lttng-modules build. The change in the lttng-modules code is
conditional on the kernel version, so that it does not break builds with
previous kernel versions.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
System call filtering

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Syscall filtering: apply to syscall exit

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Extract system call exit return value

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Extract syscall exit ret value on x86 32/64

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add syscall inout table

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Update syscall inout table

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
System call inout/output arg processing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Remove sys_ prefix from syscall names

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
syscall: extract pipe and pipe2 output args

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Extract input/output arguments from accept and connect syscalls

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Rename LTTng instrumentation macros

Since LTTng instrumentation macros have a different layout than the
Linux kernel TRACE_EVENT macros, privatize the name.

Here is the mapping:

DECLARE_EVENT_CLASS -> LTTNG_TRACEPOINT_EVENT_CLASS
DEFINE_EVENT -> LTTNG_TRACEPOINT_EVENT_INSTANCE
TRACE_EVENT -> LTTNG_TRACEPOINT_EVENT
TRACE_EVENT_CONDITION -> LTTNG_TRACEPOINT_EVENT_CONDITION
DEFINE_EVENT_CONDITION -> LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION
TRACE_EVENT_MAP -> LTTNG_TRACEPOINT_EVENT_MAP
DEFINE_EVENT_MAP -> LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP

LTTNG_V4L2_TRACEPOINT_EVENT -> LTTNG_TRACEPOINT_EVENT_V4L2
DEFINE_WRITEBACK_WORK_EVENT ->
LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE
DEFINE_WBC_EVENT -> LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE

DEFINE_EVENT_NOARGS -> LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS
TRACE_EVENT_FLAGS -> REMOVE

LTTNG_DECLARE_EVENT_CLASS -> LTTNG_TRACEPOINT_EVENT_CLASS_CODE
LTTNG_DECLARE_EVENT_CLASS_NOARGS ->
LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS
LTTNG_TRACE_EVENT -> LTTNG_TRACEPOINT_EVENT_CODE

TRACE_EVENT_MAP_NOARGS -> LTTNG_TRACEPOINT_EVENT_MAP_NOARGS
DECLARE_EVENT_CLASS_NOARGS -> LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS

DEFINE_EVENT_MAP_NOARGS -> LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP_NOARGS

DEFINE_EVENT_PRINT -> LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT
DEFINE_EVENT_PRINT_MAP -> LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT_MAP

DEFINE_EVENT_CONDITION_MAP ->
LTTNG_TRACEPOINT_EVENT_INSTANCE_CONDITION_MAP
TRACE_EVENT_CONDITION_MAP -> LTTNG_TRACEPOINT_EVENT_CONDITION_MAP

TRACE_EVENT_NOARGS -> LTTNG_TRACEPOINT_EVENT_NOARGS
TRACE_EVENT_FN_MAP -> LTTNG_TRACEPOINT_EVENT_FN_MAP
TRACE_EVENT_FN -> LTTNG_TRACEPOINT_EVENT_FN

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Rename LTTng syscall instrumentation macros

Mapping:

SC_LTTNG_TRACE_EVENT -> SC_LTTNG_TRACEPOINT_EVENT_CODE
SC_TRACE_EVENT -> SC_LTTNG_TRACEPOINT_EVENT
SC_DECLARE_EVENT_CLASS_NOARGS -> SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS
SC_DEFINE_EVENT_NOARGS -> SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
syscall instrumentation: handle copy_from_user return value

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix generate syscall header script: add missing escape char

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>