summaryrefslogtreecommitdiffhomepage
path: root/pkg/buffer
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2020-08-27 16:52:21 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-27 16:57:40 -0700
commit84f04909c2c3a55b209f01315493e6850160d707 (patch)
tree38da40c809f0ec170f3b97f362fcbe4215e2801b /pkg/buffer
parentdc008fbbccf69deba55fd7649424bc568f766596 (diff)
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
Diffstat (limited to 'pkg/buffer')
-rw-r--r--pkg/buffer/BUILD2
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/buffer/BUILD b/pkg/buffer/BUILD
index dcd086298..b03d46d18 100644
--- a/pkg/buffer/BUILD
+++ b/pkg/buffer/BUILD
@@ -26,8 +26,10 @@ go_library(
],
visibility = ["//visibility:public"],
deps = [
+ "//pkg/context",
"//pkg/log",
"//pkg/safemem",
+ "//pkg/usermem",
],
)