|
|
This first fragment of code illustrates the initial changes that need to be made to the TTY driver's open(D2oddi) routine:
Multithreaded open(D2oddi) routine for TTY driver
1 xxopen(dev, flag)
2 int dev, flag;
3 { ...
4 int whole_dev = dev;
5 dev = minor(dev);
6 if (all_io(MP_ATBUS)) {
7 cdistributed(whole_dev, DIST_CDEV_READ | DIST_BDEV_STRATEGY);
8 iopolldistributed(poll);
9 }
10 tc_tlock(tp); /* replacing: oldspl = spl5(); */
11 if (carrier required) {
12 tp->t_state |= CARR_ON;
13 wakeup((caddr_t) &tp->t_canq);
14 while ((tp->t_state & CARR_ON) == 0) {
15 tp->t_state |= WOPEN;
16 sleep((caddr_t) &tp->t_canq, TTIPRI);
17 }
18 } else
19 tp->t_state |= CARR_ON;
20 tc_tunlock(tp,...) /* replacing: splx(oldspl); */
21 /* replacing: (*linesw[tp->t_line].l_open) (tp); */
22 run_ld(tp, DIST_LINESW_OPEN);
What is the iopolldistributed(D3oddi) function?
(*linesw[tp->t_line].l_open) (tp);At the moment, the tty line discipline is the only supported line discipline, so if, for example, a mouse is configured, it will context-switch to an appropriate processor within run_ld; the driver does not have to worry about this situation.