diff options
author | anton <anton@cvs.openbsd.org> | 2018-11-19 19:19:25 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2018-11-19 19:19:25 +0000 |
commit | fd8856b4c3298aeafc2766dc60c782e3c5257d94 (patch) | |
tree | f3676b3f913ac4656082032bf4e757e40c2eed85 /sys/dev/wscons/wsmux.c | |
parent | 6872c56497ebd6722c499ebcef8c07ee73a930a2 (diff) |
Utilize sigio with wscons. The old behavior of always making the process group
of the process who opens the device the default recipient of sigio is removed as
a side-effect of this change. Issuing ioctl(FIOSETOWN) is therefore mandatory in
order to receive sigio, which is more consistent with other subsystems
supporting sigio.
This change is all made possible by the new sigio(9) API and prevents wscons
from keeping a pointer to the recipient process. Usage of such pointer could
cause a panic since wscons is not inform on process deallocation, leaving a
dangling pointer behind.
ok mpi@ visa@
Diffstat (limited to 'sys/dev/wscons/wsmux.c')
-rw-r--r-- | sys/dev/wscons/wsmux.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c index c8654dc01e1..11710829475 100644 --- a/sys/dev/wscons/wsmux.c +++ b/sys/dev/wscons/wsmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmux.c,v 1.32 2017/06/12 13:45:39 deraadt Exp $ */ +/* $OpenBSD: wsmux.c,v 1.33 2018/11/19 19:19:24 anton Exp $ */ /* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */ /* @@ -192,7 +192,6 @@ wsmuxopen(dev_t dev, int flags, int mode, struct proc *p) evar = &sc->sc_base.me_evar; wsevent_init(evar); - evar->io = p->p_p; #ifdef WSDISPLAY_COMPAT_RAWKBD sc->sc_rawkbd = 0; #endif @@ -476,18 +475,15 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag, evar = sc->sc_base.me_evp; if (evar == NULL) return (EINVAL); - if (-*(int *)data != evar->io->ps_pgid - && *(int *)data != evar->io->ps_pid) - return (EPERM); - return (0); + return (sigio_setown(&evar->sigio, *(int *)data)); case TIOCSPGRP: DPRINTF(("%s: TIOCSPGRP\n", sc->sc_base.me_dv.dv_xname)); + if (*(int *)data < 0) + return (EINVAL); evar = sc->sc_base.me_evp; if (evar == NULL) return (EINVAL); - if (*(int *)data != evar->io->ps_pgid) - return (EPERM); - return (0); + return (sigio_setown(&evar->sigio, -*(int *)data)); default: DPRINTF(("%s: unknown\n", sc->sc_base.me_dv.dv_xname)); break; |