]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: allow to set the maximum number of worker process to 0
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 1 Aug 2023 16:14:04 +0000 (01:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 5 Aug 2023 06:40:02 +0000 (15:40 +0900)
In that case, the maximum is calculated based on the system resources.

src/udev/udev-manager.c

index 676e97a7f32dc63cfe5d643909f833952f753bc4..6653de6b4529786a393cc48934ab80ad70f1a9c2 100644 (file)
@@ -947,7 +947,7 @@ static int on_ctrl_msg(UdevCtrl *uctrl, UdevCtrlMessageType type, const UdevCtrl
                 break;
         }
         case UDEV_CTRL_SET_CHILDREN_MAX:
-                if (value->intval <= 0) {
+                if (value->intval < 0) {
                         log_debug("Received invalid udev control message (SET_MAX_CHILDREN, %i), ignoring.", value->intval);
                         return 0;
                 }
@@ -955,6 +955,9 @@ static int on_ctrl_msg(UdevCtrl *uctrl, UdevCtrlMessageType type, const UdevCtrl
                 log_debug("Received udev control message (SET_MAX_CHILDREN), setting children_max=%i", value->intval);
                 manager->children_max = value->intval;
 
+                /* When 0 is specified, determine the maximum based on the system resources. */
+                manager_set_default_children_max(manager);
+
                 notify_ready(manager);
                 break;
         case UDEV_CTRL_PING: