|
|
a4b143 |
From 21deaace3a2ce9531443279a7c36a0fc068bdea7 Mon Sep 17 00:00:00 2001
|
|
|
a4b143 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
a4b143 |
Date: Thu, 19 Sep 2013 16:57:57 -0500
|
|
|
a4b143 |
Subject: [PATCH] journald: accept EPOLLERR from /dev/kmsg
|
|
|
a4b143 |
|
|
|
a4b143 |
Also print out unexpected epoll events explictly.
|
|
|
a4b143 |
---
|
|
|
a4b143 |
src/journal/journald-server.c | 20 +++++++++++++++-----
|
|
|
a4b143 |
1 file changed, 15 insertions(+), 5 deletions(-)
|
|
|
a4b143 |
|
|
|
a4b143 |
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
|
|
|
a4b143 |
index ba211b3..c252710 100644
|
|
|
a4b143 |
--- a/src/journal/journald-server.c
|
|
|
a4b143 |
+++ b/src/journal/journald-server.c
|
|
|
a4b143 |
@@ -1075,7 +1075,8 @@ int process_event(Server *s, struct epoll_event *ev) {
|
|
|
a4b143 |
ssize_t n;
|
|
|
a4b143 |
|
|
|
a4b143 |
if (ev->events != EPOLLIN) {
|
|
|
a4b143 |
- log_error("Got invalid event from epoll.");
|
|
|
a4b143 |
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
|
|
|
a4b143 |
+ "signal fd", ev->events);
|
|
|
a4b143 |
return -EIO;
|
|
|
a4b143 |
}
|
|
|
a4b143 |
|
|
|
a4b143 |
@@ -1128,8 +1129,12 @@ int process_event(Server *s, struct epoll_event *ev) {
|
|
|
a4b143 |
} else if (ev->data.fd == s->dev_kmsg_fd) {
|
|
|
a4b143 |
int r;
|
|
|
a4b143 |
|
|
|
a4b143 |
- if (ev->events != EPOLLIN) {
|
|
|
a4b143 |
- log_error("Got invalid event from epoll.");
|
|
|
a4b143 |
+ if (ev->events & EPOLLERR)
|
|
|
a4b143 |
+ log_warning("/dev/kmsg buffer overrun, some messages lost.");
|
|
|
a4b143 |
+
|
|
|
a4b143 |
+ if (!(ev->events & EPOLLIN)) {
|
|
|
a4b143 |
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
|
|
|
a4b143 |
+ "/dev/kmsg", ev->events);
|
|
|
a4b143 |
return -EIO;
|
|
|
a4b143 |
}
|
|
|
a4b143 |
|
|
|
a4b143 |
@@ -1143,7 +1148,9 @@ int process_event(Server *s, struct epoll_event *ev) {
|
|
|
a4b143 |
ev->data.fd == s->syslog_fd) {
|
|
|
a4b143 |
|
|
|
a4b143 |
if (ev->events != EPOLLIN) {
|
|
|
a4b143 |
- log_error("Got invalid event from epoll.");
|
|
|
a4b143 |
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
|
|
|
a4b143 |
+ ev->data.fd == s->native_fd ? "native fd" : "syslog fd",
|
|
|
a4b143 |
+ ev->events);
|
|
|
a4b143 |
return -EIO;
|
|
|
a4b143 |
}
|
|
|
a4b143 |
|
|
|
a4b143 |
@@ -1264,7 +1271,8 @@ int process_event(Server *s, struct epoll_event *ev) {
|
|
|
a4b143 |
} else if (ev->data.fd == s->stdout_fd) {
|
|
|
a4b143 |
|
|
|
a4b143 |
if (ev->events != EPOLLIN) {
|
|
|
a4b143 |
- log_error("Got invalid event from epoll.");
|
|
|
a4b143 |
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
|
|
|
a4b143 |
+ "stdout fd", ev->events);
|
|
|
a4b143 |
return -EIO;
|
|
|
a4b143 |
}
|
|
|
a4b143 |
|
|
|
a4b143 |
@@ -1275,6 +1283,8 @@ int process_event(Server *s, struct epoll_event *ev) {
|
|
|
a4b143 |
StdoutStream *stream;
|
|
|
a4b143 |
|
|
|
a4b143 |
if ((ev->events|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) {
|
|
|
a4b143 |
+ log_error("Got invalid event from epoll for %s: %"PRIx32,
|
|
|
a4b143 |
+ "stdout stream", ev->events);
|
|
|
a4b143 |
log_error("Got invalid event from epoll.");
|
|
|
a4b143 |
return -EIO;
|
|
|
a4b143 |
}
|