From: Matthew Dillon Date: Fri, 9 Jan 2009 21:51:56 +0000 (-0800) Subject: Fix a system livelock when ^C'ing a program sleeping in the console X-Git-Tag: v2.3.0~60^2~3 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/f3628b8631c318c4df61b8ead7e60eb632a22a01 Fix a system livelock when ^C'ing a program sleeping in the console driver. ERESTART must be propagated back to userland so the signal can be processed. Trying to loop on it livelocks the machine. Reported-by: Hasso Tepper --- diff --git a/sys/dev/misc/syscons/syscons.c b/sys/dev/misc/syscons/syscons.c index 36b6c477ab..59ec308c61 100644 --- a/sys/dev/misc/syscons/syscons.c +++ b/sys/dev/misc/syscons/syscons.c @@ -987,8 +987,8 @@ scioctl(struct dev_ioctl_args *ap) scp = SC_STAT(SC_DEV(sc, i)); if (scp == scp->sc->cur_scp) return 0; - while ((error=tsleep((caddr_t)&scp->smode, PCATCH, - "waitvt", 0)) == ERESTART) ; + error = tsleep((caddr_t)&scp->smode, PCATCH, "waitvt", 0); + /* May return ERESTART */ return error; case VT_GETACTIVE: /* get active vty # */ @@ -2021,8 +2021,9 @@ wait_scrn_saver_stop(sc_softc_t *sc) break; } error = tsleep((caddr_t)&scrn_blanked, PCATCH, "scrsav", 0); - if ((error != 0) && (error != ERESTART)) - break; + /* May return ERESTART */ + if (error) + break; } run_scrn_saver = FALSE; return error;