lttng-tools.git
11 years agoAdd a README.cygwin for Cygwin specific build/install instructions cygwin-2.0-experimental
Christian Babeux [Fri, 21 Dec 2012 18:47:16 +0000 (13:47 -0500)] 
Add a README.cygwin for Cygwin specific build/install instructions

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoCygwin: Force run_as_noclone on Cygwin
Christian Babeux [Thu, 6 Dec 2012 04:37:08 +0000 (23:37 -0500)] 
Cygwin: Force run_as_noclone on Cygwin

Since clone(2) is not available on Cygwin, force the use of run_as_noclone().

11 years agoCygwin: Fix racy read to detect applications sockets close
Christian Babeux [Thu, 6 Dec 2012 04:33:17 +0000 (23:33 -0500)] 
Cygwin: Fix racy read to detect applications sockets close

The mechanism to detect the applications sockets close is racy and
could potentially discard data. A read(3) is performed on the application
socket and the returned len is compared to 0 to detect the case where an
application closed the socket. If a read(3) occur in the thread_manage_apps
*before* the consumption of the data in the consumer, one byte of data would
be discarded.

To fix this race, perform a recv(3) on the socket with the MSG_PEEK flag.
This has no impact on the data delivery to the consumer and can successfully
detect the applications sockets close.

11 years agoCygwin: Fix fd hangup in thread_manage_apps of sessiond
Christian Babeux [Mon, 3 Dec 2012 03:09:28 +0000 (22:09 -0500)] 
Cygwin: Fix fd hangup in thread_manage_apps of sessiond

The fd hangup is not properly detected in the thread that manage
applications in the sessiond.

A read is done on the fd and if we encounter EOF, we force the
removal of the fd from the set.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Fixup of wait pipe hangup commit
Christian Babeux [Mon, 3 Dec 2012 03:07:52 +0000 (22:07 -0500)] 
Cygwin: Fixup of wait pipe hangup commit

The condition in lttng_ustconsumer_check_pipe was wrong.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Fix handling of wait pipe hangup by properly detecting EOF
Christian Babeux [Mon, 3 Dec 2012 02:09:39 +0000 (21:09 -0500)] 
Cygwin: Fix handling of wait pipe hangup by properly detecting EOF

On Linux, the POLLHUP poll(3) event is used to signal that the other end
of a pipe has been disconnected. Due to poor wording in the Single UNIX
Specification, differents UNIX implementation signal the EOF with
conflicting poll events [1].

This is the case on Cygwin. A pipe close sends the POLLIN poll(3) event.
The actual consumer implementation sees this has a wakeup for data
ready to be consumed. The current hangup handling leads to infinite looping
in the consumer because the hangup is never detected and the POLLIN event
is never cleared.

To fix this issue, the consumer must read on the pipe, check for EOF
(read(3) shall return 0 to indicate EOF) and proceed to force the POLLHUP
poll(3) event if this is indeed the case.

[1] - http://www.greenend.org.uk/rjk/tech/poll.html

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Introduce new LTTNG_UST_STREAM_PIPE command to open wakeup pipe
Christian Babeux [Mon, 3 Dec 2012 01:41:43 +0000 (20:41 -0500)] 
Cygwin: Introduce new LTTNG_UST_STREAM_PIPE command to open wakeup pipe

Normally, the userspace tracer open the wakeup pipe, and the resulting
fd is passed to the consumer via the session daemon. Since we can't pass
fds via UNIX socket, the pipe need to be opened separately in the tracer
and in the consumer. The only way to open the write side of a named pipe
*before* the read side without blocking is to open it in read/write mode.
This is supported on Linux, but POSIX leave this behavior undefined [1].

The Cygwin named pipe implementation doesn't seem to allow multiple
readers/writers on a named pipe. Opening a pipe in RW mode in the tracer
and then opening the read side in the consumer won't work because the
consumer will get a "Device or ressource busy" error. Thus arise the need
to open the named pipe read side *before* the write side.

In order to accomplish this task, a new command must be introduced to signal
to the tracer that a specific named pipe should be opened in write mode.

Proper care must be taken to issue this command *after* the named pipe paths
have been sent to the consumer or else the sessiond or tracer will block
indefinitely.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Pass file paths instead of file descriptors over UNIX sockets
Christian Babeux [Mon, 3 Dec 2012 01:37:18 +0000 (20:37 -0500)] 
Cygwin: Pass file paths instead of file descriptors over UNIX sockets

Cygwin doesn't support file descriptors passing over UNIX sockets [1].
LTTng-ust and LTTng-tools make extensive use of this feature to pass
the shm and the wakeup pipe file descriptor from the userspace tracer
to the session daemon. The sessiond then pass those file descriptors
to the consumer.

