summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2010-07-26 01:56:27 +0000
committerguenther <guenther@openbsd.org>2010-07-26 01:56:27 +0000
commit207e4b38a785bf665de26471f4fc5fde67fa99f0 (patch)
tree5b61a93df6c22438e6a0955afca220cb2f2207a0 /sys/dev
parentAdd missing braces so a loop will function as intended. (diff)
downloadwireguard-openbsd-207e4b38a785bf665de26471f4fc5fde67fa99f0.tar.xz
wireguard-openbsd-207e4b38a785bf665de26471f4fc5fde67fa99f0.zip
Correct the links between threads, processes, pgrps, and sessions,
so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/uhid.c16
-rw-r--r--sys/dev/wscons/wseventvar.h6
-rw-r--r--sys/dev/wscons/wskbd.c10
-rw-r--r--sys/dev/wscons/wsmouse.c10
-rw-r--r--sys/dev/wscons/wsmux.c10
5 files changed, 26 insertions, 26 deletions
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index 6ebeba10455..9955bca0a97 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhid.c,v 1.47 2009/11/23 11:10:16 yuo Exp $ */
+/* $OpenBSD: uhid.c,v 1.48 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -81,10 +81,10 @@ struct uhid_softc {
struct clist sc_q;
struct selinfo sc_rsel;
- struct proc *sc_async; /* process that wants SIGIO */
- u_char sc_state; /* driver state */
-#define UHID_ASLP 0x01 /* waiting for device data */
-#define UHID_IMMED 0x02 /* return read data immediately */
+ struct process *sc_async; /* process that wants SIGIO */
+ u_char sc_state; /* driver state */
+#define UHID_ASLP 0x01 /* waiting for device data */
+#define UHID_IMMED 0x02 /* return read data immediately */
int sc_refcnt;
u_char sc_dying;
@@ -236,7 +236,7 @@ uhid_intr(struct uhidev *addr, void *data, u_int len)
selwakeup(&sc->sc_rsel);
if (sc->sc_async != NULL) {
DPRINTFN(3, ("uhid_intr: sending SIGIO %p\n", sc->sc_async));
- psignal(sc->sc_async, SIGIO);
+ prsignal(sc->sc_async, SIGIO);
}
}
@@ -427,7 +427,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr,
if (*(int *)addr) {
if (sc->sc_async != NULL)
return (EBUSY);
- sc->sc_async = p;
+ sc->sc_async = p->p_p;
DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", p));
} else
sc->sc_async = NULL;
@@ -437,7 +437,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr,
case TIOCSPGRP:
if (sc->sc_async == NULL)
return (EINVAL);
- if (*(int *)addr != sc->sc_async->p_pgid)
+ if (*(int *)addr != sc->sc_async->ps_pgid)
return (EPERM);
break;
diff --git a/sys/dev/wscons/wseventvar.h b/sys/dev/wscons/wseventvar.h
index f1eeb74dcd8..213ffc93a66 100644
--- a/sys/dev/wscons/wseventvar.h
+++ b/sys/dev/wscons/wseventvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wseventvar.h,v 1.6 2009/11/09 17:53:39 nicm Exp $ */
+/* $OpenBSD: wseventvar.h,v 1.7 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: wseventvar.h,v 1.1 1998/03/22 14:24:03 drochner Exp $ */
/*
@@ -84,7 +84,7 @@ struct wseventvar {
u_int get; /* get (read) index (modified synchronously) */
volatile u_int put; /* put (write) index (modified by interrupt) */
struct selinfo sel; /* process selecting */
- struct proc *io; /* process that opened queue (can get SIGIO) */
+ struct process *io; /* process that opened queue (can get SIGIO) */
int wanted; /* wake up on input ready */
int async; /* send SIGIO on input ready */
struct wscons_event *q; /* circular buffer (queue) of events */
@@ -99,7 +99,7 @@ struct wseventvar {
wakeup((caddr_t)(ev)); \
} \
if ((ev)->async) \
- pgsignal((ev)->io->p_pgrp, SIGIO, 0); \
+ pgsignal((ev)->io->ps_pgrp, SIGIO, 0); \
}
void wsevent_init(struct wseventvar *);
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index 5fd868cd5f1..21bc897129b 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.61 2009/10/13 19:33:19 pirofti Exp $ */
+/* $OpenBSD: wskbd.c,v 1.62 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -815,7 +815,7 @@ wskbdopen(dev_t dev, int flags, int mode, struct proc *p)
evar = &sc->sc_base.me_evar;
wsevent_init(evar);
- evar->io = p;
+ evar->io = p->p_p;
error = wskbd_do_open(sc, evar);
if (error) {
@@ -937,15 +937,15 @@ wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, caddr_t data, int flag,
case FIOSETOWN:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- if (-*(int *)data != sc->sc_base.me_evp->io->p_pgid &&
- *(int *)data != sc->sc_base.me_evp->io->p_pid)
+ if (-*(int *)data != sc->sc_base.me_evp->io->ps_pgid &&
+ *(int *)data != sc->sc_base.me_evp->io->ps_pid)
return (EPERM);
return (0);
case TIOCSPGRP:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- if (*(int *)data != sc->sc_base.me_evp->io->p_pgid)
+ if (*(int *)data != sc->sc_base.me_evp->io->ps_pgid)
return (EPERM);
return (0);
}
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index bb5e5e12b43..e1ab5d29802 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmouse.c,v 1.20 2009/10/13 19:33:19 pirofti Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.21 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -512,7 +512,7 @@ wsmouseopen(dev_t dev, int flags, int mode, struct proc *p)
evar = &sc->sc_base.me_evar;
wsevent_init(evar);
- evar->io = p;
+ evar->io = p->p_p;
error = wsmousedoopen(sc, evar);
if (error) {
@@ -638,15 +638,15 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, int flag,
case FIOSETOWN:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- if (-*(int *)data != sc->sc_base.me_evp->io->p_pgid
- && *(int *)data != sc->sc_base.me_evp->io->p_pid)
+ if (-*(int *)data != sc->sc_base.me_evp->io->ps_pgid
+ && *(int *)data != sc->sc_base.me_evp->io->ps_pid)
return (EPERM);
return (0);
case TIOCSPGRP:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- if (*(int *)data != sc->sc_base.me_evp->io->p_pgid)
+ if (*(int *)data != sc->sc_base.me_evp->io->ps_pgid)
return (EPERM);
return (0);
}
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index 1a9ac765eb0..1437256f886 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.23 2008/06/26 05:42:19 ray Exp $ */
+/* $OpenBSD: wsmux.c,v 1.24 2010/07/26 01:56:27 guenther Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -193,7 +193,7 @@ wsmuxopen(dev_t dev, int flags, int mode, struct proc *p)
evar = &sc->sc_base.me_evar;
wsevent_init(evar);
- evar->io = p;
+ evar->io = p->p_p;
#ifdef WSDISPLAY_COMPAT_RAWKBD
sc->sc_rawkbd = 0;
#endif
@@ -477,8 +477,8 @@ 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->p_pgid
- && *(int *)data != evar->io->p_pid)
+ if (-*(int *)data != evar->io->ps_pgid
+ && *(int *)data != evar->io->ps_pid)
return (EPERM);
return (0);
case TIOCSPGRP:
@@ -486,7 +486,7 @@ 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->p_pgid)
+ if (*(int *)data != evar->io->ps_pgid)
return (EPERM);
return (0);
default: