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
This commit is contained in:
parent
0a3604e155
commit
d4892ee51e
@ -273,6 +273,16 @@ ptsdev_ioctl(struct file *fp, u_long cmd, void *data,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user