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

Projects
None yet
2 participants
@cpuguy83
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

cpuguy83 commented Jan 12, 2019

@tonistiigi

This comment has been minimized.

Copy link
Collaborator

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

This comment has been minimized.

Copy link
Contributor Author

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

Expose underlying file's `SyscallConn` method.
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

This comment has been minimized.

Copy link
Contributor Author

cpuguy83 commented Jan 15, 2019

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

@cpuguy83

This comment has been minimized.

Copy link
Contributor Author

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

Collaborator

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

Collaborator

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

Collaborator

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

Add tip to travis testing
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

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@cpuguy83 cpuguy83 deleted the cpuguy83:add_raw_conn branch Jan 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.