]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-daemon: increase sd_notify() socket buffer size 1737/head
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Oct 2015 10:27:29 +0000 (11:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 31 Oct 2015 18:09:20 +0000 (19:09 +0100)
Let's make sure we don't start blocking on sd_notify() earlier than
necessary, let's bump the socket buffer sizes to 8M.

We already do something similar for our logging socket buffers, hence
apply a similar bump here.

src/core/manager.c
src/libsystemd/sd-daemon/sd-daemon.c

index 2039dafea12c90a8e65fadd09fa6813f6eecec31..b13663e702fb364877a3eb5be38aefa0d80dd2a0 100644 (file)
@@ -86,6 +86,8 @@
 #include "virt.h"
 #include "watchdog.h"
 
+#define NOTIFY_RCVBUF_SIZE (8*1024*1024)
+
 /* Initial delay and the interval for printing status messages about running jobs */
 #define JOBS_IN_PROGRESS_WAIT_USEC (5*USEC_PER_SEC)
 #define JOBS_IN_PROGRESS_PERIOD_USEC (USEC_PER_SEC / 3)
@@ -689,6 +691,8 @@ static int manager_setup_notify(Manager *m) {
                 if (fd < 0)
                         return log_error_errno(errno, "Failed to allocate notification socket: %m");
 
+                fd_inc_rcvbuf(fd, NOTIFY_RCVBUF_SIZE);
+
                 if (m->running_as == MANAGER_SYSTEM)
                         m->notify_socket = strdup("/run/systemd/notify");
                 else {
index 77b5dd52f6ee8c03871f1a9b56e317e3d4b9ab63..c7887804df43a720de8e3d24bdfe99d17ecf0b37 100644 (file)
@@ -44,6 +44,8 @@
 #include "strv.h"
 #include "util.h"
 
+#define SNDBUF_SIZE (8*1024*1024)
+
 static void unsetenv_all(bool unset_environment) {
 
         if (!unset_environment)
@@ -440,6 +442,8 @@ _public_ int sd_pid_notify_with_fds(pid_t pid, int unset_environment, const char
                 goto finish;
         }
 
+        fd_inc_sndbuf(fd, SNDBUF_SIZE);
+
         iovec.iov_len = strlen(state);
 
         strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));