Lines Matching defs:pty
51 extern struct pty *pty_softc;
68 struct pty *pty, mblk_t **mpp);
170 (void) sprintf(name, "pty%c%c", *pty_bank, *pty_digit);
249 struct pty *pty;
255 pty = &pty_softc[getminor(dev)];
256 mutex_enter(&pty->ptc_lock);
257 if (pty->pt_flags & PF_CARR_ON) {
258 mutex_exit(&pty->ptc_lock);
262 if (pty->pt_flags & PF_WOPEN) {
263 pty->pt_flags &= ~PF_WOPEN;
264 cv_broadcast(&pty->pt_cv_flags);
267 if ((q = pty->pt_ttycommon.t_readq) != NULL) {
275 pty->pt_flags |= PF_CARR_ON;
276 pty->pt_send = 0;
277 pty->pt_ucntl = 0;
279 mutex_exit(&pty->ptc_lock);
287 struct pty *pty;
291 pty = &pty_softc[getminor(dev)];
293 mutex_enter(&pty->ptc_lock);
294 if ((q = pty->pt_ttycommon.t_readq) != NULL) {
307 pty->pt_flags &= (PF_WOPEN|PF_STOPPED|PF_NOSTOP);
308 while ((bp = pty->pt_stuffqfirst) != NULL) {
309 if ((pty->pt_stuffqfirst = bp->b_next) == NULL)
310 pty->pt_stuffqlast = NULL;
312 pty->pt_stuffqfirst->b_prev = NULL;
313 pty->pt_stuffqlen--;
317 mutex_exit(&pty->ptc_lock);
324 struct pty *pty = &pty_softc[getminor(dev)];
338 mutex_enter(&pty->ptc_lock);
341 while (pty->pt_flags & PF_READ) {
342 pty->pt_flags |= PF_WREAD;
343 cv_wait(&pty->pt_cv_flags, &pty->ptc_lock);
345 pty->pt_flags |= PF_READ;
350 while (pty->pt_flags&(PF_PKT|PF_UCNTL) && pty->pt_send) {
351 tmp = pty->pt_send;
352 pty->pt_send = 0;
353 mutex_exit(&pty->ptc_lock);
356 mutex_enter(&pty->ptc_lock);
358 pty->pt_send |= tmp;
361 if (pty->pt_send == 0)
369 while ((pty->pt_flags & (PF_UCNTL|PF_43UCNTL)) &&
370 pty->pt_ucntl) {
371 tmp = pty->pt_ucntl;
372 pty->pt_ucntl = 0;
373 mutex_exit(&pty->ptc_lock);
376 mutex_enter(&pty->ptc_lock);
378 if (pty->pt_ucntl == 0)
379 pty->pt_ucntl = tmp;
382 if (pty->pt_ucntl == 0)
389 if ((q = pty->pt_ttycommon.t_writeq) != NULL &&
391 !(pty->pt_flags & PF_STOPPED)) {
392 if (pty->pt_flags & (PF_PKT|PF_UCNTL|PF_43UCNTL)) {
398 mutex_exit(&pty->ptc_lock);
401 mutex_enter(&pty->ptc_lock);
404 if ((q = pty->pt_ttycommon.t_writeq) == NULL)
420 mutex_exit(&pty->ptc_lock);
424 mutex_enter(&pty->ptc_lock);
429 q = pty->pt_ttycommon.t_writeq;
454 if (pty->pt_flags&PF_UCNTL && pty->pt_stuffqfirst != NULL) {
455 mutex_exit(&pty->ptc_lock);
457 mutex_enter(&pty->ptc_lock);
459 (bp = pty->pt_stuffqfirst) != NULL &&
461 pty->pt_stuffqlen--;
462 if ((pty->pt_stuffqfirst = bp->b_next) == NULL)
463 pty->pt_stuffqlast = NULL;
465 pty->pt_stuffqfirst->b_prev = NULL;
466 mutex_exit(&pty->ptc_lock);
470 mutex_enter(&pty->ptc_lock);
485 if (pty->pt_flags & PF_SLAVEGONE) {
493 if (pty->pt_flags & PF_NBIO) {
500 if (pty->pt_flags & PF_WREAD)
501 cv_broadcast(&pty->pt_cv_flags);
503 pty->pt_flags &= ~(PF_READ | PF_WREAD);
506 if (!cv_wait_sig(&pty->pt_cv_writeq, &pty->ptc_lock)) {
507 mutex_exit(&pty->ptc_lock);
513 if (pty->pt_flags & PF_WREAD)
514 cv_broadcast(&pty->pt_cv_flags);
516 pty->pt_flags &= ~(PF_READ | PF_WREAD);
518 mutex_exit(&pty->ptc_lock);
525 struct pty *pty = &pty_softc[getminor(dev)];
540 mutex_enter(&pty->ptc_lock);
543 while (pty->pt_flags & PF_WRITE) {
544 pty->pt_flags |= PF_WWRITE;
545 cv_wait(&pty->pt_cv_flags, &pty->ptc_lock);
548 pty->pt_flags |= PF_WRITE;
550 if ((q = pty->pt_ttycommon.t_readq) == NULL) {
555 if (pty->pt_flags & PF_SLAVEGONE) {
563 if (pty->pt_flags & PF_NBIO) {
570 if (pty->pt_flags & PF_WWRITE)
571 cv_broadcast(&pty->pt_cv_flags);
573 pty->pt_flags &= ~(PF_WRITE | PF_WWRITE);
575 if (!cv_wait_sig(&pty->pt_cv_readq, &pty->ptc_lock)) {
576 mutex_exit(&pty->ptc_lock);
587 if ((pty->pt_flags & PF_REMOTE) || uio->uio_resid > 0) {
593 if (pty->pt_flags & PF_SLAVEGONE) {
602 if (pty->pt_flags & PF_NBIO) {
610 if (pty->pt_flags & PF_WWRITE)
611 cv_broadcast(&pty->pt_cv_flags);
613 pty->pt_flags &= ~(PF_WRITE | PF_WWRITE);
615 if (!cv_wait_sig(&pty->pt_cv_readq,
616 &pty->ptc_lock)) {
617 mutex_exit(&pty->ptc_lock);
621 while (pty->pt_flags & PF_WRITE) {
622 pty->pt_flags |= PF_WWRITE;
623 cv_wait(&pty->pt_cv_flags,
624 &pty->ptc_lock);
627 pty->pt_flags |= PF_WRITE;
630 if ((pty->pt_flags & PF_NBIO) &&
636 error = makemsg(uio->uio_resid, uio, pty, &mp);
648 if (pty->pt_flags & PF_NBIO) {
665 if ((q = pty->pt_ttycommon.t_readq) == NULL) {
677 if (pty->pt_flags & PF_WWRITE)
678 cv_broadcast(&pty->pt_cv_flags);
680 pty->pt_flags &= ~(PF_WRITE | PF_WWRITE);
682 mutex_exit(&pty->ptc_lock);
698 struct pty *pty = &pty_softc[getminor(dev)];
709 mutex_enter(&pty->ptc_lock);
711 if (pty->pt_flags & (PF_UCNTL|PF_43UCNTL)) {
712 mutex_exit(&pty->ptc_lock);
715 pty->pt_flags |= PF_PKT;
717 pty->pt_flags &= ~PF_PKT;
718 mutex_exit(&pty->ptc_lock);
723 mutex_enter(&pty->ptc_lock);
725 if (pty->pt_flags & (PF_PKT|PF_UCNTL)) {
726 mutex_exit(&pty->ptc_lock);
729 pty->pt_flags |= PF_43UCNTL;
731 pty->pt_flags &= ~PF_43UCNTL;
732 mutex_exit(&pty->ptc_lock);
737 mutex_enter(&pty->ptc_lock);
739 if (pty->pt_flags & PF_PKT) {
740 mutex_exit(&pty->ptc_lock);
743 pty->pt_flags |= PF_UCNTL;
745 pty->pt_flags &= ~PF_UCNTL;
746 mutex_exit(&pty->ptc_lock);
751 mutex_enter(&pty->ptc_lock);
753 if ((q = pty->pt_ttycommon.t_readq) != NULL)
755 pty->pt_flags |= PF_REMOTE;
757 if ((q = pty->pt_ttycommon.t_readq) != NULL)
759 pty->pt_flags &= ~PF_REMOTE;
761 mutex_exit(&pty->ptc_lock);
770 mutex_enter(&pty->ptc_lock);
771 if ((q = pty->pt_ttycommon.t_readq) != NULL)
773 mutex_exit(&pty->ptc_lock);
778 mutex_enter(&pty->ptc_lock);
780 pty->pt_flags |= PF_NBIO;
782 pty->pt_flags &= ~PF_NBIO;
783 mutex_exit(&pty->ptc_lock);
788 mutex_enter(&pty->ptc_lock);
790 pty->pt_flags |= PF_ASYNC;
792 pty->pt_flags &= ~PF_ASYNC;
793 mutex_exit(&pty->ptc_lock);
801 mutex_enter(&pty->ptc_lock);
802 d_arg = -pty->pt_pgrp;
803 mutex_exit(&pty->ptc_lock);
809 mutex_enter(&pty->ptc_lock);
810 pty->pt_pgrp = (short)(-d_arg);
811 mutex_exit(&pty->ptc_lock);
823 mutex_enter(&pty->ptc_lock);
824 if (pty->pt_flags&(PF_PKT|PF_UCNTL) && pty->pt_send)
826 else if ((pty->pt_flags & (PF_UCNTL|PF_43UCNTL)) &&
827 pty->pt_ucntl)
829 else if ((q = pty->pt_ttycommon.t_writeq) != NULL &&
830 q->q_first != NULL && !(pty->pt_flags & PF_STOPPED)) {
836 } else if ((pty->pt_flags & PF_UCNTL) &&
837 pty->pt_stuffqfirst != NULL) {
841 count = pty->pt_stuffqlen + 1;
849 mutex_exit(&pty->ptc_lock);
871 mutex_enter(&pty->ptc_lock);
875 if (bcmp(&pty->pt_ttycommon.t_size,
877 pty->pt_ttycommon.t_size = win_arg;
878 if ((q = pty->pt_ttycommon.t_readq) != NULL)
881 mutex_exit(&pty->ptc_lock);
890 mutex_enter(&pty->ptc_lock);
891 pty->pt_ttycommon.t_size.ws_row = (ushort_t)tty_arg.ts_lines;
892 pty->pt_ttycommon.t_size.ws_col = (ushort_t)tty_arg.ts_cols;
893 pty->pt_ttycommon.t_size.ws_xpixel = 0;
894 pty->pt_ttycommon.t_size.ws_ypixel = 0;
895 mutex_exit(&pty->ptc_lock);
899 mutex_enter(&pty->ptc_lock);
900 win_arg = pty->pt_ttycommon.t_size;
901 mutex_exit(&pty->ptc_lock);
908 mutex_enter(&pty->ptc_lock);
909 tty_arg.ts_lines = pty->pt_ttycommon.t_size.ws_row;
910 tty_arg.ts_cols = pty->pt_ttycommon.t_size.ws_col;
911 mutex_exit(&pty->ptc_lock);
953 mutex_enter(&pty->ptc_lock);
954 if (pty->pt_vnode == NULL) {
955 mutex_exit(&pty->ptc_lock);
958 pty->pt_flags |= PF_IOCTL;
959 mutex_exit(&pty->ptc_lock);
960 err = strioctl(pty->pt_vnode, cmd, data, flag,
962 mutex_enter(&pty->ptc_lock);
963 if (pty->pt_flags & PF_WAIT)
964 cv_signal(&pty->pt_cv_flags);
965 pty->pt_flags &= ~(PF_IOCTL|PF_WAIT);
966 mutex_exit(&pty->ptc_lock);
984 struct pty *pty = &pty_softc[getminor(dev)];
992 if (polllock(php, &pty->ptc_lock) != 0) {
997 ASSERT(MUTEX_HELD(&pty->ptc_lock));
1000 if (pty->pt_flags & PF_SLAVEGONE) {
1005 mutex_exit(&pty->ptc_lock);
1014 if ((q = pty->pt_ttycommon.t_writeq) != NULL &&
1015 q->q_first != NULL && !(pty->pt_flags & PF_STOPPED)) {
1022 if (pty->pt_flags & (PF_PKT|PF_UCNTL) && pty->pt_send) {
1029 if ((pty->pt_flags & PF_UCNTL) &&
1030 (pty->pt_ucntl || pty->pt_stuffqfirst != NULL)) {
1037 if ((pty->pt_flags & PF_43UCNTL) && pty->pt_ucntl) {
1043 if ((q = pty->pt_ttycommon.t_readq) != NULL &&
1054 if (((pty->pt_flags & (PF_PKT|PF_UCNTL)) && pty->pt_send) ||
1055 ((pty->pt_flags & PF_UCNTL) &&
1056 (pty->pt_ucntl || pty->pt_stuffqfirst != NULL))) {
1059 if ((pty->pt_flags & PF_43UCNTL) && pty->pt_ucntl) {
1073 mutex_exit(&pty->ptc_lock);
1094 makemsg(ssize_t count, struct uio *uiop, struct pty *pty, mblk_t **mpp)
1100 ASSERT(MUTEX_HELD(&pty->ptc_lock));
1111 mutex_exit(&pty->ptc_lock);
1113 mutex_enter(&pty->ptc_lock);