Fix I/O-related error values in ustctl

These internal ustctl API members document >=0 as OK values. Make sure
reply recv errors are returned as errors.

Clarify ustctl_create_stream() error values.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: David Goulet <dgoulet@efficios.com>
Fix: comment in ust-ctl.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Documentation: clarify debian package name for uuid in README

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add compilation support for Tile architectures

Also add missing space on the mips line for OCD purposes.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: missing test for lttng_ust_comm_should_quit in lttng-ust-comm.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Documentation: add uuid package name for Fedora in README

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add missing demo-trace shell script to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Speed up probe registration for large amount of events

LTTng-UST probe registration is O(n^2). I actually left a comment that
describes this, also implying that we can improve this if it becomes an
issue.

I've had a report from Yang Wang, who works on instrumenting the J9 VM,
that O(n^2) does not agree well with 16000 probes and tracepoints.

It appears that lttng_probe_register() is being too paranoid for its own
good. There are now many things that are guaranteed by the way probe
providers are being built.

We actually need to keep a check that no provider with the same name has
been registered (O(n) on the number of registered providers, could be
improved with a hash table if it ever becomes necessary).

Use an assert to check that each event name starts with its own provider
name (it would be an internal error within the provider if it's not the
case). (O(n) on the number of events within a provider)

The rest is just useless, so remove this O(n^2) check.

While we are there, remove the now unused
lttng_event_get()/lttng_event_put() functions.

Reported-by: Yang Wang <yangw.wang5@unb.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Scalability fix for many events: event hash table size

Increase number of buckets for event hash table (per session) from 64 to
4096. This improves process startup time for J9 vm (with 16k
tracepoints) very significantly.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Scalability fix: tracepoint.c hash table size increase

Speed up process startup for applications with large number of
tracepoints (e.g. 16k in J9 vm) by increasing the tracepoint.c hash
table size from 64 to 4096.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: don't cancel already exited threads

Ensure we don't issue pthread_cancel() on already exited threads.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix package: don't distribute generated headers

Fixes #421

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Move LTTng-UST buffer ownership from application to consumer

Before this change, applications were performing allocation and teardown
of their buffers. Applications therefore had ownership of the buffers.
The shm and wait fd were passed from applications, though sessiond, to
consumerd through unix sockets.

This change moves ownership of buffers from applications to consumer.
This will allow sharing buffers across many processes in a near future.
It will also facilitate implementation of periodical timers on the
consumer side, now that it has ownership of channels and buffers
(also called streams). This imply that file descriptors on shm and
wakeup end of the pipe are now passed from the consumerd to sessiond,
then to applications, through unix sockets. Then, applications "map"
channel and streams into their own memory space. Channel control
structure is actually a copy for each application, while streams are a
shared memory map (shm) between consumerd and all applications that
write into it, and have a wake up file descriptor on the application
side.

Dependency on libuuid is now removed from lttng-ust, and moved to
lttng-tools, since the UUID is needed at channel and buffer allocation.

This commit needs to be used along with commit named
"Move LTTng-UST buffer ownership from application to consumer" in
lttng-tools.

Reviewed-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix static build

Move init_usterr() to snprintf, along with its ust_loglevel state.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Always use lttng_get_probe_list_head to get probe list

Prepare lazy probe registration.

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

Register probe providers lazily, so process startup time is not impacted
by the number of events (especially for large number of events) as long
as no UST tracing session is active.

Refs #446

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Use urcu tls-compat.h

We can use the URCU_TLS() compatibility layer from userspace RCU to
support some BSD flavors that do not support __thread.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Remove direct dependency of probes on urcu-bp

The filter feature added a direct dependency of probes providers against
urcu-bp .so, while linking them against liblttng-ust should suffice. Fix
this by using the tracepoint.h wrapper for rcu_dereference().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Use tp rcu link test in provider

Ensure we never trigger a null pointer exception.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: don't flush-final for offset 0 if reader is on sub-buffer

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