Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2023 20:06:24 GMT
From:      Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0147143008ec - stable/13 - daemon: EINTR from kevent(2) is not a fatal error
Message-ID:  <202312132006.3BDK6OIx087165@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=0147143008ec5a8246a22a2b27e2a7a67e8b26a0

commit 0147143008ec5a8246a22a2b27e2a7a67e8b26a0
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-05-05 15:12:13 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2023-12-13 16:21:09 +0000

    daemon: EINTR from kevent(2) is not a fatal error
    
    Simply resume waiting for events rather than exiting if we took a signal
    here.
    
    This at least fixes running programs under daemon(8) in the face of
    suspend/resume, which I suspect hits us with a spurious EINTR rather
    than a signal anyways.
    
    Reported and tested by: manu
    Fixes:  8935a3993219b ("daemon: use kqueue for all events")
    
    (cherry picked from commit 494e7dfdbe6ecfe572228ed39f5c794954da068c)
---
 usr.sbin/daemon/daemon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c
index 48609ad03d68..dfbb609ce10d 100644
--- a/usr.sbin/daemon/daemon.c
+++ b/usr.sbin/daemon/daemon.c
@@ -425,6 +425,8 @@ daemon_eventloop(struct daemon_state *state)
 		ret = kevent(kq, NULL, 0, &event, 1, NULL);
 		switch (ret) {
 		case -1:
+			if (errno == EINTR)
+				continue;
 			err(EXIT_FAILURE, "kevent wait");
 		case 0:
 			continue;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202312132006.3BDK6OIx087165>