lttng-tools.git
11 years agoMerge remote-tracking branch 'cbab-github/tests-cleanup' into cbab
David Goulet [Mon, 11 Mar 2013 17:00:33 +0000 (13:00 -0400)] 
Merge remote-tracking branch 'cbab-github/tests-cleanup' into cbab

Conflicts:
tests/regression/tools/streaming/test_high_throughput_limits
tests/unit/test_kernel_data.c
tests/unit/test_ust_data.c

11 years agoFix: mark generated python bindings files as nodist
Jérémie Galarneau [Sat, 16 Feb 2013 01:46:45 +0000 (20:46 -0500)] 
Fix: mark generated python bindings files as nodist

make dist would fail if ./configure had not been invoked with
the --enable-python-bindings switch.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: change default channel values in unit test
David Goulet [Mon, 11 Mar 2013 14:51:03 +0000 (10:51 -0400)] 
Fix: change default channel values in unit test

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: default read timer values
Mathieu Desnoyers [Mon, 11 Mar 2013 14:09:44 +0000 (10:09 -0400)] 
Fix: default read timer values

Kernel read timer value should be 200ms (200000us), not 200us.

UST default read timer value should be 0 (use write() system call from
applications).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoImplement channel fd monitoring thread for UST
Mathieu Desnoyers [Sat, 9 Mar 2013 16:58:42 +0000 (11:58 -0500)] 
Implement channel fd monitoring thread for UST

This new thread uses a new hash table containing channels and monitors
their wait_fd. On hang up, the channel streams are closed but *not*
deleted so the teardown process of channel and streams are untouched.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd channel wakeup fd to monitor close
Mathieu Desnoyers [Wed, 6 Mar 2013 21:12:57 +0000 (16:12 -0500)] 
Add channel wakeup fd to monitor close

Add channel wakeup fd, so consumer can keep its handle on the stream
wakeup_fd (for periodic timer flush), and yet still discover that an
application has closed a channel or exited.

Requires to be updated in locked-step with lttng-ust
"Add channel wakeup fd to monitor close"

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove enable consumer from test
David Goulet [Fri, 1 Mar 2013 17:58:08 +0000 (12:58 -0500)] 
Fix: remove enable consumer from test

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMove metadata creation into lttng-sessiond and lttng-consumed
David Goulet [Tue, 26 Feb 2013 17:46:09 +0000 (12:46 -0500)] 
Move metadata creation into lttng-sessiond and lttng-consumed

The metadata is completely generated in the session daemon and pushed to
the consumer which writes the full string to a ustctl channel object. On
each event/channel notification from the tracer, the metadata is
generated on the spot and kept in the UST registry of the session
daemon.

On stop and destroy command, the metadata is pushed to the consumer. On
application unregistration as well, the metadata is handled.

Needs to be use in locked-step with LTTng-UST:
"Move metadata creation into lttng-sessiond and lttng-consumed"

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMove UST registry into sessiond and implement notifiers
David Goulet [Tue, 19 Feb 2013 20:17:09 +0000 (15:17 -0500)] 
Move UST registry into sessiond and implement notifiers

Notify now comes from the UST tracer to register event in a new registry
in the session daemon storing UST channel and events. This registry is
used to send back event and channel IDs to the tracer and the session
UUID. It will also be used later on to generate metadata which will
completely remove metadata generation from the application.

This introduces a new thread in the session daemon being the thread
managing application notification using a new socket (notify socket).
This thread is in ust-thread.c/.h and spawned at startup.

Needs to be use in locked-step with LTTng-UST commit:
"Move UST registry into sessiond and implement notifiers"

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoTests: Add runner script for tests
Christian Babeux [Fri, 22 Feb 2013 04:32:39 +0000 (23:32 -0500)] 
Tests: Add runner script for tests

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add runner script for regression testsuite
Christian Babeux [Fri, 22 Feb 2013 04:29:02 +0000 (23:29 -0500)] 
Tests: Add runner script for regression testsuite

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add runner script for tools regression tests
Christian Babeux [Fri, 22 Feb 2013 04:26:52 +0000 (23:26 -0500)] 
Tests: Add runner script for tools regression tests

