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
Member

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
Member Author

ping @tonistiigi

@tonistiigi
Copy link
Member

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
Member Author

Ah just realized there is the non-blocking open.

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
Copy link
Member Author

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

@cpuguy83
Copy link
Member Author

From travis run 😄

image

raw.go Outdated
default:
}

if !f.block {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

raw.go Outdated

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return a rawConn here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Makes sure that tests for raw conns are actually run in CI.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
@tonistiigi tonistiigi merged commit 650d792 into containerd:master Jan 16, 2019
@cpuguy83 cpuguy83 deleted the add_raw_conn branch January 16, 2019 00:37
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 pushed 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-jw pushed a commit to kiku-jw/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
Development

Successfully merging this pull request may close these issues.

None yet

2 participants