Fix: libcompat is now part of libcommon 18710679a8ac57fda5dbd26cf16bb180dce9e286 includes libcompat into libcommon. This also make the compat_(e)poll_* symbols visible through liblttng-ctl. Same for fcntl compat. Mark them as hidden. These symbols are not visible on the 2.10/2.11 branches. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Metadata: add vpid_datetime field to metadta env This information can be used by viewer and previously contain in the path hierarchy of a trace. Add the registration_time field to ust_app to access it when printing metadata. Reuse this field to generate the trace path. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Support LTTNG_KERNEL_SESSION_SET_CREATION_NAME of lttng-modules Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Metadata: add env fields to ease life of viewer Add the following field in the env section of the metadata: - trace_name The session name without datetime information. Hence when the session is an auto-generated one, only print LTTNG_DEFAULT_NAME. - trace_creation_time: The time at which the session was created. We use session->creation time for it. - tracer_buffering_scheme The buffering scheme used. The value can be uid or pid. - tracer_buffering_id The key used by the buffering scheme (uid/pid). - isa_length The length of the ISA used. (e.g 32 or 64) Addend these fields ensure that the trace itself carry information that is normally carried via folder hierarchy. e.g test-20190417-174951/ <- trace_name └── ust <- domain └── uid <- tracer_buffering_scheme └── 1000 <- tracer_buffering_id └── 64-bit <- isa_length ├── channel0_0 ├── channel0_1 ├── channel0_2 ├── channel0_3 ├── index │ ├── channel0_0.idx │ ├── channel0_1.idx │ ├── channel0_2.idx │ └── channel0_3.idx └── metadata Per-pid buffering is quite similar. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fix: getenv can return null On system with LANG not defined getenv will return null. An example of such system is the lava runner used by ci.lttng.org. https://ci.lttng.org/view/System%20Tests/ Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: directory handle credentials parameter is not const There is no reason for the "as user" operations on a directory handle not to take the credentials as a const parameter. Not passing credentials as const makes their ownership ambiguous and makes it harder to write const-correct code. Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
doc: Add reference to USDT probes SDT probes are known by most as USDT probes. People may be looking for them by that name. Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com> Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: getgrnam is not MT-Safe, use getgrnam_r Running the test suite under a Yocto musl build resulted in musl coredump due to double freeing. We get the following backtraces: 0 a_crash () at ./arch/x86_64/atomic_arch.h:108 1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515 2 free (p=<optimized out>) at src/malloc/malloc.c:526 3 0x00007f46d9dc3849 in __getgrent_a (f=f@entry=0x7f46d9d1f7e0, gr=gr@entry=0x7f46d9e24460 <gr>, line=line@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=nmem@entry=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgrent_a.c:45 4 0x00007f46d9dc2e6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f46d9e24460 <gr>, buf=buf@entry=0x7f46d9e26058 <line>, size=size@entry=0x7f46d92db550, mem=mem@entry=0x7f46d9e26050 <mem>, nmem=0x7f46d92db558, res=0x7f46d92db548) at src/passwd/getgr_a.c:30 5 0x00007f46d9dc3733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37 6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241 7 0x000000000044ee69 in thread_manage_health (data=<optimized out>) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/main.c:4115 8 0x00007f46d9de1541 in start (p=<optimized out>) at src/thread/pthread_create.c:195 9 0x00007f46d9dee661 in __clone () at src/thread/x86_64/clone.s:22 From another run: 0 a_crash () at ./arch/x86_64/atomic_arch.h:108 1 unmap_chunk (self=<optimized out>) at src/malloc/malloc.c:515 2 free (p=<optimized out>) at src/malloc/malloc.c:526 3 0x00007f5abc210849 in __getgrent_a (f=f@entry=0x7f5abc2733e0, gr=gr@entry=0x7f5abc271460 <gr>, line=line@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=nmem@entry=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgrent_a.c:45 4 0x00007f5abc20fe6b in __getgr_a (name=0x487242 "tracing", gid=gid@entry=0, gr=gr@entry=0x7f5abc271460 <gr>, buf=buf@entry=0x7f5abc273058 <line>, size=size@entry=0x7f5abaef5510, mem=mem@entry=0x7f5abc273050 <mem>, nmem=0x7f5abaef5518, res=0x7f5abaef5508) at src/passwd/getgr_a.c:30 5 0x00007f5abc210733 in getgrnam (name=<optimized out>) at src/passwd/getgrent.c:37 6 0x0000000000460b29 in utils_get_group_id (name=<optimized out>) at ../../../lttng-tools-2.10.6/src/common/utils.c:1241 7 0x000000000042dee4 in notification_channel_socket_create () at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:238 8 init_thread_state (state=0x7f5abaef5560, handle=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:375 9 thread_notification (data=0x7f5abbf9be40) at ../../../../lttng-tools-2.10.6/src/bin/lttng-sessiond/notification-thread.c:495 10 0x00007f5abc22e541 in start (p=<optimized out>) at src/thread/pthread_create.c:195 11 0x00007f5abc23b661 in __clone () at src/thread/x86_64/clone.s:22 The problem was easily reproducible (~6 crash on ~300 runs). A prototype fix using mutex around the getgrnam yielded no crash in over 1000 runs. This patch yielded the same results as the prototype fix. Unfortunately we cannot rely on a mutex in liblttng-ctl since we cannot enforce the locking for the application using the lib. Use getgrnam_r instead. The previous implementation of utils_get_group_id returned the gid of the root group (0) on error/not found. lttng_check_tracing_group needs to know if an error/not found occured, returning the root group is not enough. We now return the gid via the passed parameter. The caller is responsible for either defaulting to the root group or propagating the error. We also do not want to warn when used in liblttng-ctl context. We might want to move the warning elsewhere in the future. For now, pass a bool if we need to warn or not. Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: logging: log_add_time() save/restore errno The debugging logging macros (e.g. DBG()) are used as printf in the lttng-tools source files. The printf() implementation does not alter the errno value, so the fact that log_add_time() (through clock_gettime()) can alter errno is unexpected. For instance, adding a logging statement for debugging purposes within a function for which errno is expected to stay unchanged on return will change the behavior between execution with -vvv and non-verbose. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix relayd: initialize beacon to -1ULL The relayd stream beacon_ts_end field is expected to have the value -1ULL when unset (no beacon has been received since last index). However, the initial state is wrong. It is left at the value 0, which indicates that a live beacon has indeed been received (which is untrue), which in turn causes a live beacon with ctf_stream_id of -1ULL to be sent to babeltrace, which does not expect it, and fails. This issue can be triggered with the following scenario: 1) create live session 2) setup UST per-uid buffers tracing 3) start tracing, without any active traced application 4) hook with babeltrace live client to view the trace 5) run a traced application Step 5) will cause the babeltrace live client to receive a stream_id of -1ULL, and error out. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: relayd: handling of lttng_read errors >= 0 errno is only set when lttng_read returns a negative value. Else, we need to print a ERR() statement rather than use PERROR(). Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Update the ac_define_dir macro from the autoconf archive This macro was removed many years ago from the archive because it crosses the boundary between configure and make time variables. For the moment update it to the latest released version. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>