Also remove old the old runner scripts.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the tools streaming tests output to TAP
Christian Babeux [Fri, 22 Feb 2013 04:19:17 +0000 (23:19 -0500)] 
Tests: Convert the tools streaming tests output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the tools health tests output to TAP
Christian Babeux [Fri, 22 Feb 2013 04:17:34 +0000 (23:17 -0500)] 
Tests: Convert the tools health tests output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the tools filtering tests output to TAP
Christian Babeux [Fri, 22 Feb 2013 04:15:25 +0000 (23:15 -0500)] 
Tests: Convert the tools filtering tests output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Rename the tools tests runners to test_<test name>
Christian Babeux [Fri, 22 Feb 2013 04:11:53 +0000 (23:11 -0500)] 
Tests: Rename the tools tests runners to test_<test name>

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add runner script for UST regression tests
Christian Babeux [Fri, 22 Feb 2013 03:57:15 +0000 (22:57 -0500)] 
Tests: Add runner script for UST regression tests

Also remove the old runners scripts.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST overlap test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:53:40 +0000 (22:53 -0500)] 
Tests: Convert the UST overlap test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST nprocesses test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:48:19 +0000 (22:48 -0500)] 
Tests: Convert the UST nprocesses test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST multi-session test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:46:23 +0000 (22:46 -0500)] 
Tests: Convert the UST multi-session test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST low-throughput test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:45:42 +0000 (22:45 -0500)] 
Tests: Convert the UST low-throughput test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST high-throughput test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:39:01 +0000 (22:39 -0500)] 
Tests: Convert the UST high-throughput test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST before-after test output to TAP
Christian Babeux [Fri, 22 Feb 2013 03:38:09 +0000 (22:38 -0500)] 
Tests: Convert the UST before-after test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Rename the UST tests runners to test_<test name>
Christian Babeux [Fri, 22 Feb 2013 03:26:41 +0000 (22:26 -0500)] 
Tests: Rename the UST tests runners to test_<test name>

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the ust_global_event_wildcard test to an equivalent shell test
Christian Babeux [Fri, 22 Feb 2013 03:10:54 +0000 (22:10 -0500)] 
Tests: Convert the ust_global_event_wildcard test to an equivalent shell test

The test_event_wildcard shell script test has the same behavior has the
ust_global_event_wildcard test. In addition, the test output format has been
converted to TAP.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the ust_global_event_basic test to an equivalent shell test
Christian Babeux [Fri, 22 Feb 2013 03:05:12 +0000 (22:05 -0500)] 
Tests: Convert the ust_global_event_basic test to an equivalent shell test

The test_event_basic shell script test has the same behavior has the
ust_global_event_basic test. In addition, the test output format has been
converted to TAP.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add runner script for kernel regression tests
Christian Babeux [Fri, 22 Feb 2013 02:52:04 +0000 (21:52 -0500)] 
Tests: Add runner script for kernel regression tests

Also remove the old runner scripts.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the kernel_event_basic test to an equivalent shell test
Christian Babeux [Fri, 22 Feb 2013 02:49:14 +0000 (21:49 -0500)] 
Tests: Convert the kernel_event_basic test to an equivalent shell test

The test_event_basic shell script test has the same behavior has the
kernel_event_basic test. In addition, the resulting trace produced
by the test is now verified for correctness. Finally, the test output
format has been converted to TAP.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the kernel_all_events_basic test to an equivalent shell test
Christian Babeux [Fri, 22 Feb 2013 02:08:56 +0000 (21:08 -0500)] 
Tests: Convert the kernel_all_events_basic test to an equivalent shell test

