tty_pty.c revision 1.1.1.2 1 /*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tty_pty.c 8.2 (Berkeley) 9/23/93
34 */
35
36 /*
37 * Pseudo-teletype Driver
38 * (Actually two drivers, requiring two entries in 'cdevsw')
39 */
40 #include "pty.h" /* XXX */
41
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/ioctl.h>
45 #include <sys/proc.h>
46 #include <sys/tty.h>
47 #include <sys/conf.h>
48 #include <sys/file.h>
49 #include <sys/uio.h>
50 #include <sys/kernel.h>
51 #include <sys/vnode.h>
52
53 #if NPTY == 1
54 #undef NPTY
55 #define NPTY 32 /* crude XXX */
56 #endif
57
58 #define BUFSIZ 100 /* Chunk size iomoved to/from user */
59
60 /*
61 * pts == /dev/tty[pqrs]?
62 * ptc == /dev/pty[pqrs]?
63 */
64 struct tty pt_tty[NPTY]; /* XXX */
65 struct pt_ioctl {
66 int pt_flags;
67 struct selinfo pt_selr, pt_selw;
68 u_char pt_send;
69 u_char pt_ucntl;
70 } pt_ioctl[NPTY]; /* XXX */
71 int npty = NPTY; /* for pstat -t */
72
73 #define PF_PKT 0x08 /* packet mode */
74 #define PF_STOPPED 0x10 /* user told stopped */
75 #define PF_REMOTE 0x20 /* remote and flow controlled input */
76 #define PF_NOSTOP 0x40
77 #define PF_UCNTL 0x80 /* user control mode */
78
79 void ptsstop __P((struct tty *, int));
80
81 /*
82 * Establish n (or default if n is 1) ptys in the system.
83 *
84 * XXX cdevsw & pstat require the array `pty[]' to be an array
85 */
86 void
87 ptyattach(n)
88 int n;
89 {
90 #ifdef notyet
91 char *mem;
92 register u_long ntb;
93 #define DEFAULT_NPTY 32
94
95 /* maybe should allow 0 => none? */
96 if (n <= 1)
97 n = DEFAULT_NPTY;
98 ntb = n * sizeof(struct tty);
99 mem = malloc(ntb + ALIGNBYTES + n * sizeof(struct pt_ioctl),
100 M_DEVBUF, M_WAITOK);
101 pt_tty = (struct tty *)mem;
102 mem = (char *)ALIGN(mem + ntb);
103 pt_ioctl = (struct pt_ioctl *)mem;
104 npty = n;
105 #endif
106 }
107
108 /*ARGSUSED*/
109 ptsopen(dev, flag, devtype, p)
110 dev_t dev;
111 int flag, devtype;
112 struct proc *p;
113 {
114 register struct tty *tp;
115 int error;
116
117 if (minor(dev) >= npty)
118 return (ENXIO);
119 tp = &pt_tty[minor(dev)];
120 if ((tp->t_state & TS_ISOPEN) == 0) {
121 tp->t_state |= TS_WOPEN;
122 ttychars(tp); /* Set up default chars */
123 tp->t_iflag = TTYDEF_IFLAG;
124 tp->t_oflag = TTYDEF_OFLAG;
125 tp->t_lflag = TTYDEF_LFLAG;
126 tp->t_cflag = TTYDEF_CFLAG;
127 tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
128 ttsetwater(tp); /* would be done in xxparam() */
129 } else if (tp->t_state&TS_XCLUDE && p->p_ucred->cr_uid != 0)
130 return (EBUSY);
131 if (tp->t_oproc) /* Ctrlr still around. */
132 tp->t_state |= TS_CARR_ON;
133 while ((tp->t_state & TS_CARR_ON) == 0) {
134 tp->t_state |= TS_WOPEN;
135 if (flag&FNONBLOCK)
136 break;
137 if (error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH,
138 ttopen, 0))
139 return (error);
140 }
141 error = (*linesw[tp->t_line].l_open)(dev, tp);
142 ptcwakeup(tp, FREAD|FWRITE);
143 return (error);
144 }
145
146 ptsclose(dev, flag, mode, p)
147 dev_t dev;
148 int flag, mode;
149 struct proc *p;
150 {
151 register struct tty *tp;
152 int err;
153
154 tp = &pt_tty[minor(dev)];
155 err = (*linesw[tp->t_line].l_close)(tp, flag);
156 err |= ttyclose(tp);
157 ptcwakeup(tp, FREAD|FWRITE);
158 return (err);
159 }
160
161 ptsread(dev, uio, flag)
162 dev_t dev;
163 struct uio *uio;
164 int flag;
165 {
166 struct proc *p = curproc;
167 register struct tty *tp = &pt_tty[minor(dev)];
168 register struct pt_ioctl *pti = &pt_ioctl[minor(dev)];
169 int error = 0;
170
171 again:
172 if (pti->pt_flags & PF_REMOTE) {
173 while (isbackground(p, tp)) {
174 if ((p->p_sigignore & sigmask(SIGTTIN)) ||
175 (p->p_sigmask & sigmask(SIGTTIN)) ||
176 p->p_pgrp->pg_jobc == 0 ||
177 p->p_flag & P_PPWAIT)
178 return (EIO);
179 pgsignal(p->p_pgrp, SIGTTIN, 1);
180 if (error = ttysleep(tp, (caddr_t)&lbolt,
181 TTIPRI | PCATCH, ttybg, 0))
182 return (error);
183 }
184 if (tp->t_canq.c_cc == 0) {
185 if (flag & IO_NDELAY)
186 return (EWOULDBLOCK);
187 if (error = ttysleep(tp, (caddr_t)&tp->t_canq,
188 TTIPRI | PCATCH, ttyin, 0))
189 return (error);
190 goto again;
191 }
192 while (tp->t_canq.c_cc > 1 && uio->uio_resid > 0)
193 if (ureadc(getc(&tp->t_canq), uio) < 0) {
194 error = EFAULT;
195 break;
196 }
197 if (tp->t_canq.c_cc == 1)
198 (void) getc(&tp->t_canq);
199 if (tp->t_canq.c_cc)
200 return (error);
201 } else
202 if (tp->t_oproc)
203 error = (*linesw[tp->t_line].l_read)(tp, uio, flag);
204 ptcwakeup(tp, FWRITE);
205 return (error);
206 }
207
208 /*
209 * Write to pseudo-tty.
210 * Wakeups of controlling tty will happen
211 * indirectly, when tty driver calls ptsstart.
212 */
213 ptswrite(dev, uio, flag)
214 dev_t dev;
215 struct uio *uio;
216 int flag;
217 {
218 register struct tty *tp;
219
220 tp = &pt_tty[minor(dev)];
221 if (tp->t_oproc == 0)
222 return (EIO);
223 return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
224 }
225
226 /*
227 * Start output on pseudo-tty.
228 * Wake up process selecting or sleeping for input from controlling tty.
229 */
230 void
231 ptsstart(tp)
232 struct tty *tp;
233 {
234 register struct pt_ioctl *pti = &pt_ioctl[minor(tp->t_dev)];
235
236 if (tp->t_state & TS_TTSTOP)
237 return;
238 if (pti->pt_flags & PF_STOPPED) {
239 pti->pt_flags &= ~PF_STOPPED;
240 pti->pt_send = TIOCPKT_START;
241 }
242 ptcwakeup(tp, FREAD);
243 }
244
245 ptcwakeup(tp, flag)
246 struct tty *tp;
247 int flag;
248 {
249 struct pt_ioctl *pti = &pt_ioctl[minor(tp->t_dev)];
250
251 if (flag & FREAD) {
252 selwakeup(&pti->pt_selr);
253 wakeup((caddr_t)&tp->t_outq.c_cf);
254 }
255 if (flag & FWRITE) {
256 selwakeup(&pti->pt_selw);
257 wakeup((caddr_t)&tp->t_rawq.c_cf);
258 }
259 }
260
261 /*ARGSUSED*/
262 #ifdef __STDC__
263 ptcopen(dev_t dev, int flag, int devtype, struct proc *p)
264 #else
265 ptcopen(dev, flag, devtype, p)
266 dev_t dev;
267 int flag, devtype;
268 struct proc *p;
269 #endif
270 {
271 register struct tty *tp;
272 struct pt_ioctl *pti;
273
274 if (minor(dev) >= npty)
275 return (ENXIO);
276 tp = &pt_tty[minor(dev)];
277 if (tp->t_oproc)
278 return (EIO);
279 tp->t_oproc = ptsstart;
280 #ifdef sun4c
281 tp->t_stop = ptsstop;
282 #endif
283 (void)(*linesw[tp->t_line].l_modem)(tp, 1);
284 tp->t_lflag &= ~EXTPROC;
285 pti = &pt_ioctl[minor(dev)];
286 pti->pt_flags = 0;
287 pti->pt_send = 0;
288 pti->pt_ucntl = 0;
289 return (0);
290 }
291
292 ptcclose(dev)
293 dev_t dev;
294 {
295 register struct tty *tp;
296
297 tp = &pt_tty[minor(dev)];
298 (void)(*linesw[tp->t_line].l_modem)(tp, 0);
299 tp->t_state &= ~TS_CARR_ON;
300 tp->t_oproc = 0; /* mark closed */
301 tp->t_session = 0;
302 return (0);
303 }
304
305 ptcread(dev, uio, flag)
306 dev_t dev;
307 struct uio *uio;
308 int flag;
309 {
310 register struct tty *tp = &pt_tty[minor(dev)];
311 struct pt_ioctl *pti = &pt_ioctl[minor(dev)];
312 char buf[BUFSIZ];
313 int error = 0, cc;
314
315 /*
316 * We want to block until the slave
317 * is open, and there's something to read;
318 * but if we lost the slave or we're NBIO,
319 * then return the appropriate error instead.
320 */
321 for (;;) {
322 if (tp->t_state&TS_ISOPEN) {
323 if (pti->pt_flags&PF_PKT && pti->pt_send) {
324 error = ureadc((int)pti->pt_send, uio);
325 if (error)
326 return (error);
327 if (pti->pt_send & TIOCPKT_IOCTL) {
328 cc = min(uio->uio_resid,
329 sizeof(tp->t_termios));
330 uiomove(&tp->t_termios, cc, uio);
331 }
332 pti->pt_send = 0;
333 return (0);
334 }
335 if (pti->pt_flags&PF_UCNTL && pti->pt_ucntl) {
336 error = ureadc((int)pti->pt_ucntl, uio);
337 if (error)
338 return (error);
339 pti->pt_ucntl = 0;
340 return (0);
341 }
342 if (tp->t_outq.c_cc && (tp->t_state&TS_TTSTOP) == 0)
343 break;
344 }
345 if ((tp->t_state&TS_CARR_ON) == 0)
346 return (0); /* EOF */
347 if (flag & IO_NDELAY)
348 return (EWOULDBLOCK);
349 if (error = tsleep((caddr_t)&tp->t_outq.c_cf, TTIPRI | PCATCH,
350 ttyin, 0))
351 return (error);
352 }
353 if (pti->pt_flags & (PF_PKT|PF_UCNTL))
354 error = ureadc(0, uio);
355 while (uio->uio_resid > 0 && error == 0) {
356 cc = q_to_b(&tp->t_outq, buf, min(uio->uio_resid, BUFSIZ));
357 if (cc <= 0)
358 break;
359 error = uiomove(buf, cc, uio);
360 }
361 if (tp->t_outq.c_cc <= tp->t_lowat) {
362 if (tp->t_state&TS_ASLEEP) {
363 tp->t_state &= ~TS_ASLEEP;
364 wakeup((caddr_t)&tp->t_outq);
365 }
366 selwakeup(&tp->t_wsel);
367 }
368 return (error);
369 }
370
371 void
372 ptsstop(tp, flush)
373 register struct tty *tp;
374 int flush;
375 {
376 struct pt_ioctl *pti = &pt_ioctl[minor(tp->t_dev)];
377 int flag;
378
379 /* note: FLUSHREAD and FLUSHWRITE already ok */
380 if (flush == 0) {
381 flush = TIOCPKT_STOP;
382 pti->pt_flags |= PF_STOPPED;
383 } else
384 pti->pt_flags &= ~PF_STOPPED;
385 pti->pt_send |= flush;
386 /* change of perspective */
387 flag = 0;
388 if (flush & FREAD)
389 flag |= FWRITE;
390 if (flush & FWRITE)
391 flag |= FREAD;
392 ptcwakeup(tp, flag);
393 }
394
395 ptcselect(dev, rw, p)
396 dev_t dev;
397 int rw;
398 struct proc *p;
399 {
400 register struct tty *tp = &pt_tty[minor(dev)];
401 struct pt_ioctl *pti = &pt_ioctl[minor(dev)];
402 int s;
403
404 if ((tp->t_state&TS_CARR_ON) == 0)
405 return (1);
406 switch (rw) {
407
408 case FREAD:
409 /*
410 * Need to block timeouts (ttrstart).
411 */
412 s = spltty();
413 if ((tp->t_state&TS_ISOPEN) &&
414 tp->t_outq.c_cc && (tp->t_state&TS_TTSTOP) == 0) {
415 splx(s);
416 return (1);
417 }
418 splx(s);
419 /* FALLTHROUGH */
420
421 case 0: /* exceptional */
422 if ((tp->t_state&TS_ISOPEN) &&
423 (pti->pt_flags&PF_PKT && pti->pt_send ||
424 pti->pt_flags&PF_UCNTL && pti->pt_ucntl))
425 return (1);
426 selrecord(p, &pti->pt_selr);
427 break;
428
429
430 case FWRITE:
431 if (tp->t_state&TS_ISOPEN) {
432 if (pti->pt_flags & PF_REMOTE) {
433 if (tp->t_canq.c_cc == 0)
434 return (1);
435 } else {
436 if (tp->t_rawq.c_cc + tp->t_canq.c_cc < TTYHOG-2)
437 return (1);
438 if (tp->t_canq.c_cc == 0 && (tp->t_iflag&ICANON))
439 return (1);
440 }
441 }
442 selrecord(p, &pti->pt_selw);
443 break;
444
445 }
446 return (0);
447 }
448
449 ptcwrite(dev, uio, flag)
450 dev_t dev;
451 register struct uio *uio;
452 int flag;
453 {
454 register struct tty *tp = &pt_tty[minor(dev)];
455 register u_char *cp;
456 register int cc = 0;
457 u_char locbuf[BUFSIZ];
458 int cnt = 0;
459 struct pt_ioctl *pti = &pt_ioctl[minor(dev)];
460 int error = 0;
461
462 again:
463 if ((tp->t_state&TS_ISOPEN) == 0)
464 goto block;
465 if (pti->pt_flags & PF_REMOTE) {
466 if (tp->t_canq.c_cc)
467 goto block;
468 while (uio->uio_resid > 0 && tp->t_canq.c_cc < TTYHOG - 1) {
469 if (cc == 0) {
470 cc = min(uio->uio_resid, BUFSIZ);
471 cc = min(cc, TTYHOG - 1 - tp->t_canq.c_cc);
472 cp = locbuf;
473 error = uiomove((caddr_t)cp, cc, uio);
474 if (error)
475 return (error);
476 /* check again for safety */
477 if ((tp->t_state&TS_ISOPEN) == 0)
478 return (EIO);
479 }
480 if (cc)
481 (void) b_to_q((char *)cp, cc, &tp->t_canq);
482 cc = 0;
483 }
484 (void) putc(0, &tp->t_canq);
485 ttwakeup(tp);
486 wakeup((caddr_t)&tp->t_canq);
487 return (0);
488 }
489 while (uio->uio_resid > 0) {
490 if (cc == 0) {
491 cc = min(uio->uio_resid, BUFSIZ);
492 cp = locbuf;
493 error = uiomove((caddr_t)cp, cc, uio);
494 if (error)
495 return (error);
496 /* check again for safety */
497 if ((tp->t_state&TS_ISOPEN) == 0)
498 return (EIO);
499 }
500 while (cc > 0) {
501 if ((tp->t_rawq.c_cc + tp->t_canq.c_cc) >= TTYHOG - 2 &&
502 (tp->t_canq.c_cc > 0 || !(tp->t_iflag&ICANON))) {
503 wakeup((caddr_t)&tp->t_rawq);
504 goto block;
505 }
506 (*linesw[tp->t_line].l_rint)(*cp++, tp);
507 cnt++;
508 cc--;
509 }
510 cc = 0;
511 }
512 return (0);
513 block:
514 /*
515 * Come here to wait for slave to open, for space
516 * in outq, or space in rawq.
517 */
518 if ((tp->t_state&TS_CARR_ON) == 0)
519 return (EIO);
520 if (flag & IO_NDELAY) {
521 /* adjust for data copied in but not written */
522 uio->uio_resid += cc;
523 if (cnt == 0)
524 return (EWOULDBLOCK);
525 return (0);
526 }
527 if (error = tsleep((caddr_t)&tp->t_rawq.c_cf, TTOPRI | PCATCH,
528 ttyout, 0)) {
529 /* adjust for data copied in but not written */
530 uio->uio_resid += cc;
531 return (error);
532 }
533 goto again;
534 }
535
536 /*ARGSUSED*/
537 ptyioctl(dev, cmd, data, flag, p)
538 dev_t dev;
539 int cmd;
540 caddr_t data;
541 int flag;
542 struct proc *p;
543 {
544 register struct tty *tp = &pt_tty[minor(dev)];
545 register struct pt_ioctl *pti = &pt_ioctl[minor(dev)];
546 register u_char *cc = tp->t_cc;
547 int stop, error;
548
549 /*
550 * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
551 * ttywflush(tp) will hang if there are characters in the outq.
552 */
553 if (cmd == TIOCEXT) {
554 /*
555 * When the EXTPROC bit is being toggled, we need
556 * to send an TIOCPKT_IOCTL if the packet driver
557 * is turned on.
558 */
559 if (*(int *)data) {
560 if (pti->pt_flags & PF_PKT) {
561 pti->pt_send |= TIOCPKT_IOCTL;
562 ptcwakeup(tp, FREAD);
563 }
564 tp->t_lflag |= EXTPROC;
565 } else {
566 if ((tp->t_state & EXTPROC) &&
567 (pti->pt_flags & PF_PKT)) {
568 pti->pt_send |= TIOCPKT_IOCTL;
569 ptcwakeup(tp, FREAD);
570 }
571 tp->t_lflag &= ~EXTPROC;
572 }
573 return(0);
574 } else
575 if (cdevsw[major(dev)].d_open == ptcopen)
576 switch (cmd) {
577
578 case TIOCGPGRP:
579 /*
580 * We aviod calling ttioctl on the controller since,
581 * in that case, tp must be the controlling terminal.
582 */
583 *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
584 return (0);
585
586 case TIOCPKT:
587 if (*(int *)data) {
588 if (pti->pt_flags & PF_UCNTL)
589 return (EINVAL);
590 pti->pt_flags |= PF_PKT;
591 } else
592 pti->pt_flags &= ~PF_PKT;
593 return (0);
594
595 case TIOCUCNTL:
596 if (*(int *)data) {
597 if (pti->pt_flags & PF_PKT)
598 return (EINVAL);
599 pti->pt_flags |= PF_UCNTL;
600 } else
601 pti->pt_flags &= ~PF_UCNTL;
602 return (0);
603
604 case TIOCREMOTE:
605 if (*(int *)data)
606 pti->pt_flags |= PF_REMOTE;
607 else
608 pti->pt_flags &= ~PF_REMOTE;
609 ttyflush(tp, FREAD|FWRITE);
610 return (0);
611
612 #ifdef COMPAT_43
613 case TIOCSETP:
614 case TIOCSETN:
615 #endif
616 case TIOCSETD:
617 case TIOCSETA:
618 case TIOCSETAW:
619 case TIOCSETAF:
620 ndflush(&tp->t_outq, tp->t_outq.c_cc);
621 break;
622
623 case TIOCSIG:
624 if (*(unsigned int *)data >= NSIG)
625 return(EINVAL);
626 if ((tp->t_lflag&NOFLSH) == 0)
627 ttyflush(tp, FREAD|FWRITE);
628 pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
629 if ((*(unsigned int *)data == SIGINFO) &&
630 ((tp->t_lflag&NOKERNINFO) == 0))
631 ttyinfo(tp);
632 return(0);
633 }
634 error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
635 if (error < 0)
636 error = ttioctl(tp, cmd, data, flag);
637 if (error < 0) {
638 if (pti->pt_flags & PF_UCNTL &&
639 (cmd & ~0xff) == UIOCCMD(0)) {
640 if (cmd & 0xff) {
641 pti->pt_ucntl = (u_char)cmd;
642 ptcwakeup(tp, FREAD);
643 }
644 return (0);
645 }
646 error = ENOTTY;
647 }
648 /*
649 * If external processing and packet mode send ioctl packet.
650 */
651 if ((tp->t_lflag&EXTPROC) && (pti->pt_flags & PF_PKT)) {
652 switch(cmd) {
653 case TIOCSETA:
654 case TIOCSETAW:
655 case TIOCSETAF:
656 #ifdef COMPAT_43
657 case TIOCSETP:
658 case TIOCSETN:
659 #endif
660 #if defined(COMPAT_43) || defined(COMPAT_SUNOS)
661 case TIOCSETC:
662 case TIOCSLTC:
663 case TIOCLBIS:
664 case TIOCLBIC:
665 case TIOCLSET:
666 #endif
667 pti->pt_send |= TIOCPKT_IOCTL;
668 ptcwakeup(tp, FREAD);
669 default:
670 break;
671 }
672 }
673 stop = (tp->t_iflag & IXON) && CCEQ(cc[VSTOP], CTRL('s'))
674 && CCEQ(cc[VSTART], CTRL('q'));
675 if (pti->pt_flags & PF_NOSTOP) {
676 if (stop) {
677 pti->pt_send &= ~TIOCPKT_NOSTOP;
678 pti->pt_send |= TIOCPKT_DOSTOP;
679 pti->pt_flags &= ~PF_NOSTOP;
680 ptcwakeup(tp, FREAD);
681 }
682 } else {
683 if (!stop) {
684 pti->pt_send &= ~TIOCPKT_DOSTOP;
685 pti->pt_send |= TIOCPKT_NOSTOP;
686 pti->pt_flags |= PF_NOSTOP;
687 ptcwakeup(tp, FREAD);
688 }
689 }
690 return (error);
691 }
692