summaryrefslogtreecommitdiff
path: root/src/shared/logs-show.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-07-07 11:32:21 -0700
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-07-07 14:32:21 -0400
commitb1aa5ced45951ed470188b362c61827fb31da2ab (patch)
tree9dcd9c03a741d9da9ae7b311136eedcca097d9b2 /src/shared/logs-show.c
parent85393d8f31196af01b2aa4e05836fca4b5d30b78 (diff)
downloadsystemd-b1aa5ced45951ed470188b362c61827fb31da2ab.tar.gz
systemd-b1aa5ced45951ed470188b362c61827fb31da2ab.tar.bz2
systemd-b1aa5ced45951ed470188b362c61827fb31da2ab.zip
shared: leave output_journal() output in buffer (#6304)
e268b81e moved an fflush() from output_json() to the generic output_journal(), when it probably should have deleted all fflush() calls from logs-show.c altogether. The caller supplies the FILE * to these functions, and should be in charge of flushing as needed. The current implementation essentially defeats any buffering stdio was bringing to the table, resulting in extraneous tiny write() calls in commands like `journalctl -b`. This commit removes the fflush() call from output_journal(), and adds them to journalctl before waiting for more entries and at completion. This way in the hot path when journalctl loops on entries stdio can combine multiple entries into bulkier write() calls.
Diffstat (limited to 'src/shared/logs-show.c')
-rw-r--r--src/shared/logs-show.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index c735fa159d..02ae4265c6 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -991,7 +991,6 @@ int output_journal(
n_columns = columns();
ret = output_funcs[mode](f, j, mode, n_columns, flags);
- fflush(stdout);
if (ellipsized && ret > 0)
*ellipsized = true;