dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
923a60
From fa37e91818c1de70977462d170df08f441170db5 Mon Sep 17 00:00:00 2001
923a60
From: Michal Sekletar <msekletar@users.noreply.github.com>
923a60
Date: Thu, 25 Aug 2016 08:18:42 +0200
923a60
Subject: [PATCH] udev: inform systemd how many workers we can potentially
923a60
 spawn (#4036)
923a60
923a60
(cherry picked from commit 1ef72b55ba6d38f879d7ac9f0237cf8a2b53f0e6)
923a60
Resolves: #1361601
923a60
---
923a60
 src/udev/udevd.c | 10 ++++++++--
923a60
 1 file changed, 8 insertions(+), 2 deletions(-)
923a60
923a60
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
923a60
index 82c7a5425a..1d21182fbf 100644
923a60
--- a/src/udev/udevd.c
923a60
+++ b/src/udev/udevd.c
923a60
@@ -697,6 +697,10 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) {
923a60
         if (i >= 0) {
923a60
                 log_debug("udevd message (SET_MAX_CHILDREN) received, children_max=%i", i);
923a60
                 arg_children_max = i;
923a60
+
923a60
+                (void) sd_notifyf(false,
923a60
+                                  "READY=1\n"
923a60
+                                  "STATUS=Processing with %u children at max", arg_children_max);
923a60
         }
923a60
 
923a60
         if (udev_ctrl_get_ping(ctrl_msg) > 0)
923a60
@@ -1271,8 +1275,6 @@ int main(int argc, char *argv[]) {
923a60
                 setsid();
923a60
 
923a60
                 write_string_file("/proc/self/oom_score_adj", "-1000");
923a60
-        } else {
923a60
-                sd_notify(1, "READY=1");
923a60
         }
923a60
 
923a60
         if (arg_children_max <= 0) {
923a60
@@ -1321,6 +1323,10 @@ int main(int argc, char *argv[]) {
923a60
         ep_netlink.data.fd = fd_netlink;
923a60
         ep_worker.data.fd = fd_worker;
923a60
 
923a60
+        (void) sd_notifyf(false,
923a60
+                          "READY=1\n"
923a60
+                          "STATUS=Processing with %u children at max", arg_children_max);
923a60
+
923a60
         fd_ep = epoll_create1(EPOLL_CLOEXEC);
923a60
         if (fd_ep < 0) {
923a60
                 log_error_errno(errno, "error creating epoll fd: %m");