public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] document FIONREAD on pipe
@ 2016-09-23 22:17 Patrick McLean
       [not found] ` <CAE2NFgU-hfRvNBxDBhN9=QpZ2AVwmNxx-kCXNajcRv0wfrwYPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick McLean @ 2016-09-23 22:17 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, David Coles,
	Roderick Colenbrander

[-- Attachment #1: Type: text/plain, Size: 206 bytes --]

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.

[-- Attachment #2: man-pages-document-FIONREAD-on-pipe.patch --]
[-- Type: text/x-patch, Size: 427 bytes --]

diff --git a/man7/pipe.7 b/man7/pipe.7
index 9977acc..d43671b 100644
--- a/man7/pipe.7
+++ b/man7/pipe.7
@@ -143,6 +143,17 @@ operations.
 See
 .BR fcntl (2)
 for more information.
+
+The current amount of data waiting in a pipe can be queried with the
+.BR ioctl (2)
+operation
+.BR FIONREAD .
+See
+.BR ioctl (2)
+and
+.BR tty_ioctl (4)
+for more information on usage of
+.BR FIONREAD .
 .\"
 .SS PIPE_BUF
 POSIX.1 says that

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] document FIONREAD on pipe
       [not found] ` <CAE2NFgU-hfRvNBxDBhN9=QpZ2AVwmNxx-kCXNajcRv0wfrwYPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-09-25 10:10   ` Michael Kerrisk (man-pages)
       [not found]     ` <453f4338-96aa-63de-339f-ce53a44bebd3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-09-25 10:10 UTC (permalink / raw)
  To: Patrick McLean
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w,
	linux-man-u79uwXL29TY76Z2rM5mHXA, David Coles,
	Roderick Colenbrander

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] document FIONREAD on pipe
       [not found]     ` <453f4338-96aa-63de-339f-ce53a44bebd3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-09-26 20:18       ` Patrick McLean
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick McLean @ 2016-09-26 20:18 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages)
  Cc: linux-man-u79uwXL29TY76Z2rM5mHXA, David Coles,
	Roderick Colenbrander

That sounds good to me, thanks.

On Sun, Sep 25, 2016 at 3:10 AM, Michael Kerrisk (man-pages)
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-26 20:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 22:17 [PATCH] document FIONREAD on pipe Patrick McLean
     [not found] ` <CAE2NFgU-hfRvNBxDBhN9=QpZ2AVwmNxx-kCXNajcRv0wfrwYPQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-25 10:10   ` Michael Kerrisk (man-pages)
     [not found]     ` <453f4338-96aa-63de-339f-ce53a44bebd3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-09-26 20:18       ` Patrick McLean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox