git: 3109a31bf21b - stable/13 - tail: Retry kevent if the system call was interrupted
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 13 Dec 2023 20:06:32 UTC
The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3109a31bf21b50aded5f27900e7a58490daeac48 commit 3109a31bf21b50aded5f27900e7a58490daeac48 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2023-02-19 03:04:29 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2023-12-13 16:39:38 +0000 tail: Retry kevent if the system call was interrupted kevent returns EINTR when I suspend / resume. This causes tail -f and tail -F to exit with interrupt system call. Ignore this error and try kevent again. Sponsored by: Netflix (cherry picked from commit ef6f20ce47613db7cc615b45f4b6fa1eb99ae0ba) --- usr.bin/tail/forward.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index f991b2517c48..e2a3eb77aade 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -408,10 +408,16 @@ follow(file_info_t *files, enum STYLE style, off_t off) /* * In the -F case we set a timeout to ensure that * we re-stat the file at least once every second. + * If we've recieved EINTR, ignore it. Both reasons + * for its generation are transient. */ - n = kevent(kq, NULL, 0, ev, 1, Fflag ? &ts : NULL); - if (n < 0) - err(1, "kevent"); + do { + n = kevent(kq, NULL, 0, ev, 1, Fflag ? &ts : NULL); + if (n < 0 && errno == EINTR) + continue; + if (n < 0) + err(1, "kevent"); + } while (n < 0); if (n == 0) { /* timeout */ break;