33c33
< __FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 135298 2004-09-16 12:07:25Z phk $");
---
> __FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 135622 2004-09-23 16:13:46Z phk $");
72c72
< static d_ioctl_t ptyioctl;
---
> static d_ioctl_t ptsioctl;
75a76
> static d_ioctl_t ptcioctl;
86c87
< .d_ioctl = ptyioctl,
---
> .d_ioctl = ptsioctl,
99c100
< .d_ioctl = ptyioctl,
---
> .d_ioctl = ptcioctl,
522c523
< ptyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
---
> ptcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
526,527d526
< u_char *cc = tp->t_cc;
< int stop, error;
529,530c528
< if (devsw(dev)->d_open == ptcopen) {
< switch (cmd) {
---
> switch (cmd) {
532,538c530,536
< case TIOCGPGRP:
< /*
< * We avoid calling ttioctl on the controller since,
< * in that case, tp must be the controlling terminal.
< */
< *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
< return (0);
---
> case TIOCGPGRP:
> /*
> * We avoid calling ttioctl on the controller since,
> * in that case, tp must be the controlling terminal.
> */
> *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
> return (0);
540,547c538,545
< case TIOCPKT:
< if (*(int *)data) {
< if (pt->pt_flags & PF_UCNTL)
< return (EINVAL);
< pt->pt_flags |= PF_PKT;
< } else
< pt->pt_flags &= ~PF_PKT;
< return (0);
---
> case TIOCPKT:
> if (*(int *)data) {
> if (pt->pt_flags & PF_UCNTL)
> return (EINVAL);
> pt->pt_flags |= PF_PKT;
> } else
> pt->pt_flags &= ~PF_PKT;
> return (0);
549,557c547,555
< case TIOCUCNTL:
< if (*(int *)data) {
< if (pt->pt_flags & PF_PKT)
< return (EINVAL);
< pt->pt_flags |= PF_UCNTL;
< } else
< pt->pt_flags &= ~PF_UCNTL;
< return (0);
< }
---
> case TIOCUCNTL:
> if (*(int *)data) {
> if (pt->pt_flags & PF_PKT)
> return (EINVAL);
> pt->pt_flags |= PF_UCNTL;
> } else
> pt->pt_flags &= ~PF_UCNTL;
> return (0);
> }
559,564c557,562
< /*
< * The rest of the ioctls shouldn't be called until
< * the slave is open.
< */
< if ((tp->t_state & TS_ISOPEN) == 0)
< return (EAGAIN);
---
> /*
> * The rest of the ioctls shouldn't be called until
> * the slave is open.
> */
> if ((tp->t_state & TS_ISOPEN) == 0)
> return (EAGAIN);
566c564
< switch (cmd) {
---
> switch (cmd) {
569,570c567,568
< case TIOCSETP:
< case TIOCSETN:
---
> case TIOCSETP:
> case TIOCSETN:
573,583c571,581
< case TIOCSETD:
< case TIOCSETA:
< case TIOCSETAW:
< case TIOCSETAF:
< /*
< * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
< * ttywflush(tp) will hang if there are characters in
< * the outq.
< */
< ndflush(&tp->t_outq, tp->t_outq.c_cc);
< break;
---
> case TIOCSETD:
> case TIOCSETA:
> case TIOCSETAW:
> case TIOCSETAF:
> /*
> * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
> * ttywflush(tp) will hang if there are characters in
> * the outq.
> */
> ndflush(&tp->t_outq, tp->t_outq.c_cc);
> break;
585,599c583,592
< case TIOCSIG:
< if (*(unsigned int *)data >= NSIG ||
< *(unsigned int *)data == 0)
< return(EINVAL);
< if ((tp->t_lflag&NOFLSH) == 0)
< ttyflush(tp, FREAD|FWRITE);
< if (tp->t_pgrp != NULL) {
< PGRP_LOCK(tp->t_pgrp);
< pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
< PGRP_UNLOCK(tp->t_pgrp);
< }
< if ((*(unsigned int *)data == SIGINFO) &&
< ((tp->t_lflag&NOKERNINFO) == 0))
< ttyinfo(tp);
< return(0);
---
> case TIOCSIG:
> if (*(unsigned int *)data >= NSIG ||
> *(unsigned int *)data == 0)
> return(EINVAL);
> if ((tp->t_lflag&NOFLSH) == 0)
> ttyflush(tp, FREAD|FWRITE);
> if (tp->t_pgrp != NULL) {
> PGRP_LOCK(tp->t_pgrp);
> pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
> PGRP_UNLOCK(tp->t_pgrp);
600a594,597
> if ((*(unsigned int *)data == SIGINFO) &&
> ((tp->t_lflag&NOKERNINFO) == 0))
> ttyinfo(tp);
> return(0);
601a599,611
>
> return (ptsioctl(dev, cmd, data, flag, td));
> }
>
> /*ARGSUSED*/
> static int
> ptsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
> {
> struct tty *tp = dev->si_tty;
> struct ptsc *pt = dev->si_drv1;
> u_char *cc = tp->t_cc;
> int stop, error;
>
< __FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 135298 2004-09-16 12:07:25Z phk $");
---
> __FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 135622 2004-09-23 16:13:46Z phk $");
72c72
< static d_ioctl_t ptyioctl;
---
> static d_ioctl_t ptsioctl;
75a76
> static d_ioctl_t ptcioctl;
86c87
< .d_ioctl = ptyioctl,
---
> .d_ioctl = ptsioctl,
99c100
< .d_ioctl = ptyioctl,
---
> .d_ioctl = ptcioctl,
522c523
< ptyioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
---
> ptcioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
526,527d526
< u_char *cc = tp->t_cc;
< int stop, error;
529,530c528
< if (devsw(dev)->d_open == ptcopen) {
< switch (cmd) {
---
> switch (cmd) {
532,538c530,536
< case TIOCGPGRP:
< /*
< * We avoid calling ttioctl on the controller since,
< * in that case, tp must be the controlling terminal.
< */
< *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
< return (0);
---
> case TIOCGPGRP:
> /*
> * We avoid calling ttioctl on the controller since,
> * in that case, tp must be the controlling terminal.
> */
> *(int *)data = tp->t_pgrp ? tp->t_pgrp->pg_id : 0;
> return (0);
540,547c538,545
< case TIOCPKT:
< if (*(int *)data) {
< if (pt->pt_flags & PF_UCNTL)
< return (EINVAL);
< pt->pt_flags |= PF_PKT;
< } else
< pt->pt_flags &= ~PF_PKT;
< return (0);
---
> case TIOCPKT:
> if (*(int *)data) {
> if (pt->pt_flags & PF_UCNTL)
> return (EINVAL);
> pt->pt_flags |= PF_PKT;
> } else
> pt->pt_flags &= ~PF_PKT;
> return (0);
549,557c547,555
< case TIOCUCNTL:
< if (*(int *)data) {
< if (pt->pt_flags & PF_PKT)
< return (EINVAL);
< pt->pt_flags |= PF_UCNTL;
< } else
< pt->pt_flags &= ~PF_UCNTL;
< return (0);
< }
---
> case TIOCUCNTL:
> if (*(int *)data) {
> if (pt->pt_flags & PF_PKT)
> return (EINVAL);
> pt->pt_flags |= PF_UCNTL;
> } else
> pt->pt_flags &= ~PF_UCNTL;
> return (0);
> }
559,564c557,562
< /*
< * The rest of the ioctls shouldn't be called until
< * the slave is open.
< */
< if ((tp->t_state & TS_ISOPEN) == 0)
< return (EAGAIN);
---
> /*
> * The rest of the ioctls shouldn't be called until
> * the slave is open.
> */
> if ((tp->t_state & TS_ISOPEN) == 0)
> return (EAGAIN);
566c564
< switch (cmd) {
---
> switch (cmd) {
569,570c567,568
< case TIOCSETP:
< case TIOCSETN:
---
> case TIOCSETP:
> case TIOCSETN:
573,583c571,581
< case TIOCSETD:
< case TIOCSETA:
< case TIOCSETAW:
< case TIOCSETAF:
< /*
< * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
< * ttywflush(tp) will hang if there are characters in
< * the outq.
< */
< ndflush(&tp->t_outq, tp->t_outq.c_cc);
< break;
---
> case TIOCSETD:
> case TIOCSETA:
> case TIOCSETAW:
> case TIOCSETAF:
> /*
> * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
> * ttywflush(tp) will hang if there are characters in
> * the outq.
> */
> ndflush(&tp->t_outq, tp->t_outq.c_cc);
> break;
585,599c583,592
< case TIOCSIG:
< if (*(unsigned int *)data >= NSIG ||
< *(unsigned int *)data == 0)
< return(EINVAL);
< if ((tp->t_lflag&NOFLSH) == 0)
< ttyflush(tp, FREAD|FWRITE);
< if (tp->t_pgrp != NULL) {
< PGRP_LOCK(tp->t_pgrp);
< pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
< PGRP_UNLOCK(tp->t_pgrp);
< }
< if ((*(unsigned int *)data == SIGINFO) &&
< ((tp->t_lflag&NOKERNINFO) == 0))
< ttyinfo(tp);
< return(0);
---
> case TIOCSIG:
> if (*(unsigned int *)data >= NSIG ||
> *(unsigned int *)data == 0)
> return(EINVAL);
> if ((tp->t_lflag&NOFLSH) == 0)
> ttyflush(tp, FREAD|FWRITE);
> if (tp->t_pgrp != NULL) {
> PGRP_LOCK(tp->t_pgrp);
> pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
> PGRP_UNLOCK(tp->t_pgrp);
600a594,597
> if ((*(unsigned int *)data == SIGINFO) &&
> ((tp->t_lflag&NOKERNINFO) == 0))
> ttyinfo(tp);
> return(0);
601a599,611
>
> return (ptsioctl(dev, cmd, data, flag, td));
> }
>
> /*ARGSUSED*/
> static int
> ptsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
> {
> struct tty *tp = dev->si_tty;
> struct ptsc *pt = dev->si_drv1;
> u_char *cc = tp->t_cc;
> int stop, error;
>