fcntl.2: Actual pipe capacity may in practice be less than nominal capacity

The number of bytes that can be written to the pipe may be less
(sometimes substantially less) than the nominal capacity. This
was confirmed with some testing. For example, when writing
4097-byte blocks to a pipe with 65536 byte capacity, only 45066
bytes could be written (i.e., 20470 bytes less than 65536).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-09-12 17:21:30 +02:00
parent f957eebd2d
commit d4dca6b626
1 changed files with 5 additions and 0 deletions

View File

@ -1375,6 +1375,11 @@ The actual capacity (in bytes) that is set is returned as the function result.
Attempting to set the pipe capacity smaller than the amount
of buffer space currently used to store data produces the error
.BR EBUSY .
.IP
Note that because of the way the pages of the pipe buffer
are employed when data is written to the pipe,
the number of bytes that can be written may be less than the nominal size,
depending on the size of the writes.
.TP
.BR F_GETPIPE_SZ " (\fIvoid\fP; since Linux 2.6.35)"
Return (as the function result) the capacity of the pipe referred to by