The test_all_events shell script test has the same behavior has the
kernel_all_events_basic test. In addition, the resulting trace produced
by the test is now verified for correctness. Finally, the test output
format has been converted to TAP.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add runner script for unit tests
Christian Babeux [Thu, 21 Feb 2013 22:57:15 +0000 (17:57 -0500)] 
Tests: Add runner script for unit tests

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the URI unit test output to TAP
Christian Babeux [Thu, 21 Feb 2013 22:35:25 +0000 (17:35 -0500)] 
Tests: Convert the URI unit test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the UST data structures unit test output to TAP
Christian Babeux [Thu, 21 Feb 2013 22:28:09 +0000 (17:28 -0500)] 
Tests: Convert the UST data structures unit test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the kernel data structures unit test output to TAP
Christian Babeux [Thu, 21 Feb 2013 22:24:27 +0000 (17:24 -0500)] 
Tests: Convert the kernel data structures unit test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert the session unit test output to TAP
Christian Babeux [Thu, 21 Feb 2013 22:17:38 +0000 (17:17 -0500)] 
Tests: Convert the session unit test output to TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Convert functions in utils.sh to output in the TAP format
Christian Babeux [Thu, 21 Feb 2013 23:09:57 +0000 (18:09 -0500)] 
Tests: Convert functions in utils.sh to output in the TAP format

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add the runner.sh tests runner utility
Christian Babeux [Thu, 21 Feb 2013 20:14:48 +0000 (15:14 -0500)] 
Tests: Add the runner.sh tests runner utility

This script contains the run_tests function to ease the run of a testsuite.

Usage example:

source $TESTDIR/utils/runner.sh

tests=( some_test
        some_other_test )

opts=("$@")
run_tests tests[@] opts[@]

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Add TAP helpers in tests/utils/tap
Christian Babeux [Thu, 21 Feb 2013 21:31:16 +0000 (16:31 -0500)] 
Tests: Add TAP helpers in tests/utils/tap

tests/utils/tap/tap.{h,c}:
For use in C tests. You can link against libtap with the usual automake
mechanisms.

tests/utils/tap/tap.sh:
For use in shell scripts tests. Source the script
(e.g. source "tests/utils/tap/tap.sh") to use the relevants TAP functions.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Move unit tests to tests/unit
Christian Babeux [Thu, 21 Feb 2013 21:29:47 +0000 (16:29 -0500)] 
Tests: Move unit tests to tests/unit

The regression/tools/{test_kernel_data_trace,test_sessions,test_ust_data_trace}.c
and regression/tools/streaming/unit_tests.c tests files are really unit tests.

In order to have a clear separation between unit tests and integration/system tests,
move them to their own folder.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoTests: Move tests to tests/regression
Christian Babeux [Thu, 21 Feb 2013 19:20:25 +0000 (14:20 -0500)] 
Tests: Move tests to tests/regression

Also move the utils.sh and utils.h helper files under tests/utils.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoDeprecate enable/disable-consumer
David Goulet [Fri, 15 Feb 2013 22:09:09 +0000 (17:09 -0500)] 
Deprecate enable/disable-consumer

The concept of consumer should change to the fact that a user can
enable/disable outputs such as file or network for streaming. We
envision that multiple outputs can be attached to a channel in the
future.

We want to minimise the amount of puzzlement for users. Having an error
message from the consumer daemon when --no-consumer has been specified
can be considered puzzling.

This calls for "add output" semantic, so we can support this "tee"
use-case seemlessly. We plan on allowing add/del output while tracing is
active, which is not currently permitted by enable-consumer.

Everything enable-consumer does can be done by lttng create options
Therefore, it seems easier for development of upcoming features and for
the sake of simplicity of interfaces to deprecate the current
enable/disable consumer.

This applies for both to the lttng UI commands and API calls. The
documentation has been removed from the man page and the help of the
lttng command. So, it exists but is simply not documented.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMove LTTng-UST buffer ownership from application to consumer
David Goulet [Wed, 30 Jan 2013 21:36:23 +0000 (16:36 -0500)] 
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 has been added to lttng-tools, since the UUID is
needed at channel and buffer allocation.

Note that this is only for UST so the kernel buffers are still created
in the session daemon then passed to the consumer. There is basically no
change for the kernel other than adapting to the new communication data
structure.

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

Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Conditionally disable test requiring shared libs
Christian Babeux [Fri, 8 Feb 2013 03:47:04 +0000 (22:47 -0500)] 
Fix: Conditionally disable test requiring shared libs

