Date: Sun, 12 Apr 2026 13:44:04 +0000 From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 41aa44d0b2b6 - stable/14 - grep: toss in some explicit fflush() Message-ID: <69dba1a4.42b96.6a1d8d83@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=41aa44d0b2b658ab9a560fa325a323ed616c7ecf commit 41aa44d0b2b658ab9a560fa325a323ed616c7ecf Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2025-08-08 04:52:53 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2026-04-12 13:43:35 +0000 grep: toss in some explicit fflush() grep|tee of the src/ tree for infrequently-occurring strings is fairly annoying; drop some tactical flushes at line-match boundaries to reduce the long stalls. In the case of `grep -o`, we'll flush after multiple lines if there are multiple matches within a single line of text, while for non`-o` we'll flush generally after every line. (cherry picked from commit 7a7f74dbcc4f41d98218471297eaa629e34326e2) --- usr.bin/grep/util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/usr.bin/grep/util.c b/usr.bin/grep/util.c index ed87e56956f6..5b40405852b3 100644 --- a/usr.bin/grep/util.c +++ b/usr.bin/grep/util.c @@ -728,6 +728,8 @@ void grep_printline(struct str *line, int sep) { printline_metadata(line, sep); fwrite(line->dat, line->len, 1, stdout); putchar(fileeol); + + fflush(stdout); } static void @@ -834,6 +836,7 @@ printline(struct parsec *pc, int sep, size_t *last_out) *last_out = pc->ln.len; } putchar('\n'); + fflush(stdout); } else if (!oflag) { /* * -o is terminated on every match output, so this @@ -843,6 +846,8 @@ printline(struct parsec *pc, int sep, size_t *last_out) * to terminate if it needs to. */ terminated = false; + } else { + fflush(stdout); } } else grep_printline(&pc->ln, sep);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69dba1a4.42b96.6a1d8d83>
