David Goulet [Wed, 8 Feb 2012 21:02:25 +0000 (16:02 -0500)]
Increase sleep time for ust-nprocesses test
On slower system, the sleep time of ust-nprocesses can be too short
making the test fail. However, there is not much we can do to make sure
all app. registers to the session daemon and there is no time guarantee
also.
Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Tue, 7 Feb 2012 21:44:30 +0000 (16:44 -0500)]
Fix session syscall listing
This problem occured because the "syscall" event was not added to the
event list since his kernel FD is not valid (fd=0). However, this fd is
only usefull if we want to add context or disable events. Those two
operations are not supported for now.
So, we can safely add the event to the list and add a hardcoded name in
the lttng cli list command.
Signed-off-by: David Goulet <dgoulet@efficios.com>
==27395== Syscall param socketcall.sendmsg(msg.msg_iov[i]) points to uninitialised byte(s)
==27395== at 0x546C6A0: __sendmsg_nocancel (syscall-template.S:82)
==27395== by 0x4E30880: lttcomm_send_creds_unix_sock (sessiond-comm.c:449)
==27395== by 0x4E2F584: ask_sessiond (lttng-ctl.c:99)
==27395== by 0x4E2FC85: lttng_list_tracepoints (lttng-ctl.c:667)
==27395== by 0x4039C1: cmd_list (list.c:314)
==27395== by 0x40217C: main (lttng.c:266)
==26825== 580 bytes in 1 blocks are definitely lost in loss record 13 of 13
==26825== at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26825== by 0x4E2F702: lttng_create_handle (lttng-ctl.c:385)
==26825== by 0x403A5F: cmd_list (list.c:255)
==26825== by 0x40217C: main (lttng.c:266)
Initialize all stack variables to zero, fix uninitialized loglevel variables
If we want the padding behavior to be always the same (for future
extensibility), we need to set those variables to zero when they are
declared on the stack.
Also fix uninitialized loglevel variables in tests, which were failing
on x86_32 due to this.
David Goulet [Thu, 2 Feb 2012 16:47:37 +0000 (11:47 -0500)]
Fix EEXIST handling on epoll_ctl add
Creating a second channel on the kernel tracer triggers a
update_kernel_poll which iterates over all channels and add the file
descriptors to the epoll set. Collision occurs with the first previously
added channel so EEXIST is acceptable and we simply do not perror() to
keep the session daemon stderr clean.
Signed-off-by: David Goulet <dgoulet@efficios.com>
The create_session function was changed making the session name not
having the date and time append to it anymore. This completely broke the
default behavior of automatic session creation. Only one possible
session name was 'auto'.
Signed-off-by: David Goulet <dgoulet@efficios.com>
Thibault, Daniel [Mon, 30 Jan 2012 21:58:22 +0000 (16:58 -0500)]
Fixing memory leaks in add-context command
Besides enforcing the return values and outputting --help to stdout, the
problem lay with the instances of struct ctx_type *type being created
but not assigned to the doubly-linked list under various error
conditions.
Signed-off-by: Daniel U. Thibault <daniel.thibault@drdc-rddc.gc.ca> Signed-off-by: David Goulet <dgoulet@efficios.com>
Thibault, Daniel [Mon, 30 Jan 2012 21:26:34 +0000 (16:26 -0500)]
Rewrites lttng-ctl's set_session_daemon_path
This fifth patch rewrites lttng-ctl's set_session_daemon_path() to avoid
duplicating snippets of code. It also fixes the snprintf return value
test so the code works with both GNU C < 2.1 and >= 2.1. With GNU C <
2.1, snprintf returns -1 if the target buffer is too small; with GNU C
>= 2.1, snprintf returns the required size (excluding the closing null)
under the same conditions.
Signed-off-by: Daniel U. Thibault <daniel.thibault@drdc-rddc.gc.ca> Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Fri, 27 Jan 2012 17:43:54 +0000 (12:43 -0500)]
Add CMD_WARNING error code
The CMD_WARNING is returned if at least one command went wrong and at
least one succeeded. This shoudl tell the user that there is an error
message on stderr but the rest of the command went well.
One use case for that is the multiple -t of add_context. If one of them
fails, this code is returned.
This error code is added at the end of the enum so the previous CMD code
are not changed.
Also, if the tracer (-k/-u) is not specified, CMD_ERROR is returned
instead of CMD_UNDEFINED which makes way more sense.
Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Fri, 27 Jan 2012 15:37:45 +0000 (10:37 -0500)]
Fix comments and enforce expected return values
Improve calibrate and add_context usage() printout. Document and enforce
the expected return values for the cmd_calibrate/cmd_addcontext chain of
functions.
Fix add_context usage()
Add documentation in liblttng-ctl.
Signed-off-by: Daniel Thibault <daniel.thibault@drdc-rddc.gc.ca> Signed-off-by: David Goulet <dgoulet@efficios.com>
If the child is scheduled before the parent, using "pause()" in the
parent could be executed after the signal has been handled: that's
entirely racy. Use a proper signal handler and flag to handle this
racelessly.
- strncmp should compare up to and _include_ the \0 (was off by one).
Instead of 2 for "-h", it should be 3. Use "sizeof("-h")" instead of
hardcoding 3.
- strncmp logic was reversed for the --list-options check.
Simon Marchi [Tue, 24 Jan 2012 16:28:04 +0000 (11:28 -0500)]
Add a '--list-options' option to each command.
This is intended to be used for programmable Bash completion.
Modified from previous version:
- Changed '\0' to 0 to match current coding style.
Changes made by David Goulet:
- Check args for --list-options in lttng cli to stop auto execution of
the session daemon.
- Adds --list-options to all help. (Hidding command is bad :P)
- Fix uninitialized ret value in enable channel
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca> Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Tue, 24 Jan 2012 16:49:49 +0000 (11:49 -0500)]
Check kernel version for tests
Test using the session daemon must be done on a kernel version 2.6.27 or
higher for lttng-tools and lttng-ust requirements. Before starting a
session daemon, tests validate the kernel version and stop them if the
kernel is too old.
This is *really* important for launchpad build system which compile and
run our tests on 2.6.24 kernel.
Signed-off-by: David Goulet <dgoulet@efficios.com>
David Goulet [Tue, 24 Jan 2012 15:17:30 +0000 (10:17 -0500)]
Add MSG_WAITALL to recvmsg of sessiond-comm
Get the complete message on receive. We do not handle receiving split
data with the lttcomm_recv_unix_sock which is *not* good but for now we
will simply add this flag since every call should block anyway and does
not require any other funky flags.
This issue was detected with the kernel events listing failing by
sending half of the data half the time.
Reported-by: Daniel Thibault <daniel.thibault@drdc-rddc.gc.ca> Signed-off-by: David Goulet <dgoulet@efficios.com>