When building lttng-tools with shared library support explicitly
disabled (e.g.: ./configure --disable-shared), libtool fail with a fatal
error:

Making all in demo
  CC       tp.lo
  CC       tp2.lo
  CC       tp3.lo
  CC       demo.o
  CCLD     demo
  CCLD     liblttng-ust-provider-ust-tests-demo.la
  CCLD     liblttng-ust-provider-ust-tests-demo3.la
libtool: link: can not build a shared library
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.

The build should not fail because some tests require explicit shared
library support, instead they should be skipped. This can be
accomplished by detecting builds with no shared libs support with the
NO_SHARED Automake variable.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove consumer health poll update on startup
David Goulet [Tue, 29 Jan 2013 17:26:09 +0000 (12:26 -0500)] 
Fix: remove consumer health poll update on startup

With the TLS health state, the consumer thread has to register in order
to be validated during the health check so the poll update work around
is no longer needed andi replaced with a simple code update just after
the health registration of the thread.

This has been reported after the TLS feature ticket #411 has been
implemented.

Fixes #428

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: change health poll update to entry/exit calls
David Goulet [Wed, 30 Jan 2013 16:08:54 +0000 (11:08 -0500)] 
Fix: change health poll update to entry/exit calls

It adds a better semantic to the code flow. Furthermore, the current
counter of the health state is now validated raising an assert() if the
value is unexepected.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: support duplicate health type
David Goulet [Tue, 29 Jan 2013 17:38:03 +0000 (12:38 -0500)] 
Fix: support duplicate health type

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoClarify README about the GNU gold linker requirement
David Goulet [Fri, 25 Jan 2013 18:22:13 +0000 (13:22 -0500)] 
Clarify README about the GNU gold linker requirement

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCleanup: use LTTNG_PACKED in lttng-kernel.h
David Goulet [Fri, 25 Jan 2013 17:12:07 +0000 (12:12 -0500)] 
Cleanup: use LTTNG_PACKED in lttng-kernel.h

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCleanup: use LTTNG_HIDDEN in src/common
David Goulet [Fri, 25 Jan 2013 17:11:07 +0000 (12:11 -0500)] 
Cleanup: use LTTNG_HIDDEN in src/common

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCleanup: use LTTNG_HIDDEN in lttng-ctl filter lib
David Goulet [Fri, 25 Jan 2013 17:07:29 +0000 (12:07 -0500)] 
Cleanup: use LTTNG_HIDDEN in lttng-ctl filter lib

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd LTTNG_HIDDEN macro for hidden attribute
David Goulet [Fri, 25 Jan 2013 17:02:06 +0000 (12:02 -0500)] 
Add LTTNG_HIDDEN macro for hidden attribute

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoSymbol prefixing: in-house copy of hash table
Mathieu Desnoyers [Thu, 24 Jan 2013 23:43:48 +0000 (18:43 -0500)] 
Symbol prefixing: in-house copy of hash table

Will ensure we don't clash with the real version in liburcu cds. It's
especially important since those symbols are exported globally by
liblttng-ctl.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing unistd.h for fdatasync in compat-fcntl.c
Mathieu Desnoyers [Thu, 24 Jan 2013 23:34:44 +0000 (18:34 -0500)] 
Fix: add missing unistd.h for fdatasync in compat-fcntl.c

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoNamespace lttngctl filter flex/bison symbols
Mathieu Desnoyers [Thu, 24 Jan 2013 23:33:41 +0000 (18:33 -0500)] 
Namespace lttngctl filter flex/bison symbols

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCleanup unused health state reference
David Goulet [Thu, 24 Jan 2013 19:29:49 +0000 (14:29 -0500)] 
Cleanup unused health state reference

The old health state structure are not used anymore since we now rely on
TLS health state.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: health subsystem issues with shared code
David Goulet [Thu, 24 Jan 2013 19:20:23 +0000 (14:20 -0500)] 
Fix: health subsystem issues with shared code

TLS memory is not used for health state of each thread. This commit
probably fixes bug428 as well.

The health_init/exit are renamed to health_register/unregister.

