There is an ancient BSD ioctl(2) which might cover this case: FIONREAD. The 
point of it back in the day was to be able to know just how much data could be 
read from a file descriptor (e.g., from TTY input buffers) without blocking.

        Erik Fair

Reply via email to