chiark / gitweb /
log: increase socket buffers for logging by default
[elogind.git] / src / journal / journal-send.c
index 00029fe0b361d10ebbf714f875ca1aa32ccfe96b..b5b4fbfa0da9f32f48a575289ded8650804f7dfc 100644 (file)
@@ -30,6 +30,8 @@
 #include "util.h"
 #include "socket-util.h"
 
+#define SNDBUF_SIZE (8*1024*1024)
+
 /* We open a single fd, and we'll share it with the current process,
  * all its threads, and all its subprocesses. This means we need to
  * initialize it atomically, and need to operate on it atomically
@@ -47,6 +49,8 @@ retry:
         if (fd < 0)
                 return -errno;
 
+        fd_inc_sndbuf(fd, SNDBUF_SIZE);
+
         if (!__sync_bool_compare_and_swap(&fd_plus_one, 0, fd+1)) {
                 close_nointr_nofail(fd);
                 goto retry;
@@ -219,7 +223,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
         if (k >= 0)
                 return 0;
 
-        if (errno != EMSGSIZE)
+        if (errno != EMSGSIZE && errno != ENOBUFS)
                 return -errno;
 
         /* Message doesn't fit... Let's dump the data in a temporary
@@ -294,6 +298,8 @@ _public_ int sd_journal_stream_fd(const char *identifier, int priority, int leve
                 return -errno;
         }
 
+        fd_inc_sndbuf(fd, SNDBUF_SIZE);
+
         if (!identifier)
                 identifier = "";