summaryrefslogtreecommitdiff
path: root/src/log.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-01-27 18:14:06 +0100
committerLennart Poettering <lennart@poettering.net>2012-01-27 18:14:06 +0100
commit632117b71fdd2d1b9da7418d00ec21c18d60dedd (patch)
tree18aaf78af6d6bc62937e704a618a955844945ed5 /src/log.c
parentda375869ff31f83938123dc0d2a8d5c0f0845a0c (diff)
log: never delay logging if the log server is stuck, always drop messages quickly
Diffstat (limited to 'src/log.c')
-rw-r--r--src/log.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/log.c b/src/log.c
index 1a6ea7e5a..0594f7fde 100644
--- a/src/log.c
+++ b/src/log.c
@@ -33,8 +33,6 @@
#include "macro.h"
#include "socket-util.h"
-#define SOCKET_TIMEOUT_USEC (5*USEC_PER_SEC)
-
static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_INFO;
@@ -120,25 +118,15 @@ void log_close_syslog(void) {
}
static int create_log_socket(int type) {
- struct timeval tv;
int fd;
- if (getpid() == 1)
- /* systemd should not block on syslog */
- type |= SOCK_NONBLOCK;
+ /* All output to the syslog/journal fds we do asynchronously,
+ * and if the buffers are full we just drop the messages */
- fd = socket(AF_UNIX, type|SOCK_CLOEXEC, 0);
+ fd = socket(AF_UNIX, type|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (fd < 0)
return -errno;
- /* Make sure we don't block for more than 5s when talking to
- * syslog */
- timeval_store(&tv, SOCKET_TIMEOUT_USEC);
- if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)) < 0) {
- close_nointr_nofail(fd);
- return -errno;
- }
-
return fd;
}