Hello Patrick
On 09/24/2016 12:17 AM, Patrick McLean wrote:
The FIONREAD ioctl can be used on a pipe to get the current amount of
data in the pipe. This ioctl is currently only documented in tty_ioctl
(4). This adds a blurb to the pipe(7) man page about this ioctl.
Thanks for the patch. In the end, I wrote something more extensive.
See below.
Cheers,
Michael
diff --git a/man7/pipe.7 b/man7/pipe.7
index 9977acc..b6a3007 100644
--- a/man7/pipe.7
+++ b/man7/pipe.7
@@ -143,6 +143,21 @@ operations.
See
.BR fcntl (2)
for more information.
+
+The following
+.BR ioctl (2)
+operation, which can be applied to a file descriptor
+that refers to either end of a pipe,
+places a count of the number of unread bytes in the pipe in the
+.I int
+buffer pointed to by the final argument of the call:
+
+ ioctl(fd, FIONREAD, &nbytes);
+
+The
+.B FIONREAD
+operation is not specified in any standard,
+but is provided on many implementations.
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html