]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/udev-util.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
6 #include "alloc-util.h"
9 #include "parse-util.h"
10 #include "string-util.h"
11 #include "udev-util.h"
14 int udev_parse_config_full(
15 unsigned *ret_children_max
,
16 usec_t
*ret_exec_delay_usec
,
17 usec_t
*ret_event_timeout_usec
) {
19 _cleanup_free_
char *log_val
= NULL
, *children_max
= NULL
, *exec_delay
= NULL
, *event_timeout
= NULL
;
22 r
= parse_env_file(NULL
, "/etc/udev/udev.conf", NEWLINE
,
24 "children_max", &children_max
,
25 "exec_delay", &exec_delay
,
26 "event_timeout", &event_timeout
,
40 ((log_val
[0] == '"' && log_val
[n
-1] == '"') ||
41 (log_val
[0] == '\'' && log_val
[n
-1] == '\''))) {
42 log_val
[n
- 1] = '\0';
47 /* we set the udev log level here explicitly, this is supposed
48 * to regulate the code in libudev/ and udev/. */
49 r
= log_set_max_level_from_string_realm(LOG_REALM_UDEV
, log
);
51 log_debug_errno(r
, "/etc/udev/udev.conf: failed to set udev log level '%s', ignoring: %m", log
);
54 if (ret_children_max
&& children_max
) {
55 r
= safe_atou(children_max
, ret_children_max
);
57 log_notice_errno(r
, "/etc/udev/udev.conf: failed to set parse children_max=%s, ignoring: %m", children_max
);
60 if (ret_exec_delay_usec
&& exec_delay
) {
61 r
= parse_sec(exec_delay
, ret_exec_delay_usec
);
63 log_notice_errno(r
, "/etc/udev/udev.conf: failed to set parse exec_delay=%s, ignoring: %m", exec_delay
);
66 if (ret_event_timeout_usec
&& event_timeout
) {
67 r
= parse_sec(event_timeout
, ret_event_timeout_usec
);
69 log_notice_errno(r
, "/etc/udev/udev.conf: failed to set parse event_timeout=%s, ignoring: %m", event_timeout
);