Fixes #411

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUse utils mkdir recursive in runas.c
David Goulet [Wed, 23 Jan 2013 18:44:12 +0000 (13:44 -0500)] 
Use utils mkdir recursive in runas.c

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agorelayd: Create output directory in main()
David Goulet [Wed, 23 Jan 2013 18:38:53 +0000 (13:38 -0500)] 
relayd: Create output directory in main()

If specified with -o, --output, the directory is created in the main()
so if an error occurs the execution is stopped.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUse utils family function in relayd
David Goulet [Wed, 23 Jan 2013 17:32:54 +0000 (12:32 -0500)] 
Use utils family function in relayd

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd mkdir_recursive function to libcommon utils
David Goulet [Wed, 23 Jan 2013 17:25:24 +0000 (12:25 -0500)] 
Add mkdir_recursive function to libcommon utils

11 years agoFix: poll max size should be checked during resize
David Goulet [Tue, 22 Jan 2013 20:28:36 +0000 (15:28 -0500)] 
Fix: poll max size should be checked during resize

This was detected using cppcheck:

[src/common/compat/compat-poll.c:204]: (error) Uninitialized variable:
new_size

So, the check was always made over an uninitialized variable on the
stack. Fortunately, worst case scenario, new_size is set to the maximum
allowed or kept untouched.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: wrong variable type for read() return value
David Goulet [Tue, 22 Jan 2013 20:19:08 +0000 (15:19 -0500)] 
Fix: wrong variable type for read() return value

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agocppcheck: don't check NULL pointer before freeing them
David Goulet [Tue, 22 Jan 2013 20:15:08 +0000 (15:15 -0500)] 
cppcheck: don't check NULL pointer before freeing them

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agocppcheck: Simplify empty string test without using strlen()
David Goulet [Tue, 22 Jan 2013 20:09:23 +0000 (15:09 -0500)] 
cppcheck: Simplify empty string test without using strlen()

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUse default value for metadata file name
David Goulet [Tue, 22 Jan 2013 19:57:24 +0000 (14:57 -0500)] 
Use default value for metadata file name

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRemove UST abi cast on channel attribute
David Goulet [Tue, 22 Jan 2013 19:09:21 +0000 (14:09 -0500)] 
Remove UST abi cast on channel attribute

This clears out a TODO in the code.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: add missing rcu lock for UST lookup
David Goulet [Tue, 22 Jan 2013 17:13:13 +0000 (12:13 -0500)] 
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>
11 years agoRemove unused variables in trace-kernel/ust.c
David Goulet [Tue, 22 Jan 2013 16:52:57 +0000 (11:52 -0500)] 
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>
11 years agoRemove unused kernel session variable in event.c
David Goulet [Tue, 22 Jan 2013 16:50:52 +0000 (11:50 -0500)] 
Remove unused kernel session variable in event.c

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd safety assert() in session daemon
David Goulet [Tue, 22 Jan 2013 16:38:11 +0000 (11:38 -0500)] 
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>
11 years agoFix: add missing rcu read side lock
David Goulet [Tue, 22 Jan 2013 16:40:13 +0000 (11:40 -0500)] 
Fix: add missing rcu read side lock

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd an allocation function for ust stream
David Goulet [Mon, 21 Jan 2013 20:49:45 +0000 (15:49 -0500)] 
Add an allocation function for ust stream

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoRename ltt_ust_stream to ust_app_stream
David Goulet [Mon, 21 Jan 2013 20:20:52 +0000 (15:20 -0500)] 
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>
11 years agoMove stream name creation to fct create_ust_stream
David Goulet [Mon, 21 Jan 2013 17:03:55 +0000 (12:03 -0500)] 
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>
11 years agoFix: UST returns -LTTNG_UST_ERR_NOENT and not -ENOENT
David Goulet [Mon, 21 Jan 2013 16:59:00 +0000 (11:59 -0500)] 
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>
11 years agoFix: add missing fd put on stream creation error
David Goulet [Mon, 21 Jan 2013 16:38:19 +0000 (11:38 -0500)] 
Fix: add missing fd put on stream creation error

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd a create_ust_stream function in ust-app.c
David Goulet [Mon, 21 Jan 2013 16:25:09 +0000 (11:25 -0500)] 
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>
11 years agoFix: change function name for better meaning
David Goulet [Mon, 21 Jan 2013 16:24:29 +0000 (11:24 -0500)] 
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>
11 years agoFix: improve error handling for UST stream creation
David Goulet [Mon, 21 Jan 2013 15:50:44 +0000 (10:50 -0500)] 
Fix: improve error handling for UST stream creation

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoExtras: Fixed inconsistent use of space and tabs in lttng.i.in.
Jérémie Galarneau [Mon, 14 Jan 2013 16:45:49 +0000 (16:45 +0000)] 
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>
11 years agoExtras: Redefined PyInt_AsSsize_T to PyLong_AsSsize_t.
Jérémie Galarneau [Mon, 14 Jan 2013 16:45:48 +0000 (16:45 +0000)] 
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>
11 years agoExtras: Fix the undefined reference to md build error.
Jérémie Galarneau [Mon, 14 Jan 2013 16:45:47 +0000 (16:45 +0000)] 
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>
11 years agoExtras: Added lttng.pyc to make clean
Jérémie Galarneau [Mon, 14 Jan 2013 16:45:46 +0000 (16:45 +0000)] 
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>
11 years agoRefactor ust-app create session
David Goulet [Wed, 16 Jan 2013 20:19:35 +0000 (15:19 -0500)] 
Refactor ust-app create session

