summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-13 04:09:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-13 04:09:26 +0000
commitd4aca1210000a8540821a01a557cb52607619788 (patch)
tree1ffe4addc26091dd66741b4852f9e4f479f66985
parenta9bd75969560af6ac14ffa73c82292617ce171af (diff)
from netbsd:
Prevent endless loop (-> kernel crash) when a signal is sent to a process waiting for a vt to become active. Move one ifdef XSERVER to the right place.
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_drv.c4
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_ext.c8
-rw-r--r--sys/arch/i386/isa/pcvt/pcvt_hdr.h3
3 files changed, 8 insertions, 7 deletions
diff --git a/sys/arch/i386/isa/pcvt/pcvt_drv.c b/sys/arch/i386/isa/pcvt/pcvt_drv.c
index ad0cc727d95..fe7af81895c 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_drv.c
@@ -611,11 +611,11 @@ pcioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
#endif /* PCVT_EMU_MOUSE */
-#ifdef XSERVER
if((error = usl_vt_ioctl(dev, cmd, data, flag, p)) >= 0)
- return error;
+ return (error == PCVT_ERESTART) ? ERESTART : error;
+#ifdef XSERVER
/*
* just for compatibility:
* XFree86 < 2.0 and SuperProbe still might use it
diff --git a/sys/arch/i386/isa/pcvt/pcvt_ext.c b/sys/arch/i386/isa/pcvt/pcvt_ext.c
index 9bbe8dd022b..4b031d60b2b 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_ext.c
+++ b/sys/arch/i386/isa/pcvt/pcvt_ext.c
@@ -2722,8 +2722,7 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
int x = spltty();
i = current_video_screen;
error = 0;
- while (current_video_screen == i &&
- (error == 0 || error == ERESTART))
+ while (current_video_screen == i && error == 0)
{
vs[i].vt_status |= VT_WAIT_ACT;
error = tsleep((caddr_t)&vs[i].smode,
@@ -2735,8 +2734,7 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int x = spltty();
error = 0;
- while (current_video_screen != i &&
- (error == 0 || error == ERESTART))
+ while (current_video_screen != i && error == 0)
{
vs[i].vt_status |= VT_WAIT_ACT;
error = tsleep((caddr_t)&vs[i].smode,
@@ -2744,7 +2742,7 @@ usl_vt_ioctl(Dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
splx(x);
}
- return error;
+ return (error == ERESTART) ? PCVT_ERESTART : error;
case KDENABIO:
/* grant the process IO access; only allowed if euid == 0 */
diff --git a/sys/arch/i386/isa/pcvt/pcvt_hdr.h b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
index 86ec7c8e03b..6286e439132 100644
--- a/sys/arch/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/arch/i386/isa/pcvt/pcvt_hdr.h
@@ -914,6 +914,9 @@ typedef struct video_state {
EXTERN video_state vs[PCVT_NSCREENS]; /* parameters for screens */
+/* used to be able to pass ERESTART on properly */
+#define PCVT_ERESTART (ELAST + 1)
+
/* possible states for video_state.vt_status: */
#define VT_WAIT_REL 1 /* wait till process released vt */