Extras: Added lttng.pyc to make clean

This is for Python bindings.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Extras: Fix the undefined reference to md build error.

Removed scripted modifications to lttng_wrap.c during Python binding
generation.

This adds back the "md" warning of SWIG. See the upstream bug still
waiting to merged upstream: sourceforge.net/p/swig/bugs/1246/

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Extras: Redefined PyInt_AsSsize_T to PyLong_AsSsize_t.

Python 3 merges PyInt and PyLong types. This fixes the undefined symbol
error encountered when using the bindings with Python 3.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Extras: Fixed inconsistent use of space and tabs in lttng.i.in.

Python 3 does not allow mixing spaces and tabs. This eliminates the
error encountered when importing the lttng module in a Python 3
interpreter.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: improve error handling for UST stream creation

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: change function name for better meaning

Mostly to avoid confusion in the future for patches, reviews and
contributors.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add a create_ust_stream function in ust-app.c

This helps by having a single callsite for ustctl_create_stream and
removes the need for the caller to handle FD reservation. On success,
the function sets the returned handle to the given stream.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing fd put on stream creation error

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: UST returns -LTTNG_UST_ERR_NOENT and not -ENOENT

On stream creation, it's an UST error code and not the errno one.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Move stream name creation to fct create_ust_stream

This is for two reasons. First, to avoid for the caller to create the
stream name. Second, on snprintf() error, we can't continue so put back
the reserved FDs and return an error.

We do that name creation now *before* the stream is created on the
application side so we don't have to release that object on error.

Only after that the stream is added to the list and the channel count
updated. This makes more sense and better handle the error path. Also,
this patch removes a XXX: statement which are always not cool on
production software :).

Signed-off-by: David Goulet <dgoulet@efficios.com>
Rename ltt_ust_stream to ust_app_stream

This data structure only have sense on the application registry side.
The tracing registry does not directly handle stream anymore. This patch
also move it from trace-ust.h to ust-app.h.

No code was changed nor any behaviors altered.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add an allocation function for ust stream

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing rcu read side lock

Signed-off-by: David Goulet <dgoulet@efficios.com>
Add safety assert() in session daemon

Note here that a test has been removed which tested the NULL parameter
of the session_destroy() call where now we assert if there is a NULL
pointer. It's a code flow error if a NULL pointer gets to this call so
the test becomes irrelevant.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Remove unused kernel session variable in event.c

Signed-off-by: David Goulet <dgoulet@efficios.com>
Remove unused variables in trace-kernel/ust.c

In trace-kernel.c, the path is not used anymore on channel creation.
Same goes for trace-ust.c for session creation, the domain pointer is
not used.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing rcu lock for UST lookup

Trace UST channel and event were not protected by RCU lock when calling
their find function. Furthermore, the event lookup was not protected at
all during and after the lookup.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Remove UST abi cast on channel attribute

This clears out a TODO in the code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Use default value for metadata file name

Signed-off-by: David Goulet <dgoulet@efficios.com>
cppcheck: Simplify empty string test without using strlen()

Signed-off-by: David Goulet <dgoulet@efficios.com>