[SETTLE]='-t --timeout -E --exit-if-exists'
[CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping
--load-credentials'
- [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout'
+ [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout --trace'
[MONITOR_STANDALONE]='-k --kernel -u --udev -p --property'
[MONITOR_ARG]='-s --subsystem-match -t --tag-match'
[TEST_STANDALONE]='-v --verbose'
-l|--log-priority)
comps='alert crit debug emerg err info notice warning'
;;
+ --trace)
+ comps='yes no'
+ ;;
*)
comps=''
;;
#include "creds-util.h"
#include "errno-util.h"
+#include "parse-argument.h"
#include "parse-util.h"
#include "process-util.h"
#include "static-destruct.h"
static int arg_max_children = -1;
static int arg_log_level = -1;
static int arg_start_exec_queue = -1;
+static int arg_trace = -1;
static bool arg_load_credentials = false;
STATIC_DESTRUCTOR_REGISTER(arg_env, strv_freep);
arg_reload ||
!strv_isempty(arg_env) ||
arg_max_children >= 0 ||
- arg_ping;
+ arg_ping ||
+ arg_trace >= 0;
}
static int help(void) {
" -p --property=KEY=VALUE Set a global property for all events\n"
" -m --children-max=N Maximum number of children\n"
" --ping Wait for udev to respond to a ping message\n"
+ " --trace=BOOL Enable/disable trace logging\n"
" -t --timeout=SECONDS Maximum time to block for a reply\n"
" --load-credentials Load udev rules from credentials\n",
program_invocation_short_name);
static int parse_argv(int argc, char *argv[]) {
enum {
ARG_PING = 0x100,
+ ARG_TRACE,
ARG_LOAD_CREDENTIALS,
};
{ "env", required_argument, NULL, 'p' }, /* alias for -p */
{ "children-max", required_argument, NULL, 'm' },
{ "ping", no_argument, NULL, ARG_PING },
+ { "trace", required_argument, NULL, ARG_TRACE },
{ "timeout", required_argument, NULL, 't' },
{ "load-credentials", no_argument, NULL, ARG_LOAD_CREDENTIALS },
{ "version", no_argument, NULL, 'V' },
arg_ping = true;
break;
+ case ARG_TRACE:
+ r = parse_boolean_argument("--trace=", optarg, NULL);
+ if (r < 0)
+ return r;
+
+ arg_trace = r;
+ break;
+
case 't':
r = parse_sec(optarg, &arg_timeout);
if (r < 0)
return r;
}
+ if (arg_trace >= 0) {
+ r = varlink_callbo_and_log(link, "io.systemd.Udev.SetTrace", /* reply = */ NULL,
+ SD_JSON_BUILD_PAIR_BOOLEAN("enable", arg_trace));
+ if (r < 0)
+ return r;
+ }
+
return 0;
}