Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to
throw away output quickly. This tries to remain true to 4.4BSD
behavior (since that was the origin of this feature), with any
corrections NetBSD has done. Since the implemenations are a little
different, though, some edge conditions may be handled differently.
Details
- Reviewers
kevans markj kib - Commits
- rS364855: Implement FLUSHO
find /
^O a few times to see the output start / stop.
Allow it to finish and make sure output starts again...
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 33100 Build 30471: arc lint + arc unit
Event Timeline
sys/kern/tty_ttydisc.c | ||
---|---|---|
478 | I don't think so. I think that tty devices are not seek able. I know we set that for pts. I'm unsure how this gets set for the ttys though. NetBSD and 4.4BSD don't bother to update it.I think we're fine not updating either. | |
929 | I wasn't sure, but I just looked. It reprints the raw buffer, ala ^R. I need to chase down the details in FreeBSD... |
Update per comments from kib@ and my comparison to 4.4BSD and NetBSD's
implementations. We should be closer in edge cases to historic behavior,
if not actually match historic behavior.
sys/kern/tty_ttydisc.c | ||
---|---|---|
929 | retype turned out to be a mis-reading of the netbsd source, it was ttyreprint there. Oops. Though it's good I botched it since I should be doing the right thing here now. |
sys/kern/tty_ttydisc.c | ||
---|---|---|
478 | Devices are seekable. There is a corner case of SEEK_END on non-disk devices (or rather devices not supporting DIOCGMEDIASIZE), but other than that, D_SEEKABLE is set on devfd fds. uiomove(9) call in non-Ctrl-O case does update uio_offset. | |
929 | I see what is it. But does it make sense to retype when we enable discard, or on clearing discard ? I actually do not see why not doing it on both. |
sys/kern/tty_ttydisc.c | ||
---|---|---|
929 | 4.4BSD did it when we enabled discard, but not when it was disabled. Mostly, I think, because the input would quickly scroll away if there was a lot of output that had been suppressed, so would basically be useless for the use case of this. 4.4BSD is the first release to have this feature (though it appeared in 4.3BSD-RENO in the same form it was released in 4.4BSD). I retained that behavior and am leaning towards retaining it for the reason I mentioned. |
sys/kern/tty_ttydisc.c | ||
---|---|---|
930 | Is it supposed to be ttydisc_reprint_char()? |
sys/kern/tty_ttydisc.c | ||
---|---|---|
930 | No. It shouldn't have the arguments in a previous version. |
Ping? Are people OK with implementing 4.4BSD behavior, or do I need to the re-echo twice?
sys/kern/tty_ttydisc.c | ||
---|---|---|
478 | I think if we're going to update uio_offset here, we have other places in this function this needs to be evaluated at as well that aren't being done currently. e.g. if we bail out of the inner loop near the end (EWOULDBLOCK / tty_wait) then (IIRC) we've done a partial write but not properly accounted for this in uio_offset. |
sys/kern/tty_ttydisc.c | ||
---|---|---|
478 | I agree. And another place is tty_gone/ENXIO which is also worth fixing then. I am not sure, but my preference would be to make two places added by this commit, correct. And add missing updates later, I can do it. Or I can fix them all. Other than uio_offset stuff, the patch looks fine to me. |
Update per kib/kevans review. Fixed the things I added, but didn't try
to do them all that were pre-existing.