Rename C++ header files to .hpp Rename all C++ header files (include/**/*-internal.h, src/**/*.h except argpar and msgpack, some headers in tests) to have the .hpp extension. Doing so highlights that we include some C++ header files in some test files still compiled as C. This is ok for now, as the files they include don't actually contain C++ code incompatible with C yet, but they could eventually. This is something we can fix later. Change-Id: I8bf326b6b2946a3e26704f3ef3ac5831bbe9bc26 Signed-off-by: Simon Marchi <simon.marchi@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Move to kernel style SPDX license identifiers The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. See https://spdx.org/ids-how for details. Signed-off-by: Michael Jeanson <mjeanson@efficios.com> Change-Id: I62e7038e191a061286abcef5550b58f5ee67149d Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: sessiond: use system LTTng-UST headers when available The LTTng-Tools tree includes a local copy of three LTTng-UST headers: * ust-error.h * ust-ctl.h * ust-abi.h The system headers should be used when UST support is configured to ensure the appropriate ABI definitions are used. The local copies of the headers should only be used when LTTng-Tools is built with the --without-lttng-ust configuration option. Those headers are needed since some UST support code is compiled-in even though the support is deactivated. A misconfiguration in the CI setup allowed us to notice that sessiond-config.c is using the internal header unconditionally. To ensure this doesn't happen in the future, the local copies are renamed: * ust-error.h -> ust-error-internal.h * ust-ctl.h -> ust-ctl-internal.h * ust-abi.h -> ust-abi-internal.h All code should use the `lttng-` prefixed versions of the headers which include either the local or "system" copy of the headers depending on the build configuration. Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Updating lttng-ust-ctl header file This file is a near-complete duplicate of the include/lttng/ust-ctl.h file in lttng-ust repo. Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Introduce "--blocking-timeout" channel parameter Introduce the blocking timeout channel parameter to control blocking behavior for lttng-ust buffers. It only affects applications launched with the LTTNG_UST_ALLOW_BLOCKING environment variable. The blocking timeout parameter expects: - 0 (default) which does not block, - a timeout value in usec, - -1 (block forever). Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: convey enum value signedness into metadata Currently, passing an enum range of: ctf_enum_range("blah", 0, UINT_MAX) in LTTng-UST will print a range of 0 ... -1 in the generated CTF metadata, which does not reflect signedness of the values. Also, struct ustctl_enum_entry is missing a LTTNG_PACKED attribute, which is against our protocol rules. This change needs to be pushed in locked-step into lttng-tools and lttng-ust, since it breaks the protocol between the two when UST uses the new enumeration type (introduced in 2.8.0-rc1). Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add CTF enum type support for UST registry Derived from initial implementation by: Geneviève Bastien <gbastien+lttng@versatic.net> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
sessiond: use `loglevel_value` and `loglevel_type` names By using the `loglevel_value` and `loglevel_type` names instead of `loglevel` for one or the other, some unsettling inconsistencies are exposed. This patch only changes the names to show the weird stuff, e.g.: key.loglevel_type = loglevel_value; A future patch will fix this. The only `loglevel` names left untouched are those in public headers as well as those in the tools<->UST ABI. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Support per UID buffers This is a rather large commit. It adds the support for per UID buffers for the user space tracer. The --buffers-uid option is added to the lttng enable-channel command which will set the session to use per UID buffers. So, all other channel in that session MUST be set with the same buffer type or else an error will be returned. For instance, here is an invalid use case: $ lttng create $ lttng enable-channel -u --buffers-uid chan1 $ lttng enable-channel -u chan2 The default is per PID (--buffers-pid). With no buffer type option, the per PID is used for the UST tracer and global buffers for the kernel being the only supported type for it (--buffers-global). The tracing directory path are also changed to support this. For per UID buffers, the path is now: ~/lttng-traces/ust/uid/1000/64-bit/* For per PID buffers: ~/lttng-traces/<session_name>-<date>-<time>/ust/pid/ \ <app-name>-<pid>-<date>-<time>/ So basically, for UID, traces are stored per UID/ABI and for PID is simply stored with the app name and pid. The kernel traces are untouched and are still in kernel/. Tests are also added for per UID buffers. Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: David Goulet <dgoulet@efficios.com>
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>
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>