This function was basically a mess for returned values. A valid pointer
that could be a created or already existing session, NULL on error or -1
on disconnect error...

Now, it returns 0 on success or a negative errno code. It populates the
ust app session pointer parameter given by the caller and sets to 1, if
available, the is_created parameter if we did in fact create a new
session.

The motivation behind that was to be able to know if the session was
created or not so we could do a cleanup aftwerwards if any error on the
code path requires wipping the session object. This patch uses that for
the case of a create channel failure just after the session creation. It
now wipes the session if it was created.

Furthermore, this has been error prone in the past by forgetting to
handle the -1 error value being in a pointer variable.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove duplicate set ust event filter
David Goulet [Wed, 16 Jan 2013 19:15:42 +0000 (14:15 -0500)] 
Fix: remove duplicate set ust event filter

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoMake sync_file_range() usage optional
Samuel Martin [Sat, 12 Jan 2013 08:23:57 +0000 (09:23 +0100)] 
Make sync_file_range() usage optional

Under uClibc, sync_file_range() is not available under all
architectures, so we fall back to fdatasync() in this case.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoDestroy created kernel channel on enable all error
David Goulet [Mon, 14 Jan 2013 20:36:17 +0000 (15:36 -0500)] 
Destroy created kernel channel on enable all error

If we had to create a channel for an enable all tracepoint call (-a -k)
and the enable fails, destroy the created kernel channel.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd internal kernel channel destroy function
David Goulet [Mon, 14 Jan 2013 19:41:38 +0000 (14:41 -0500)] 
Add internal kernel channel destroy function

The internal representation of a kernel channel in the session daemon
now has a session pointer that points to the associated session. This is
needed so when we destroy a channel, we can update the channel count of
the session if available.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd pidfile creation for lttng-sessiond
David Goulet [Fri, 11 Jan 2013 20:12:12 +0000 (15:12 -0500)] 
Add pidfile creation for lttng-sessiond

This also adds a pidfile function to common/utils.c so it could be used
by the all binaries needing this feature.

Fixes #276

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoExtras: fix checkpatch.pl to use 4 spaces for a tab
David Goulet [Fri, 11 Jan 2013 20:11:39 +0000 (15:11 -0500)] 
Extras: fix checkpatch.pl to use 4 spaces for a tab

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoExtras: Add a checkpatch git pre-commit hook
Christian Babeux [Mon, 7 Jan 2013 22:12:42 +0000 (17:12 -0500)] 
Extras: Add a checkpatch git pre-commit hook

This commit add the checkpatch-hook script that can be installed in git
hooks folder in order to detect style issue before commiting any staged
changes.

