udev-config: merge configured children max

Merge children_max from the per-source UdevConfig values before
defaulting it from system resources.

Reproducer:
  systemd-udevd --debug --children-max=1

Before:
  Set children_max to 32

Follow-up:
  04fa5c1580
This commit is contained in:
dongshengyuan
2026-07-13 10:46:55 +08:00
parent e8dd0bfbbe
commit 20e1e2de67
2 changed files with 14 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
#include "alloc-util.h"
#include "tests.h"
#include "udev-config.h"
#include "udev-manager.h"
TEST(devpath_conflict) {
@@ -35,4 +36,16 @@ TEST(worker_free_detaches_event) {
ASSERT_NULL(event->worker);
}
TEST(manager_load_merges_children_max) {
_cleanup_(manager_freep) Manager *manager = ASSERT_PTR(manager_new());
char *argv[] = {
(char*) "systemd-udevd",
(char*) "--children-max=1",
NULL,
};
ASSERT_OK_POSITIVE(manager_load(manager, ELEMENTSOF(argv) - 1, argv));
ASSERT_EQ(manager->config.children_max, 1U);
}
DEFINE_TEST_MAIN(LOG_DEBUG);

View File

@@ -281,6 +281,7 @@ static void manager_merge_config(Manager *manager) {
manager_merge_config_log_level(manager);
MERGE_NON_NEGATIVE(resolve_name_timing, RESOLVE_NAME_EARLY);
MERGE_NON_ZERO(children_max, 0);
MERGE_NON_ZERO(exec_delay_usec, 0);
MERGE_NON_ZERO(timeout_usec, DEFAULT_WORKER_TIMEOUT_USEC);
MERGE_NON_ZERO(timeout_signal, SIGKILL);