#include <lttng/trigger/trigger-internal.h>
#include <lttng/condition/condition.h>
#include <lttng/action/action.h>
+#include <lttng/channel.h>
#include <lttng/channel-internal.h>
#include <common/string-utils/string-utils.h>
attr->attr.switch_timer_interval = 0;
}
+ /* Check for feature support */
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ {
+ if (kernel_supports_ring_buffer_snapshot_sample_positions(kernel_tracer_fd) != 1) {
+ /* Sampling position of buffer is not supported */
+ WARN("Kernel tracer does not support buffer monitoring. "
+ "Setting the monitor interval timer to 0 "
+ "(disabled) for channel '%s' of session '%s'",
+ attr-> name, session->name);
+ lttng_channel_set_monitor_timer_interval(attr, 0);
+ }
+ break;
+ }
+ case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
+ case LTTNG_DOMAIN_PYTHON:
+ break;
+ default:
+ ret = LTTNG_ERR_UNKNOWN_DOMAIN;
+ goto error;
+ }
+
switch (domain->type) {
case LTTNG_DOMAIN_KERNEL:
{
return kernctl_syscall_mask(chan_fd, syscall_mask, nr_bits);
}
+
+/*
+ * Check for the support of the RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS via abi
+ * version number.
+ *
+ * Return 1 on success, 0 when feature is not supported, negative value in case
+ * of errors.
+ */
+int kernel_supports_ring_buffer_snapshot_sample_positions(int tracer_fd)
+{
+ int ret = 0; // Not supported by default
+ struct lttng_kernel_tracer_abi_version abi;
+
+ ret = kernctl_tracer_abi_version(tracer_fd, &abi);
+ if (ret < 0) {
+ ERR("Failed to retrieve lttng-modules ABI version");
+ goto error;
+ }
+
+ /*
+ * RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS was introduced in 2.3
+ */
+ if (abi.major >= 2 && abi.minor >= 3) {
+ /* Supported */
+ ret = 1;
+ } else {
+ /* Not supported */
+ ret = 0;
+ }
+error:
+ return ret;
+}
int init_kernel_workarounds(void);
ssize_t kernel_list_tracker_pids(struct ltt_kernel_session *session,
int **_pids);
+int kernel_supports_ring_buffer_snapshot_sample_positions(int tracer_fd);
#endif /* _LTT_KERNEL_CTL_H */
goto error_modules;
}
+ ret = kernel_supports_ring_buffer_snapshot_sample_positions(
+ kernel_tracer_fd);
+ if (ret < 0) {
+ goto error_modules;
+ }
+
+ if (ret < 1) {
+ WARN("Kernel tracer does not support buffer monitoring. "
+ "The monitoring timer of channels in the kernel domain "
+ "will be set to 0 (disabled).");
+ }
+
DBG("Kernel tracer fd %d", kernel_tracer_fd);
return 0;