diff options
| author | Chris Denton <christophersdenton@gmail.com> | 2022-04-07 20:15:16 +0100 |
|---|---|---|
| committer | Chris Denton <christophersdenton@gmail.com> | 2022-04-07 20:34:55 +0100 |
| commit | 6a4b44426b7fd04592e618a93378510963ceda11 (patch) | |
| tree | d635b1fc5db070f6fafc67c410b7e4edda855b24 | |
| parent | dd38eea722c1f6f970a314435533e91cc2c14ffb (diff) | |
| download | rust-6a4b44426b7fd04592e618a93378510963ceda11.tar.gz rust-6a4b44426b7fd04592e618a93378510963ceda11.zip | |
Windows: Increase a pipe's buffer capacity to 64kb
This brings it inline with typical Linux defaults: https://www.man7.org/linux/man-pages/man7/pipe.7.html
| -rw-r--r-- | library/std/src/sys/windows/pipe.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/windows/pipe.rs index df4f1b24eec..09d1dd55989 100644 --- a/library/std/src/sys/windows/pipe.rs +++ b/library/std/src/sys/windows/pipe.rs @@ -53,6 +53,9 @@ pub struct Pipes { /// with `OVERLAPPED` instances, but also works out ok if it's only ever used /// once at a time (which we do indeed guarantee). pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Result<Pipes> { + // A 64kb pipe capacity is the same as a typical Linux default. + const PIPE_BUFFER_CAPACITY: u32 = 64 * 1024; + // Note that we specifically do *not* use `CreatePipe` here because // unfortunately the anonymous pipes returned do not support overlapped // operations. Instead, we create a "hopefully unique" name and create a @@ -91,8 +94,8 @@ pub fn anon_pipe(ours_readable: bool, their_handle_inheritable: bool) -> io::Res | c::PIPE_WAIT | reject_remote_clients_flag, 1, - 4096, - 4096, + PIPE_BUFFER_CAPACITY, + PIPE_BUFFER_CAPACITY, 0, ptr::null_mut(), ); |
