Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose underlying file's SyscallConn method. #17

Merged
merged 2 commits into from Jan 16, 2019

Conversation

@cpuguy83
Copy link
Contributor

@cpuguy83 cpuguy83 commented Jan 12, 2019

This allows raw access to the underlying FD, enabling things like
in-kernel copy methods such as splice and tee.

This interface was added to *os.File as part of go1.12beta2.

@cpuguy83
Copy link
Contributor Author

@cpuguy83 cpuguy83 commented Jan 12, 2019

@tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Jan 12, 2019

What if the underlying file is not opened yet. Should we return a mock one that unblocks when the opened channel closes?

@cpuguy83
Copy link
Contributor Author

@cpuguy83 cpuguy83 commented Jan 14, 2019

Ah just realized there is the non-blocking open.

@cpuguy83 cpuguy83 force-pushed the cpuguy83:add_raw_conn branch from f010780 to f29a888 Jan 15, 2019
This allows raw access to the underlying FD, enabling things like
in-kernel copy methods such as `splice` and `tee`.

This interface was added to `*os.File` as part of go1.12beta2.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 force-pushed the cpuguy83:add_raw_conn branch from f29a888 to 094bd06 Jan 15, 2019
@cpuguy83
Copy link
Contributor Author

@cpuguy83 cpuguy83 commented Jan 15, 2019

Updated, added new tests, updated CI to test on tip so that new tests will actually run.

@cpuguy83
Copy link
Contributor Author

@cpuguy83 cpuguy83 commented Jan 15, 2019

From travis run 😄

image

@cpuguy83 cpuguy83 force-pushed the cpuguy83:add_raw_conn branch from 0f317bf to 26c9412 Jan 15, 2019
raw.go Outdated
default:
}

if !f.block {

This comment has been minimized.

@tonistiigi

tonistiigi Jan 15, 2019
Member

if block was true then either closed or opened has to be closed at this point. Otherwise, it wouldn't be possible to get a handle on the *fifo

This comment has been minimized.

@cpuguy83

cpuguy83 Jan 15, 2019
Author Contributor

Good point.

This comment has been minimized.

@cpuguy83

cpuguy83 Jan 16, 2019
Author Contributor

Fixed.

raw.go Outdated

ready := make(chan struct{})
close(ready)
return &rawConn{f: f, raw: raw, ready: ready}, nil

This comment has been minimized.

@tonistiigi

tonistiigi Jan 15, 2019
Member

Why return a rawConn here?

This comment has been minimized.

@cpuguy83

cpuguy83 Jan 15, 2019
Author Contributor

Are you saying we should just return f.file.SyscallConn in this case?

At the moment rawConn is doing some of the same things on read/write that *fifo does.

This comment has been minimized.

@tonistiigi

tonistiigi Jan 15, 2019
Member

yes, if the file is already open it shouldn't matter and we can just use the file directly.

This comment has been minimized.

@cpuguy83

cpuguy83 Jan 16, 2019
Author Contributor

Fixed.

@cpuguy83 cpuguy83 force-pushed the cpuguy83:add_raw_conn branch from 26c9412 to 8997a18 Jan 15, 2019
Makes sure that tests for raw conns are actually run in CI.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@cpuguy83 cpuguy83 force-pushed the cpuguy83:add_raw_conn branch from 8997a18 to e4b84c0 Jan 16, 2019
@tonistiigi tonistiigi merged commit 650d792 into containerd:master Jan 16, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cpuguy83 cpuguy83 deleted the cpuguy83:add_raw_conn branch Jan 16, 2019
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Apr 14, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
thaJeztah added a commit to thaJeztah/docker that referenced this pull request Apr 14, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-jenkins pushed a commit to docker/docker-ce that referenced this pull request Apr 16, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 9234218c50dbe68e705fe0d48df718994ba97583
Component: engine
thaJeztah added a commit to thaJeztah/cli that referenced this pull request Apr 18, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-jenkins pushed a commit to docker/docker-ce that referenced this pull request Apr 18, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: ac234326a69116c7a311911276cc4df58b2c5e0a
Component: cli
tiborvass added a commit to tiborvass/cli that referenced this pull request Apr 23, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Kiku-Reise added a commit to Kiku-Reise/moby that referenced this pull request May 16, 2019
- containerd/fifo#17 Expose underlying file's `SyscallConn` method

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants