gvisor/pkg/buffer
Dean Deng 84f04909c2 Fix vfs2 pipe behavior when splicing to a non-pipe.
Fixes *.sh Java runtime tests, where splice()-ing from a pipe to /dev/zero
would not actually empty the pipe.

There was no guarantee that the data would actually be consumed on a splice
operation unless the output file's implementation of Write/PWrite actually
called VFSPipeFD.CopyIn. Now, whatever bytes are "written" are consumed
regardless of whether CopyIn is called or not.

Furthermore, the number of bytes in the IOSequence for reads is now capped at
the amount of data actually available. Before, splicing to /dev/zero would
always return the requested splice size without taking the actual available
data into account.

This change also refactors the case where an input file is spliced into an
output pipe so that it follows a similar pattern, which is arguably cleaner
anyway.

Updates #3576.

PiperOrigin-RevId: 328843954
2020-08-27 16:57:40 -07:00
..
BUILD Fix vfs2 pipe behavior when splicing to a non-pipe. 2020-08-27 16:57:40 -07:00
buffer.go Clean-up buffer implementation. 2020-03-11 19:52:14 -07:00
safemem.go Implement splice(2) and tee(2) for VFS2. 2020-05-26 21:43:26 -07:00
safemem_test.go Clean-up buffer implementation. 2020-03-11 19:52:14 -07:00
view.go Clean-up buffer implementation. 2020-03-11 19:52:14 -07:00
view_test.go Clean-up buffer implementation. 2020-03-11 19:52:14 -07:00
view_unsafe.go Make pipe buffer implementation standard. 2020-02-28 12:29:23 -08:00