To workaround this limitation, we pass the file paths of the shm and the
named wakeup pipe. These paths are relayed by the sessiond to the
consumer. The consumer then needs to open these paths.

The files are created in /tmp/lttng-fds and have the following format:

SHM         : ust-shm-<pid>-<uuid>
Wakeup pipe : ust-wait-<pid>-<uuid>

[1] - http://cygwin.com/ml/cygwin/2009-10/msg00403.html

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoForce the ld "no-undefined" flag on Cygwin
Christian Babeux [Thu, 29 Nov 2012 20:14:11 +0000 (15:14 -0500)] 
Force the ld "no-undefined" flag on Cygwin

In order to build shared libraries on Cygwin/MinGW/Windows, all
symbols must be defined at link time. Activating the "-no-undefined"
flag will fail the build if it's not the case.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoUse the new functions for default subbuf sizes
Simon Marchi [Thu, 29 Nov 2012 17:57:10 +0000 (12:57 -0500)] 
Use the new functions for default subbuf sizes

commit 3e230f922d67f7a47b66631f7a8cf458002b3727 upstream.

Use the functions added by the previous commit. All the occurences of
the previous defines were replaced.

[ Edit by Christian Babeux: Changes to tests/tools/Makefile.am were
  not applied because this file is not present in the stable 2.0 branch.
  Also added the relevant *_LDADD = $(top_builddir)/src/common/libcommon.la
  to the differents Makefile.am where the new functions are used. ]

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoAdd default subbuf sizes getter functions
Simon Marchi [Tue, 13 Nov 2012 19:28:42 +0000 (14:28 -0500)] 
Add default subbuf sizes getter functions

commit 8b3bd7a32e514aae56e718491a10f582b03140c3 upstream.

This patch adds functions to retrieve defaults subbuf sizes. It uses the
DEFAULT_*_SUBBUF_SIZE defines from defaults.h but also make sure that
the values are at least as big as the page size.

The functions are defined as static inline in defaults.h.

[ Edit by Christian Babeux: Resolved conflict in src/common/Makefile.am
  and src/common/defaults.h ]

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoAdd max() and min() macro in common
Simon Marchi [Tue, 13 Nov 2012 19:28:41 +0000 (14:28 -0500)] 
Add max() and min() macro in common

commit cf3f19ae5f634bf07dcdb771e66d40f805700a17 upstream.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Removed useless includes
Christian Babeux [Thu, 29 Nov 2012 16:17:36 +0000 (11:17 -0500)] 
Cygwin: Removed useless includes

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoCygwin: Add clone compat layer
Christian Babeux [Thu, 29 Nov 2012 16:13:48 +0000 (11:13 -0500)] 
Cygwin: Add clone compat layer

Cygwin doesn't support the clone() syscall [1].
Users must explicitly set the LTTNG_DEBUG_NOCLONE environment variable.

[1] - http://cygwin.com/ml/cygwin/2009-05/msg00172.html

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoFix: Remove dependency to urcu-cds in tools tests
Christian Babeux [Thu, 29 Nov 2012 15:58:15 +0000 (10:58 -0500)] 
Fix: Remove dependency to urcu-cds in tools tests

The -lurcu-cds link flag is not mandatory to link any of the tests.
Also, adding this flag can cause multiple symbol definition errors when
linking statically because the libhashtable contains symbol names that
are also present in urcu-cds.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agocompat mman.h: add cygwin support
Mathieu Desnoyers [Thu, 24 May 2012 17:46:40 +0000 (13:46 -0400)] 
compat mman.h: add cygwin support

commit 2667678617cac0d49c3f72343955827d29719ec6 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agocompat socket.h: add cygwin support
Mathieu Desnoyers [Thu, 24 May 2012 17:46:21 +0000 (13:46 -0400)] 
compat socket.h: add cygwin support

commit 5db8b7b1b6c49bfb25ffc438c95941eecee060f5 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agokernel-ctl: cygwin compatibility compile fix
Mathieu Desnoyers [Thu, 24 May 2012 16:07:21 +0000 (12:07 -0400)] 
kernel-ctl: cygwin compatibility compile fix

commit 95ba0f2fffd50c6d52e028cbb72ab1fcd43db876 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agopoll compat wrapper: add cygwin support
Mathieu Desnoyers [Thu, 24 May 2012 16:01:47 +0000 (12:01 -0400)] 
poll compat wrapper: add cygwin support

commit 3247be18440ddc45bbc45f0cf9cdbc5691aae08e upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoUpdate fcntl cygwin support
Mathieu Desnoyers [Thu, 24 May 2012 15:59:38 +0000 (11:59 -0400)] 
Update fcntl cygwin support

