chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
l10n: Updated Polish translation
[elogind.git]
/
src
/
log.c
diff --git
a/src/log.c
b/src/log.c
index f65e8d1006d0c9a0b155e85c70e9a0e3853cfc43..c37ab226402c462f582b1ba1d8a8bafbbf6cfc39 100644
(file)
--- a/
src/log.c
+++ b/
src/log.c
@@
-33,7
+33,7
@@
#include "macro.h"
#include "socket-util.h"
#include "macro.h"
#include "socket-util.h"
-#define S
OCKET_TIMEOUT_USEC (5*USEC_PER_SEC
)
+#define S
NDBUF_SIZE (8*1024*1024
)
static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_INFO;
static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_INFO;
@@
-120,24
+120,16
@@
void log_close_syslog(void) {
}
static int create_log_socket(int type) {
}
static int create_log_socket(int type) {
- struct timeval tv;
int fd;
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;
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;
- }
+ fd_inc_sndbuf(fd, SNDBUF_SIZE);
return fd;
}
return fd;
}
@@
-618,13
+610,12
@@
int log_meta(
return r;
}
return r;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) {
static char buffer[LINE_MAX];
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) {
static char buffer[LINE_MAX];
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
snprintf(buffer, sizeof(buffer), format, text, file, line, func);
snprintf(buffer, sizeof(buffer), format, text, file, line, func);
-#pragma GCC diagnostic pop
char_array_0(buffer);
log_abort_msg = buffer;
char_array_0(buffer);
log_abort_msg = buffer;
@@
-632,6
+623,7
@@
_noreturn_ static void log_assert(const char *text, const char *file, int line,
log_dispatch(LOG_CRIT, file, line, func, buffer);
abort();
}
log_dispatch(LOG_CRIT, file, line, func, buffer);
abort();
}
+#pragma GCC diagnostic pop
void log_assert_failed(const char *text, const char *file, int line, const char *func) {
log_assert(text, file, line, func, "Assertion '%s' failed at %s:%u, function %s(). Aborting.");
void log_assert_failed(const char *text, const char *file, int line, const char *func) {
log_assert(text, file, line, func, "Assertion '%s' failed at %s:%u, function %s(). Aborting.");