X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fjournal%2Fjournal-send.c;h=b5b4fbfa0da9f32f48a575289ded8650804f7dfc;hb=09b967eaa51a39dabb7f238927f67bd682466dbc;hp=00029fe0b361d10ebbf714f875ca1aa32ccfe96b;hpb=9058851be7821edac08c1fa7ecafe5cba9ab9022;p=elogind.git diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index 00029fe0b..b5b4fbfa0 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 = "";