From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael Kerrisk (man-pages)" Subject: Re: [PATCH] document FIONREAD on pipe Date: Sun, 25 Sep 2016 12:10:28 +0200 Message-ID: <453f4338-96aa-63de-339f-ce53a44bebd3@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-man-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Patrick McLean Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, David Coles , Roderick Colenbrander List-Id: linux-man@vger.kernel.org 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