commit 4443d2b1356a787069fb75a5598f5fda660d37dd upstream.

cygwin has posix_fadvise

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agocygwin support: only freebsd needs to typedef loff_t
Mathieu Desnoyers [Thu, 24 May 2012 15:49:55 +0000 (11:49 -0400)] 
cygwin support: only freebsd needs to typedef loff_t

commit 15d3d5d89e2ca0656e653323c053d29e72674d32 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agofix: add missing parenthesis
Mathieu Desnoyers [Thu, 24 May 2012 15:01:03 +0000 (11:01 -0400)] 
fix: add missing parenthesis

commit b1c900e9d222629937cb1a42e769318e88f28664 upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agocompat fcntl.h: add cygwin support
Mathieu Desnoyers [Thu, 24 May 2012 15:00:11 +0000 (11:00 -0400)] 
compat fcntl.h: add cygwin support

commit c345f883983ae8d187c6e3bb087fba9d33d8d72b upstream.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
11 years agoFix: Delete UST app session on ustctl create error
David Goulet [Mon, 3 Dec 2012 19:34:45 +0000 (14:34 -0500)] 
Fix: Delete UST app session on ustctl create error

This has been updated in upstream master (see commit:
0f83395d5e0e927fdab025eae023e68e9021af26).

There was also a check missing at one of the callsite.

http://lists.lttng.org/pipermail/lttng-dev/2012-December/019208.html

Reported-by: David OShea <David.OShea@quantum.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to 2.0.5 stable v2.0.5
David Goulet [Wed, 28 Nov 2012 16:28:30 +0000 (11:28 -0500)] 
Update version to 2.0.5 stable

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Change the type of enabled in lttng_event to a signed int
David Goulet [Mon, 24 Sep 2012 21:45:38 +0000 (17:45 -0400)] 
Fix: Change the type of enabled in lttng_event to a signed int

Closes #258

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Returned code when listing kernel channel
David Goulet [Mon, 24 Sep 2012 21:40:36 +0000 (17:40 -0400)] 
Fix: Returned code when listing kernel channel

Backported from master branch.

See bug #260.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Wrong returned error code on UST enable event
David Goulet [Fri, 21 Sep 2012 17:07:36 +0000 (13:07 -0400)] 
Fix: Wrong returned error code on UST enable event

(Patch backported from the master branch
95a8266405f61b6927f8cef13b1fdfa0b5584274)

Instead of sending back a FATAL error, correctly notify the user of a
failed UST enable event.

The bug261 was not reproducible anymore but led to this fix.

(Closes 261)

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: consumer recv command error path
David Goulet [Tue, 11 Sep 2012 19:36:11 +0000 (15:36 -0400)] 
Fix: consumer recv command error path

See bug #332.

Backported from the master branch with commit id:
4cbc1a04e8ac3c1dd4f9a4dc44b56ee8430189f0

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Missing libs dependencies in configure check for lttng-ust-ctl
Christian Babeux [Fri, 3 Aug 2012 20:31:28 +0000 (16:31 -0400)] 
Fix: Missing libs dependencies in configure check for lttng-ust-ctl

The lttng-ust-ctl library depends on liburcu-{common,bp,cds}.  The
AC_CHECK_LIBRARY macro can't automatically resolve dependents libraries
(ala libtool), so any additionnals dependencies must be manually
specified.

Also, the AC_CHECK_LIB action-if-found case for the lttng-ust-ctl check
is modified to have a similar behavior as the default action, which is
to define HAVE_LIBxxx and append -lxxx to $LIBS, *except* for the later
step. This is to ensure that any future addition of AC_CHECK_LIB after
the one for lttng-ust-ctl will not need to append the liburcu
dependencies or fail unexpectedly.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: Libtool fails to find dependent libraries when cross-compiling lttng-tools
Christian Babeux [Fri, 3 Aug 2012 20:31:27 +0000 (16:31 -0400)] 
Fix: Libtool fails to find dependent libraries when cross-compiling lttng-tools

This problem arise when cross compiling and linking libraries with
indirect libraries dependencies (such as liblttng-ust). This "bug" is
caused by an upstream modification in the libtool package on Debian
system. The libtool "link_all_deplibs" flag is set to "no" by default
on linux targets (AFAIK, other distros set it to "unknown").

The chosen solution is to detect such cases via the configure script
and automagically patch the libtool.m4 by forcing the "link_all_deplibs"
to "unknown".

This fixup can be disabled with the appropriate configure flag:

./configure --disable-libtool-linkdep-fixup

Sample configure output on affected systems:

checking for occurence(s) of link_all_deplibs = no in
 ./config/libtool.m4... 3
