aboutsummaryrefslogtreecommitdiff
path: root/sys/pc98
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2001-04-24 00:51:53 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2001-04-24 00:51:53 +0000
commit33a9ed9d0e26ec60b5237d33dc09026841b9bf67 (patch)
tree13737902646621a419ff2787450af6795c4f8f66 /sys/pc98
parent5d69bac493abc8ca9f35ca358987efbe2cbb2a91 (diff)
Notes
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/pc98/syscons.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c
index 54c51dca00ab..a5f73d66f825 100644
--- a/sys/pc98/pc98/syscons.c
+++ b/sys/pc98/pc98/syscons.c
@@ -841,14 +841,20 @@ scioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
case VT_SETMODE: /* set screen switcher mode */
{
struct vt_mode *mode;
+ struct proc *p1;
mode = (struct vt_mode *)data;
DPRINTF(5, ("sc%d: VT_SETMODE ", sc->unit));
if (scp->smode.mode == VT_PROCESS) {
- if (scp->proc == pfind(scp->pid) && scp->proc != p) {
+ p1 = pfind(scp->pid);
+ if (scp->proc == p1 && scp->proc != p) {
+ if (p1)
+ PROC_UNLOCK(p1);
DPRINTF(5, ("error EPERM\n"));
return EPERM;
}
+ if (p1)
+ PROC_UNLOCK(p1);
}
s = spltty();
if (mode->mode == VT_AUTO) {
@@ -2081,6 +2087,7 @@ int
sc_switch_scr(sc_softc_t *sc, u_int next_scr)
{
struct tty *tp;
+ struct proc *p;
int s;
DPRINTF(5, ("sc0: sc_switch_scr() %d ", next_scr + 1));
@@ -2100,7 +2107,10 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
if (sc->switch_in_progress
&& (sc->cur_scp->smode.mode == VT_PROCESS)
&& sc->cur_scp->proc) {
- if (sc->cur_scp->proc != pfind(sc->cur_scp->pid)) {
+ p = pfind(sc->cur_scp->pid);
+ if (sc->cur_scp->proc != p) {
+ if (p)
+ PROC_UNLOCK(p);
/*
* The controlling process has died!!. Do some clean up.
* NOTE:`cur_scp->proc' and `cur_scp->smode.mode'
@@ -2133,6 +2143,8 @@ sc_switch_scr(sc_softc_t *sc, u_int next_scr)
DPRINTF(5, ("waiting nothing, "));
}
} else {
+ if (p)
+ PROC_UNLOCK(p);
/*
* The controlling process is alive, but not responding...
* It is either buggy or it may be just taking time.
@@ -2297,8 +2309,12 @@ do_switch_scr(sc_softc_t *sc, int s)
static int
vt_proc_alive(scr_stat *scp)
{
+ struct proc *p;
+
if (scp->proc) {
- if (scp->proc == pfind(scp->pid))
+ if ((p = pfind(scp->pid)) != NULL)
+ PROC_UNLOCK(p);
+ if (scp->proc == p)
return TRUE;
scp->proc = NULL;
scp->smode.mode = VT_AUTO;