diff options
author | Jamie Liu <jamieliu@google.com> | 2020-05-26 21:42:07 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-26 21:43:26 -0700 |
commit | af3121a52383fb60579d769994be5d91bd788015 (patch) | |
tree | 7ab26ef04f70f2bfa25433c262cfd0564a083af1 /pkg/sentry/kernel/pipe/pipe.go | |
parent | 8e2c5d951ea04f47ad1d37bab196a99fc56f5521 (diff) |
Implement splice(2) and tee(2) for VFS2.
Updates #138
PiperOrigin-RevId: 313326354
Diffstat (limited to 'pkg/sentry/kernel/pipe/pipe.go')
-rw-r--r-- | pkg/sentry/kernel/pipe/pipe.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/pipe/pipe.go b/pkg/sentry/kernel/pipe/pipe.go index 62c8691f1..79645d7d2 100644 --- a/pkg/sentry/kernel/pipe/pipe.go +++ b/pkg/sentry/kernel/pipe/pipe.go @@ -207,7 +207,10 @@ func (p *Pipe) read(ctx context.Context, ops readOps) (int64, error) { p.mu.Lock() defer p.mu.Unlock() + return p.readLocked(ctx, ops) +} +func (p *Pipe) readLocked(ctx context.Context, ops readOps) (int64, error) { // Is the pipe empty? if p.view.Size() == 0 { if !p.HasWriters() { @@ -246,7 +249,10 @@ type writeOps struct { func (p *Pipe) write(ctx context.Context, ops writeOps) (int64, error) { p.mu.Lock() defer p.mu.Unlock() + return p.writeLocked(ctx, ops) +} +func (p *Pipe) writeLocked(ctx context.Context, ops writeOps) (int64, error) { // Can't write to a pipe with no readers. if !p.HasReaders() { return 0, syscall.EPIPE |