configure: WARNING: the detected libtool will not link all
     dependencies, forcing link_all_deplibs = unknown

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to 2.0.4 stable v2.0.4
David Goulet [Wed, 25 Jul 2012 15:25:51 +0000 (11:25 -0400)] 
Update version to 2.0.4 stable

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix typo: utils.sh
Mathieu Desnoyers [Tue, 17 Jul 2012 23:29:29 +0000 (19:29 -0400)] 
Fix typo: utils.sh

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: test: session list count cannot use "count" unique id
Mathieu Desnoyers [Tue, 17 Jul 2012 23:27:34 +0000 (19:27 -0400)] 
Fix: test: session list count cannot use "count" unique id

Fixes #305

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: The session list count should provide unique identifiers
Mathieu Desnoyers [Wed, 11 Jul 2012 22:23:12 +0000 (18:23 -0400)] 
Fix: The session list count should provide unique identifiers

Never decrement it.

Reported-by: Amer Alhalabi <amer.alhalabi@ericsson.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: mmap write() for large subbuffers and handle EINTR (v2)
Mathieu Desnoyers [Fri, 6 Jul 2012 14:13:05 +0000 (10:13 -0400)] 
Fix: mmap write() for large subbuffers and handle EINTR (v2)

With large subbuffer (packet) size, if write() returns before copying the
entire packet for mmap buffers, the consumerd restarts the write
infinitely, which is not good at all.

This affects both lttng-ust (in default mmap mode) and lttng-kernel (but
only for mmap buffers, which is not the default).

This issue would show up with large subbuffer size.

We need to handle this case, as well as EINTR errors (which need to restart
write).

Also fixing the return value of mmap read functions, which were returning
the amount of data written by the last invocation of write() rather than
the total number of bytes written. splice use had the same issue.

Also now consider a write() that returns more bytes than requested as an
error.

Moreover, assigning error = ret after failed splice and write was a
mistake: error is holding the actual error value. ret just holds -1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: support large files on 32-bit systems
Mathieu Desnoyers [Fri, 29 Jun 2012 10:40:30 +0000 (12:40 +0200)] 
Fix: support large files on 32-bit systems

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoUpdate version to 2.0.3 stable v2.0.3
David Goulet [Fri, 22 Jun 2012 15:18:54 +0000 (11:18 -0400)] 
Update version to 2.0.3 stable

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: enable event loglevel match function
David Goulet [Fri, 22 Jun 2012 15:02:51 +0000 (11:02 -0400)] 
Fix: enable event loglevel match function

For the loglevel type ALL, the value set in an event inside the session
daemon is -1 where the value received from the client is 0. For this
loglevel type, the loglevel does not matter.

This fixes the commit c0657016bbb98e1769edbaba8c00221f964c7402 done
before version 2.0.2.