The .checkpatch.conf file contains the appropriate options conforming to
the coding style used in the lttng-tools tree.

Also included in this commit is an install script to automatically
install the hook in the git local repo.

To override the pre-commit hook check, one can use the
`git commit --no-verify` command.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoExtras: Change TYPE of braces around single statement
Christian Babeux [Mon, 7 Jan 2013 22:12:41 +0000 (17:12 -0500)] 
Extras: Change TYPE of braces around single statement

Change the TYPE of the "braces {} are not necessary for single statement
blocks" warning from BRACES to BRACES_SINGLE_STMT in order to correctly
ignore this particular warning and continue to warn for other BRACES
warnings.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoExtras: Add the checkpatch coding style script
Christian Babeux [Mon, 7 Jan 2013 22:12:40 +0000 (17:12 -0500)] 
Extras: Add the checkpatch coding style script

Taken from the Linux Kernel tree in scripts/checkpatch.pl.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: update next_net_seq_num after sending header
David Goulet [Thu, 10 Jan 2013 17:07:35 +0000 (12:07 -0500)] 
Fix: update next_net_seq_num after sending header

Increment the sequence number after we are sure that the relayd has
received correctly the data header. If an error occurs when sending the
header, the data won't be extracted from the buffers thus keeping this
sequence number untouched.

Furthermore, after sending the header, if the relayd dies, this value
won't matter much and if there is an error on the stream when reading
the trace data, the stream will be deleted thus closed on the relayd
making this value useless.

It's important to note that this sequence number is updated on the
relayd side if the full expected data packet was received. So,
incrementing the value after the transmission of the header is not
changing anything in terms of value coherency. The point is to have a
semantic of when read and used successfully (transmission to relayd),
let's update it.

In that code flow, the stream's lock is acquired so no need to
read/update it atomically. I've also added a comments to better
understand the purpose of this variable and how to use it.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: wrong loop continuation in metadata thread
David Goulet [Thu, 10 Jan 2013 15:18:31 +0000 (10:18 -0500)] 
Fix: wrong loop continuation in metadata thread

The validation of the endpoint status can change the metadata hash table
meaning stream(s) can be removed from it and the poll set. After that,
continuing the for loop was making the thread use possible invalid file
descriptor that were not in the hash table anymore trigerring the lookup
assert of the node just after the for loop.

The very important part here is that when the metadata ht changes, we
MUST go back to the poll wait() to synchronize the subset of fd we are
looking at.

Reported-by: Jesus Garcia <jesus.garcia@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: lttng create session memleaks
David Goulet [Wed, 9 Jan 2013 22:06:38 +0000 (17:06 -0500)] 
Fix: lttng create session memleaks

The uri_parse() function call was leaking copy(ies) of lttng_uri
structure.

Fixes #420

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: remove unused session id map
David Goulet [Wed, 9 Jan 2013 15:14:15 +0000 (10:14 -0500)] 
Fix: remove unused session id map

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: wrong session id used on relayd lookup
David Goulet [Wed, 9 Jan 2013 15:03:38 +0000 (10:03 -0500)] 
Fix: wrong session id used on relayd lookup

The relayd session id might not be unique with multiple relayd so the
lookup could choose the wrong relayd for the given sessiond session id.

Fixes #419

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: don't do custom lookup to relayd stream ht
David Goulet [Mon, 7 Jan 2013 22:44:03 +0000 (17:44 -0500)] 
Fix: don't do custom lookup to relayd stream ht

Use the function made for stream lookup for all lookup calling site. The
function had to move up so to be visible.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd pkg-config for liblttng-ctl
Yannick Brosseau [Thu, 20 Dec 2012 19:31:06 +0000 (14:31 -0500)] 
Add pkg-config for liblttng-ctl

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd kernel modules loading for new probes
Andrew Gabbasov [Mon, 10 Dec 2012 19:37:03 +0000 (13:37 -0600)] 
Add kernel modules loading for new probes

New probes introduced by commit b87700e318c27267890cbd6fb5e50b687279131b
in lttng-modules.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
This page took 0.066081 seconds and 5 git commands to generate.