summaryrefslogtreecommitdiff
path: root/src/journal/journal-send.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-27 18:57:37 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-27 18:57:37 +0100
commitbb99a35a873c35e80b0b47fe045081022660374d (patch)
tree63dc43ca84690ee6abff7548293c3619aef1587a /src/journal/journal-send.c
parent632117b71fdd2d1b9da7418d00ec21c18d60dedd (diff)
log: increase socket buffers for logging by default
Diffstat (limited to 'src/journal/journal-send.c')
-rw-r--r--src/journal/journal-send.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 00029fe0b3..b5b4fbfa0d 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -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 = "";