(Closes #283 #287)

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: unchecked pointer from getenv() for lttng create
David Goulet [Tue, 19 Jun 2012 15:15:38 +0000 (11:15 -0400)] 
Fix: unchecked pointer from getenv() for lttng create

The lttng create command was not handling the return pointer from
getenv("HOME") and was passing it to a strdup() call.

(close #271)

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoUpdate version to 2.0.2 stable v2.0.2
David Goulet [Thu, 14 Jun 2012 17:58:41 +0000 (13:58 -0400)] 
Update version to 2.0.2 stable

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: enable event with different loglevel error
Mathieu Desnoyers [Thu, 14 Jun 2012 14:43:04 +0000 (10:43 -0400)] 
Fix: enable event with different loglevel error

This following example was NOT returning a correct error message.
"event1" is set with a loglevel "TRACE_CRIT". The normal behavior here
is that once enabled, you can not change the loglevel of the enable
event on the tracer side with a second command. It now returns a new
error message like so:

$ lttng enable-event event1 --loglevel-only TRACE-CRIT -u
$ lttng enable-event event1 --loglevel-only TRACE-WARNING -u
[...] Event already enabled with different loglevel

This commit makes the session daemon verify if _both_ the name and
loglevel are the same when enabling an event or else an error is
returned.

Also, the session daemon will continue enabling events and not return an
error is the loglevel does not match event for ust app on the tracer
which returns an EPERM at that stage. This is to address the case where
two applications have the same event name but with different loglevel.

Reported-by: Tan Dung Le Tran <tan.dung.le.tran@ericsson.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: move memset in channel_set_attr after NULL check
Danny Serres [Wed, 6 Jun 2012 18:54:30 +0000 (14:54 -0400)] 
Fix: move memset in channel_set_attr after NULL check

Signed-off-by: Danny Serres <danny.serres@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoFix: close all file descriptors when executed as daemon
Mathieu Desnoyers [Mon, 4 Jun 2012 22:08:24 +0000 (18:08 -0400)] 
Fix: close all file descriptors when executed as daemon

Both sessiond and consumerd support the option "-d" to run as daemon. In
some specific cases, e.g. when launched from dpkg installation scripts,
file descriptors 3, 4, 5 are left open and don't seem to have O_CLOEXEC
flag set, so the install script hangs because the sessiond still holds a
reference to them. daemon(3) only closes standard FD 0, 1, 2.

Fix this issue by closing all file descriptors after calling daemon(3).
Note: we make sure no file descriptor is opened before calling daemon(3)
by moving the init_thread_quit_pipe() call after the FD close.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoFix: clang llvm warnings
David Goulet [Thu, 31 May 2012 16:21:27 +0000 (12:21 -0400)] 
Fix: clang llvm warnings

Mostly fix unsigned expression and implicit conversion.

URCU still shows warnings but irrelevant.

Signed-off-by: David Goulet <dgoulet@efficios.com>
11 years agoAdd CodingStyle to tarball
Mathieu Desnoyers [Wed, 30 May 2012 13:53:42 +0000 (09:53 -0400)] 
Add CodingStyle to tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 years agoAdd coding style document
Mathieu Desnoyers [Wed, 30 May 2012 13:10:57 +0000 (09:10 -0400)] 
Add coding style document

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoUpdate version to 2.0.1 stable v2.0.1
David Goulet [Thu, 19 Apr 2012 15:12:09 +0000 (11:12 -0400)] 
Update version to 2.0.1 stable

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: test script for kernel module validation
David Goulet [Thu, 19 Apr 2012 15:03:38 +0000 (11:03 -0400)] 
Fix: test script for kernel module validation

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: report error to client on consumerd error
David Goulet [Thu, 19 Apr 2012 14:58:42 +0000 (10:58 -0400)] 
Fix: report error to client on consumerd error

Adds a consumer daemon state flag that allows us to know the state of
the consumer during client command processing.

Please refer to the comment in lttng-sessiond/main.c above the
definition of those flags for more information and a possible race
condition issue.

This is a quick fix for bug #137 that will be merged in 2.0-stable
branch.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: replace 'modprobe -l' by lsmod in kernel test
David Goulet [Mon, 16 Apr 2012 15:35:34 +0000 (11:35 -0400)] 
Fix: replace 'modprobe -l' by lsmod in kernel test

The -l option does not exist anymore on recent version of modprobe. Use
lsmod instead.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: add missing ht_destroy at consumer teardown
Mathieu Desnoyers [Thu, 12 Apr 2012 15:45:36 +0000 (11:45 -0400)] 
Fix: add missing ht_destroy at consumer teardown

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: consumer fd recv thread should write into non-blocking pipe
Mathieu Desnoyers [Thu, 12 Apr 2012 01:57:31 +0000 (21:57 -0400)] 
Fix: consumer fd recv thread should write into non-blocking pipe

Writing into a blocking pipe will cause the writer thread to block on
the poll fds thread when the pipe is full. Given that we would like to
batch stream array reallocation as much as possible, this wakeup should
not block.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: work-around glibc __nptl_setxid vs clone hang
Mathieu Desnoyers [Thu, 12 Apr 2012 01:07:13 +0000 (21:07 -0400)] 
Fix: work-around glibc __nptl_setxid vs clone hang

hash table resize threads exit end up setting a "locked" state within
libc pthread, which deadlocks with seteuid/setegid called from the
cloned process in runas.c when runas() is called exactly when a resize
thread exits.

Temporarily fix this issue by adding a mutex cross this resize
operation, which holds mutual exclusion with runas() usage.

We should investigate whether we want to properly call exec() from the
runas.c clone child before touching any non-async-signal-safe libc call.
However, given that this change is more intrusive, let's first use this
mutex-based work-around.

Before this fix, running 1000 instances of "demo-trace 300" with
sessiond running as root, and:

lttng create
lttng enable-event -u -a
lttng start

would sometimes lead to consumerd hang with the following clone child
backtrace:

setxid_mark_thread (cmdp=<optimized out>, t=0x7f52dd47c700)
    at allocatestack.c:995
995 allocatestack.c: No such file or directory.
(gdb) bt full
    at allocatestack.c:995
        ch = <optimized out>
    at allocatestack.c:1088
        t = 0x80
        signalled = <optimized out>
        result = <optimized out>
        runp = 0x7f52dd47c9c0
    at ../sysdeps/unix/sysv/linux/setegid.c:44
        __p = 0xfffffffffffffe00
        __cmd = {syscall_no = 119, id = {-1, 1000, -1}, cntr = 0}
        result = <optimized out>
        data = 0x7f52e66e1930
        writelen = <optimized out>
        writeleft = <optimized out>
        index = <optimized out>
        sendret = {i = 0, c = "\000\000\000"}
        ret = <optimized out>
        __func__ = "child_run_as"
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
No locals.
No symbol table info available.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: consumer fd recv poll should be sensitive to POLLPRI too
Mathieu Desnoyers [Wed, 11 Apr 2012 22:15:24 +0000 (18:15 -0400)] 
Fix: consumer fd recv poll should be sensitive to POLLPRI too

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix consumer lttng_consumer_poll_socket poll revents check bug
Mathieu Desnoyers [Wed, 11 Apr 2012 22:06:08 +0000 (18:06 -0400)] 
Fix consumer lttng_consumer_poll_socket poll revents check bug

Was causing the sessiond to fail to receive streams under heavy load,
because this test needs to be done with a mask rather than equality.
Testing equality was failing as soon as POLLPRI (or any other flag) was
set.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: increase consumer open files limit
David Goulet [Wed, 11 Apr 2012 21:56:29 +0000 (17:56 -0400)] 
Fix: increase consumer open files limit

Set ulimit of consumer when root so it can scales up to the session
daemon number of open files.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoUpdate README: document dep on modprobe for kernel tracing
Mathieu Desnoyers [Wed, 11 Apr 2012 00:33:57 +0000 (20:33 -0400)] 
Update README: document dep on modprobe for kernel tracing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: wait for sessiond to stop in tests
David Goulet [Tue, 10 Apr 2012 17:42:46 +0000 (13:42 -0400)] 
Fix: wait for sessiond to stop in tests

Before returning from stop_sessiond bash function, we wait that the
sessiond daemon completely stopped. If it hungs up at that point, the
kill did not work and investigation can begin.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: remove unused return variable
David Goulet [Tue, 10 Apr 2012 14:59:07 +0000 (10:59 -0400)] 
Fix: remove unused return variable

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoDon't report back error on syscalls fail for -a -k
David Goulet [Fri, 6 Apr 2012 19:24:53 +0000 (15:24 -0400)] 
Don't report back error on syscalls fail for -a -k

lttng enable-event -a -k will not report an error anymmore if enabling
syscall events has failed. Please refer to the commitdiff for a detailed
comment on why this is done like so.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: destroy context hash table being NULL
David Goulet [Thu, 5 Apr 2012 19:56:43 +0000 (15:56 -0400)] 
Fix: destroy context hash table being NULL

Passing an event unknown loglevel type to the session daemon (for UST
domain) was triggering an error code path to destroy the context hash
table of the event which is not created once the error is hit.

Fix a segfault completely killing the session daemon.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: make lttng expand path for trace output opt
David Goulet [Thu, 5 Apr 2012 15:39:59 +0000 (11:39 -0400)] 
Fix: make lttng expand path for trace output opt

lttng create --output was passing the path string to the session daemon
and thus, for relative path like './mytraces', it was created in the
current directory of the session daemon.

Now lttng command line uses the realpath(3) of the --output string and
denies creation if multiple level of directory does not exist (Ex:
/tmp/foo/bar/chap, if foo/ does not exist, it is refused).

Directory creation still occurs on the session daemon side.

Reported-by: Ettore Del Negro <ettore@ettoredelnegro.me>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: return value signedness
David Goulet [Tue, 3 Apr 2012 18:29:01 +0000 (14:29 -0400)] 
Fix: return value signedness

Also remove repeated include headers.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: man page environment variable name error
David Goulet [Tue, 3 Apr 2012 16:09:16 +0000 (12:09 -0400)] 
Fix: man page environment variable name error

Reported-by: Ryan Kyser <Ryan.Kyser@jci.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: check return value on getenv USER
David Goulet [Tue, 3 Apr 2012 14:48:04 +0000 (10:48 -0400)] 
Fix: check return value on getenv USER

System with no environment variable USER, one of the easter egg caused a
segfault on certain embedded linux platforms.

Other getenv() of the project were audited to ensure that the return
value is checked.

Reported-by: Ryan Kyser <Ryan.Kyser@jci.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoUpdate version to 2.0.0 stable v2.0.0
David Goulet [Tue, 20 Mar 2012 22:32:45 +0000 (18:32 -0400)] 
Update version to 2.0.0 stable

ROCK ON!!!

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoUpdate version to v2.0.0-rc4 v2.0.0-rc4
David Goulet [Tue, 20 Mar 2012 20:42:48 +0000 (16:42 -0400)] 
Update version to v2.0.0-rc4

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: add small detail to enable-channel man page
David Goulet [Tue, 20 Mar 2012 20:19:16 +0000 (16:19 -0400)] 
Fix: add small detail to enable-channel man page

(close #192)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: warned of arbitrary time for ust-nprocesses test
David Goulet [Tue, 20 Mar 2012 20:15:56 +0000 (16:15 -0400)] 
Fix: warned of arbitrary time for ust-nprocesses test

(close #157)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix. add limitation to man page
David Goulet [Tue, 20 Mar 2012 20:09:51 +0000 (16:09 -0400)] 
Fix. add limitation to man page

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: minor changes to lttng.1
David Goulet [Tue, 20 Mar 2012 19:53:22 +0000 (15:53 -0400)] 
Fix: minor changes to lttng.1

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: add exit values to lttng.1 man page
David Goulet [Tue, 20 Mar 2012 19:51:14 +0000 (15:51 -0400)] 
Fix: add exit values to lttng.1 man page

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: add delay before validating apps in test nproc
David Goulet [Tue, 20 Mar 2012 19:33:10 +0000 (15:33 -0400)] 
Fix: add delay before validating apps in test nproc

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: error handling in lttng enable-event
David Goulet [Tue, 20 Mar 2012 19:32:43 +0000 (15:32 -0400)] 
Fix: error handling in lttng enable-event

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: document structure init. to 0 in lttng.h
Raphaël Beamonte [Sun, 18 Mar 2012 02:02:53 +0000 (22:02 -0400)] 
Fix: document structure init. to 0 in lttng.h

Document the fact that the structures should be initialized to zero in
lttng.h since there is no init function.

(close #135)

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: uninitialized variable
David Goulet [Tue, 20 Mar 2012 18:55:52 +0000 (14:55 -0400)] 
Fix: uninitialized variable

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
12 years agoKeep track of FD used for UST applications (v2)
Mathieu Desnoyers [Tue, 20 Mar 2012 18:53:07 +0000 (14:53 -0400)] 
Keep track of FD used for UST applications (v2)

Allow to keep 25% of file descriptors reserved for commands/kernel
tracing/internal communication within the sessiond by limiting
applications to 75% of the available file descriptors. This ensures
traced applications cannot cause a sessiond denial of service.

Changelog since v1:
- Add missing fd-limit.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: lttng view, error message and exit code
Julien Desfossez [Tue, 20 Mar 2012 15:19:14 +0000 (11:19 -0400)] 
Fix: lttng view, error message and exit code

lttng view is a frontend command, when the viewer is not found in the
path, the error message should be human readable (no need for the
developper-oriented debug message).

Also the return code must indicate that something went wrong if the
viewer is not on the system.

(fix #144)

Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
12 years agoSmall fixes to lttng man pages (v2)
Yannick Brosseau [Tue, 20 Mar 2012 15:37:09 +0000 (11:37 -0400)] 
Small fixes to lttng man pages (v2)

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
12 years agoMerge branch 'master' of git://git.lttng.org/lttng-tools
David Goulet [Tue, 20 Mar 2012 18:35:38 +0000 (14:35 -0400)] 
Merge branch 'master' of git://git.lttng.org/lttng-tools

12 years agoFix: handle EINTR for sendmsg syscall
David Goulet [Tue, 20 Mar 2012 18:33:23 +0000 (14:33 -0400)] 
Fix: handle EINTR for sendmsg syscall

(close #170)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: lttng UI exit value and error message
David Goulet [Tue, 20 Mar 2012 18:27:12 +0000 (14:27 -0400)] 
Fix: lttng UI exit value and error message

Change lttcomm error code starting value from 1000 to 10. This way, bash
can return the exact error code since 255 is the maximum.

Fix multiple warning, error and message output.

Some return code could still be not "standardize" but for stable it's
ok. Fixes can come later on.

(close #105)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: session lock use after free
Mathieu Desnoyers [Tue, 20 Mar 2012 17:39:20 +0000 (13:39 -0400)] 
Fix: session lock use after free

The session lock is broken in that it does not handle teardown correctly
(use after free). Surround each usage by the session list lock for now
to fix this issue, and don't unlock the session lock after free. Since
each session lock usage is surrounded by session list lock, no other
thread will be left waiting on this lock when the session destroy is
performed.

This effectively renders useless the per-session lock. Leave it there
for now to minimize code change before 2.0 final.

This locking scheme will be revisited for lttng 2.1.

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix kernel_list_events memleaks
Mathieu Desnoyers [Tue, 20 Mar 2012 17:15:01 +0000 (13:15 -0400)] 
Fix kernel_list_events memleaks

- The fscanf %m allocation was leaking the "event" (needs to be freed
  explicitly).
- The error handling of realloc should free the previous pointer.

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix debug message use uninitialized variable
Mathieu Desnoyers [Tue, 20 Mar 2012 16:58:19 +0000 (12:58 -0400)] 
Fix debug message use uninitialized variable

Reported-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: trace_ust_destroy_metadata should check for NULL pointer
Mathieu Desnoyers [Mon, 19 Mar 2012 22:15:50 +0000 (18:15 -0400)] 
Fix: trace_ust_destroy_metadata should check for NULL pointer

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: various memleaks
Mathieu Desnoyers [Mon, 19 Mar 2012 22:02:45 +0000 (18:02 -0400)] 
Fix: various memleaks

Thanks to valgrind.

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: hash table allocation out of order on error
David Goulet [Mon, 19 Mar 2012 21:16:28 +0000 (17:16 -0400)] 
Fix: hash table allocation out of order on error

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agofix: lttng_ht_destroy memleak
Mathieu Desnoyers [Mon, 19 Mar 2012 21:10:20 +0000 (17:10 -0400)] 
fix: lttng_ht_destroy memleak

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoUpdate version to v2.0.0-rc3 v2.0.0-rc3
David Goulet [Fri, 16 Mar 2012 19:38:56 +0000 (15:38 -0400)] 
Update version to v2.0.0-rc3

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix missing headers for make dist
David Goulet [Fri, 16 Mar 2012 19:33:52 +0000 (15:33 -0400)] 
Fix missing headers for make dist

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix: install lttng-consumerd in lib/lttng/libexec/
Mathieu Desnoyers [Thu, 15 Mar 2012 18:30:43 +0000 (14:30 -0400)] 
Fix: install lttng-consumerd in lib/lttng/libexec/

This program is not meant to be executed by end-users: it is spawned
only by the session daemon.

Closes #46

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix: Redefine MAP_STACK to 0 if not defined by the architecture
Avik Sil [Thu, 15 Mar 2012 12:22:02 +0000 (08:22 -0400)] 
Fix: Redefine MAP_STACK to 0 if not defined by the architecture

This patch fixes build error on architectures (e.g., armel, armhf) that
do not define MAP_STACK.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 years agoFix consumer CPU hotplug support
David Goulet [Tue, 13 Mar 2012 21:14:17 +0000 (17:14 -0400)] 
Fix consumer CPU hotplug support

This is a quick fix to handle stream update on CPU hotplug. Please look
at #ref 168 for more information and explanation on the real fix.

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix double PID registration race
David Goulet [Tue, 13 Mar 2012 15:13:25 +0000 (11:13 -0400)] 
Fix double PID registration race

Introduce a second hash table indexed by application socket which have
the exact same content as the hash table indexed by PID.

On unregister, we now use a direct lookup per socket instead of using
the key map between sock and PID. This prevents the PID-sock lookup race
when the unregister happens just after the replace and before the
close(fd).

We also use an add_replace call on application registration for the PID
hash table and kept the add_unique for the socket hash table.

(closes #7)

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoMake libcompat independent not to confuse automake
David Goulet [Tue, 13 Mar 2012 15:34:28 +0000 (11:34 -0400)] 
Make libcompat independent not to confuse automake

Moving libcompat.la to the compat/ subdirectory and building it before
every other libs.

(closes #101 #153)

Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoClarify the license of lttng-ust-abi.h
Alexandre Montplaisir [Sat, 10 Mar 2012 21:59:00 +0000 (16:59 -0500)] 
Clarify the license of lttng-ust-abi.h

That file's license was not recognized by licensecheck. I suggest using
the MIT/X11 text which is quite similar, and is already used elsewhere
in the project (in Babeltrace).

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoLicense header fixes
Alexandre Montplaisir [Sat, 10 Mar 2012 21:58:59 +0000 (16:58 -0500)] 
License header fixes

Most of the source files had the wrong FSF address. Also reworded the
first paragraph so that licensecheck's regexes actually pick up the
version number.

I made sure lttng.h and lttng-ctl.c advertise LGPL-2.1. Every other file
touched in this patch was and remains under GPL2, please make sure this
is correct. (Some files related to the RCU hashtable are under
LGPL-2.1+, but their headers were already clean).

(closes #155)

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
12 years agoFix wrong return value on consumer socket creation
David Goulet [Thu, 8 Mar 2012 23:10:38 +0000 (18:10 -0500)] 
Fix wrong return value on consumer socket creation

A failing call to mkdir() returned 0 instead of an error and was
creating a segfault later on since some memory was not initialized.

Signed-off-by: David Goulet <dgoulet@efficios.com>
This page took 0.044767 seconds and 4 git commands to generate.