diff options
author | Milan Bartos <mbartos@redhat.com> | 2013-05-20 14:30:07 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-05-22 17:00:02 +0200 |
commit | b1a2e4dfb6f4530f105b080fcf6e57014e90ce0d (patch) | |
tree | 2cf6537f35a44bde95c5a48d85a2e63fa1234950 | |
parent | b8133fb42334d75aed49481f0398353a22bd90e4 (diff) | |
download | rsyslog-b1a2e4dfb6f4530f105b080fcf6e57014e90ce0d.tar.gz rsyslog-b1a2e4dfb6f4530f105b080fcf6e57014e90ce0d.tar.bz2 rsyslog-b1a2e4dfb6f4530f105b080fcf6e57014e90ce0d.zip |
Eliminate sleep in imjournal code with sd_journal_wait
modified: plugins/imjournal/imjournal.c
-rwxr-xr-x | plugins/imjournal/imjournal.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/imjournal/imjournal.c b/plugins/imjournal/imjournal.c index 3633ec02..07ab4460 100755 --- a/plugins/imjournal/imjournal.c +++ b/plugins/imjournal/imjournal.c @@ -164,11 +164,12 @@ readjournal() { int priority = 0; int facility = 0; - /* Get next journal message, if there is none, wait a second */ - if (sd_journal_next(j) == 0) { - sleep(1); - iRet = RS_RET_OK; - goto ret; + /* Get next journal message, if there is none, wait for next */ + while (sd_journal_next(j) == 0) { + if (sd_journal_wait(j, (uint64_t) -1) < 0) { + iRet = RS_RET_ERR; + goto ret; + } } /* Get message text */ |