summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/tty.c36
-rw-r--r--sys/kern/tty_cons.c6
-rw-r--r--sys/kern/tty_pty.c22
-rw-r--r--sys/kern/tty_snoop.c6
4 files changed, 16 insertions, 54 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index ee1b6e7..88456be 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -422,12 +422,7 @@ parmrk:
if (CCEQ(cc[VSTOP], c)) {
if (!ISSET(tp->t_state, TS_TTSTOP)) {
SET(tp->t_state, TS_TTSTOP);
-#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
-#else
- (*devsw(tp->t_dev)->d_stop)(tp,
- 0);
-#endif
return (0);
}
if (!CCEQ(cc[VSTART], c))
@@ -999,11 +994,7 @@ ttioctl(tp, cmd, data, flag)
s = spltty();
if (!ISSET(tp->t_state, TS_TTSTOP)) {
SET(tp->t_state, TS_TTSTOP);
-#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
-#else
- (*devsw(tp->t_dev)->d_stop)(tp, 0);
-#endif
}
splx(s);
break;
@@ -1062,14 +1053,16 @@ ttioctl(tp, cmd, data, flag)
}
int
-ttypoll(tp, events, p)
- struct tty *tp;
+ttypoll(dev, events, p)
+ dev_t dev;
int events;
struct proc *p;
{
int s;
int revents = 0;
+ struct tty *tp;
+ tp = dev->si_tty;
if (tp == NULL) /* XXX used to return ENXIO, but that means true! */
return ((events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM))
| POLLHUP);
@@ -1094,19 +1087,6 @@ ttypoll(tp, events, p)
}
/*
- * This is a wrapper for compatibility with the select vector used by
- * cdevsw. It relies on a proper xxxdevtotty routine.
- */
-int
-ttpoll(dev, events, p)
- dev_t dev;
- int events;
- struct proc *p;
-{
- return ttypoll((*devsw(dev)->d_devtotty)(dev), events, p);
-}
-
-/*
* Must be called at spltty().
*/
static int
@@ -1192,11 +1172,7 @@ again:
FLUSHQ(&tp->t_outq);
CLR(tp->t_state, TS_TTSTOP);
}
-#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, rw);
-#else
- (*devsw(tp->t_dev)->d_stop)(tp, rw);
-#endif
if (rw & FREAD) {
FLUSHQ(&tp->t_canq);
FLUSHQ(&tp->t_rawq);
@@ -1377,11 +1353,7 @@ ttymodem(tp, flag)
} else if (!ISSET(tp->t_state, TS_CAR_OFLOW)) {
SET(tp->t_state, TS_CAR_OFLOW);
SET(tp->t_state, TS_TTSTOP);
-#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
-#else
- (*devsw(tp->t_dev)->d_stop)(tp, 0);
-#endif
}
} else if (flag == 0) {
/*
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 4fef6f6..c59864f 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -100,7 +100,6 @@ static u_char cn_phys_is_open; /* nonzero if physical device is open */
static d_close_t *cn_phys_close; /* physical device close function */
static d_open_t *cn_phys_open; /* physical device open function */
struct consdev *cn_tab; /* physical console device info */
-static struct tty *cn_tp; /* physical console tty struct */
static dev_t condev_t; /* represents the device private info */
CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL);
@@ -175,7 +174,6 @@ cninit_finish()
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
cdp->d_open = cnopen;
- cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev);
cn_dev_t = cn_tab->cn_dev;
cn_udev_t = dev2udev(cn_dev_t);
}
@@ -196,7 +194,6 @@ cnuninit(void)
cn_phys_close = NULL;
cdp->d_open = cn_phys_open;
cn_phys_open = NULL;
- cn_tp = NULL;
cn_dev_t = NODEV;
cn_udev_t = NOUDEV;
}
@@ -281,6 +278,7 @@ cnopen(dev, flag, mode, p)
openflag = flag;
cn_is_open = 1;
}
+ dev->si_tty = physdev->si_tty;
}
return (retval);
}
@@ -292,10 +290,12 @@ cnclose(dev, flag, mode, p)
struct proc *p;
{
dev_t cndev;
+ struct tty *cn_tp;
if (cn_tab == NULL)
return (0);
cndev = cn_tab->cn_dev;
+ cn_tp = cndev->si_tty;
/*
* act appropriatly depending on whether it's /dev/console
* or the pysical device (e.g. /dev/sio) that's being closed.
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 2fe2f5e..9531f7b 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -58,6 +58,7 @@
MALLOC_DEFINE(M_PTY, "ptys", "pty data structures");
static void ptsstart __P((struct tty *tp));
+static void ptsstop __P((struct tty *tp, int rw));
static void ptcwakeup __P((struct tty *tp, int flag));
static void ptyinit __P((int n));
@@ -66,8 +67,6 @@ static d_close_t ptsclose;
static d_read_t ptsread;
static d_write_t ptswrite;
static d_ioctl_t ptyioctl;
-static d_stop_t ptsstop;
-static d_devtotty_t ptydevtotty;
static d_open_t ptcopen;
static d_close_t ptcclose;
static d_read_t ptcread;
@@ -81,10 +80,10 @@ static struct cdevsw pts_cdevsw = {
/* read */ ptsread,
/* write */ ptswrite,
/* ioctl */ ptyioctl,
- /* stop */ ptsstop,
+ /* stop */ nostop,
/* reset */ noreset,
- /* devtotty */ ptydevtotty,
- /* poll */ ttpoll,
+ /* devtotty */ nodevtotty,
+ /* poll */ ttypoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "pts",
@@ -106,7 +105,7 @@ static struct cdevsw ptc_cdevsw = {
/* ioctl */ ptyioctl,
/* stop */ nostop,
/* reset */ noreset,
- /* devtotty */ ptydevtotty,
+ /* devtotty */ nodevtotty,
/* poll */ ptcpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
@@ -362,6 +361,7 @@ ptcopen(dev, flag, devtype, p)
if (tp->t_oproc)
return (EIO);
tp->t_oproc = ptsstart;
+ tp->t_stop = ptsstop;
(void)(*linesw[tp->t_line].l_modem)(tp, 1);
tp->t_lflag &= ~EXTPROC;
pti = dev->si_drv1;
@@ -647,16 +647,6 @@ block:
goto again;
}
-static struct tty *
-ptydevtotty(dev)
- dev_t dev;
-{
- if (minor(dev) & ~0xff)
- return (NULL);
-
- return dev->si_tty;
-}
-
/*ARGSUSED*/
static int
ptyioctl(dev, cmd, data, flag, p)
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index 7563686..e30b293 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -82,9 +82,9 @@ snpdevtotty (dev)
struct cdevsw *cdp;
cdp = devsw(dev);
- if (cdp == NULL)
- return (NULL);
- return ((*cdp->d_devtotty)(dev));
+ if (cdp && cdp->d_flags & D_TTY)
+ return (dev->si_tty);
+ return (NULL);
}
#define SNP_INPUT_BUF 5 /* This is even too much,the maximal
OpenPOWER on IntegriCloud