Add FIONWRITE support to TTYs.

TTYs already supported TIOCOUTQ, but FIONWRITE seems to be a more
generic name for this.

Approved by:	re (kib)
This commit is contained in:
Ed Schouten 2009-06-28 12:02:15 +00:00
parent f5d7126306
commit f9bb1cf010

View File

@ -1341,6 +1341,10 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, struct thread *td)
case FIONREAD:
*(int *)data = ttyinq_bytescanonicalized(&tp->t_inq);
return (0);
case FIONWRITE:
case TIOCOUTQ:
*(int *)data = ttyoutq_bytesused(&tp->t_outq);
return (0);
case FIOSETOWN:
if (tp->t_session != NULL && !tty_is_ctty(tp, td->td_proc))
/* Not allowed to set ownership. */
@ -1603,9 +1607,6 @@ tty_generic_ioctl(struct tty *tp, u_long cmd, void *data, struct thread *td)
case TIOCNXCL:
tp->t_flags &= ~TF_EXCLUDE;
return (0);
case TIOCOUTQ:
*(unsigned int *)data = ttyoutq_bytesused(&tp->t_outq);
return (0);
case TIOCSTOP:
tp->t_flags |= TF_STOPPED;
ttydevsw_pktnotify(tp, TIOCPKT_STOP);