Date: Sat, 13 Dec 2008 07:23:55 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186030 - head/sys/kern Message-ID: <200812130723.mBD7NtjM022201@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sat Dec 13 07:23:55 2008 New Revision: 186030 URL: http://svn.freebsd.org/changeset/base/186030 Log: Add FIONREAD to pseudo-terminal master devices. All ioctl()'s that aren't implemented by pts(4) are forwarded to the TTY itself. Unfortunately this is not correct for FIONREAD, because it will give the wrong amount of bytes that are available to read. Tested by: keramida Reminded by: keramida Modified: head/sys/kern/tty_pts.c Modified: head/sys/kern/tty_pts.c ============================================================================== --- head/sys/kern/tty_pts.c Sat Dec 13 07:03:16 2008 (r186029) +++ head/sys/kern/tty_pts.c Sat Dec 13 07:23:55 2008 (r186030) @@ -273,6 +273,16 @@ ptsdev_ioctl(struct file *fp, u_long cmd case FIONBIO: /* This device supports non-blocking operation. */ return (0); + case FIONREAD: + tty_lock(tp); + if (psc->pts_flags & PTS_FINISHED) { + /* Force read() to be called. */ + *(int *)data = 1; + } else { + *(int *)data = ttydisc_getc_poll(tp); + } + tty_unlock(tp); + return (0); case FIODGNAME: { struct fiodgname_arg *fgn; const char *p;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812130723.mBD7NtjM022201>