diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-01-27 18:14:06 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-01-27 18:14:06 +0100 |
commit | 632117b71fdd2d1b9da7418d00ec21c18d60dedd (patch) | |
tree | 18aaf78af6d6bc62937e704a618a955844945ed5 /src/journal/journald.c | |
parent | da375869ff31f83938123dc0d2a8d5c0f0845a0c (diff) |
log: never delay logging if the log server is stuck, always drop messages quickly
Diffstat (limited to 'src/journal/journald.c')
-rw-r--r-- | src/journal/journald.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/journal/journald.c b/src/journal/journald.c index f63a12fae8..73f8ed6ae8 100644 --- a/src/journal/journald.c +++ b/src/journal/journald.c @@ -66,8 +66,6 @@ #define RECHECK_VAR_AVAILABLE_USEC (30*USEC_PER_SEC) -#define SYSLOG_TIMEOUT_USEC (250*USEC_PER_MSEC) - #define N_IOVEC_META_FIELDS 17 #define ENTRY_SIZE_MAX (1024*1024*32) @@ -2220,7 +2218,6 @@ static int open_syslog_socket(Server *s) { union sockaddr_union sa; int one, r; struct epoll_event ev; - struct timeval tv; assert(s); @@ -2245,7 +2242,8 @@ static int open_syslog_socket(Server *s) { } chmod(sa.un.sun_path, 0666); - } + } else + fd_nonblock(s->syslog_fd, 1); one = 1; r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); @@ -2261,15 +2259,6 @@ static int open_syslog_socket(Server *s) { return -errno; } - /* Since we use the same socket for forwarding this to some - * other syslog implementation, make sure we don't hang - * forever */ - timeval_store(&tv, SYSLOG_TIMEOUT_USEC); - if (setsockopt(s->syslog_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0) { - log_error("SO_SNDTIMEO failed: %m"); - return -errno; - } - zero(ev); ev.events = EPOLLIN; ev.data.fd = s->syslog_fd; @@ -2309,7 +2298,8 @@ static int open_native_socket(Server*s) { } chmod(sa.un.sun_path, 0666); - } + } else + fd_nonblock(s->native_fd, 1); one = 1; r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)); @@ -2369,7 +2359,8 @@ static int open_stdout_socket(Server *s) { log_error("liste() failed: %m"); return -errno; } - } + } else + fd_nonblock(s->stdout_fd, 1); zero(ev); ev.events = EPOLLIN; |