-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add new API for annoymous pipe and named fifo #375
Comments
Since the API surface I proposed is a bit large, I think it makes sense to implement them separately, under different feature flags. |
As per the discussion on zulip, I've updated the API to be platform-independent instead of unix-specific, since windows, WASI and most of the other OSes seem to have annoymous pipe and named fifo support. |
We discussed this in the libs-api meeting. As you said, the API surface is a bit large, and we think it can be split up. We're happy to accept a subset: the API for anonymous pipes, without the (Linux) extension methods. However, instead of the The (Linux) extension methods and named pipes part of this ACP should be left for separate ACPs. |
Thanks, I've opened PR rust-lang/rust#127153 to add the anonymous pipe API |
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: rust-lang#127154 try-job: x86_64-msvc try-job: i686-mingw
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: #127154 try-job: x86_64-msvc try-job: i686-mingw
Opened #416 for named fifo |
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: #127154 try-job: x86_64-msvc try-job: i686-mingw
Proposal
Problem statement
Annoymous and named pipe are widely used, there is crate
os_pipe
which just provides an abstraction for pipe on unix and has 15 million download.While having a third-party crate for it is enough for many crates, I think it'd be better if it's in stdlib so that it can be used without having to another dependency for this.
It would also enable better integration with the
std::process
API, since users might want to pipe output of multiple processes to one pipe and read them.Motivating examples or use cases
jobserver-rs, for example, is used by cc-rs and pulled in as
build-dependencies
quite often.It internally implements all kinds of API for annoymous pipe and named fifo, contains a bunch of
unsafe
code for this and quite some code for just managing the pipe/fifo.It'd be great if we could move them to stdlib and make jobserver-rs easier to maintain.
It might also speedup jobserver-rs compilation since it could've drop the
libc
dependency.tokio, the widely used async executor, already provide pipe support in mod
tokio::net::unix::pipe
.Solution sketch
I suppose we can use os_pipe as basis and then add in more functions used by jobserver-rs, and functions provided by rustix:
The basic API for annoymous pipe:
The basic API for named fifo:
Extension methods for unix:
Extension methods for Linux:
Alternatives
Alternatively, we could first implement a subset of the API I proposed here to reduce the scope.
Then we could consider adding more methods that are needed.
Or we could just leave them up to third-party crates, which is the current status-quo, which is OK-ish but not good enough
for users who need pipe/fifo, they would have to grab a third-party crate for this.
Links and related work
tokio::net::unix::pipe
rustix::pipe
The text was updated successfully, but these errors were encountered: