'valgrind/memcheck.h',
'valgrind/valgrind.h',
'linux/time_types.h',
+ 'sys/sdt.h',
]
conf.set10('HAVE_' + header.underscorify().to_upper(),
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
+#if HAVE_SYS_SDT_H
+#define SDT_USE_VARIADIC
+#include <sys/sdt.h>
+#endif
+
#include "sd-device.h"
#include "time-util.h"
int udev_queue_is_empty(void);
int udev_queue_init(void);
+
+#if HAVE_SYS_SDT_H
+
+/* Each trace point can have different number of additional arguments. Note that when the macro is used only
+ * additional arguments are listed in the macro invocation!
+ *
+ * Default arguments for each trace point are as follows:
+ * - arg0 - action
+ * - arg1 - sysname
+ * - arg2 - syspath
+ * - arg3 - subsystem
+ */
+#define DEVICE_TRACE_POINT(name, dev, ...) \
+ do { \
+ PROTECT_ERRNO; \
+ const char *_n = NULL, *_p = NULL, *_s = NULL; \
+ sd_device *_d = (dev); \
+ sd_device_action_t _a = _SD_DEVICE_ACTION_INVALID; \
+ (void) sd_device_get_action(_d, &_a); \
+ (void) sd_device_get_sysname(_d, &_n); \
+ (void) sd_device_get_syspath(_d, &_p); \
+ (void) sd_device_get_subsystem(_d, &_s); \
+ STAP_PROBEV(udev, name, device_action_to_string(_a), _n, _p, _s __VA_OPT__(,) __VA_ARGS__);\
+ } while(false);
+#else
+#define DEVICE_TRACE_POINT(name, dev, ...) ((void) 0)
+#endif
assert(spawn);
+ DEVICE_TRACE_POINT(spawn_timeout, spawn->device, spawn->cmd);
+
kill_and_sigcont(spawn->pid, spawn->timeout_signal);
log_device_error(spawn->device, "Spawned process '%s' ["PID_FMT"] timed out after %s, killing",
log_device_error(spawn->device, "Process '%s' failed due to unknown reason.", spawn->cmd);
}
+ DEVICE_TRACE_POINT(spawn_exit, spawn->device, spawn->cmd);
+
sd_event_exit(sd_event_source_get_event(s), ret);
return 1;
}
(void) close_all_fds(NULL, 0);
(void) rlimit_nofile_safe();
+ DEVICE_TRACE_POINT(spawn_exec, event->dev, cmd);
+
execve(argv[0], argv, envp);
_exit(EXIT_FAILURE);
}
return r;
}
+ DEVICE_TRACE_POINT(rules_start, dev);
+
r = udev_rules_apply_to_event(rules, event, timeout_usec, timeout_signal, properties_list);
if (r < 0)
return log_device_debug_errno(dev, r, "Failed to apply udev rules: %m");
+ DEVICE_TRACE_POINT(rules_finished, dev);
+
r = rename_netif(event);
if (r < 0)
return r;
#include "udev-builtin.h"
#include "udev-event.h"
#include "udev-rules.h"
+#include "udev-util.h"
#include "user-util.h"
#include "virt.h"
return 0;
event->esc = ESCAPE_UNSET;
+
+ DEVICE_TRACE_POINT(rules_apply_line, event->dev, line->rule_file->filename, line->line_number);
+
LIST_FOREACH_SAFE(tokens, token, next_token, line->tokens) {
line->current_token = token;
return log_error_errno(r, "Failed to fork() worker: %m");
}
if (r == 0) {
+ DEVICE_TRACE_POINT(worker_spawned, event->dev, getpid());
+
/* Worker process */
r = worker_main(manager, worker_monitor, sd_device_ref(event->dev));
log_close();
assert(manager);
+ DEVICE_TRACE_POINT(kernel_uevent_received, dev);
+
device_ensure_usec_initialized(dev, NULL);
r = event_queue_insert(manager, dev);
if (r < 0)
return log_device_debug_errno(target, r, "Failed to trigger 'change' uevent: %m");
+ DEVICE_TRACE_POINT(synthetic_change_event, dev);
+
return 0;
}