daandemeyer / rpms / systemd

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