Use Environment.SystemPageSize to set desireBufferSize (#40247)
authorSUN Guoyun <40024232+sunny868@users.noreply.github.com>
Mon, 3 Aug 2020 23:11:05 +0000 (07:11 +0800)
committerGitHub <noreply@github.com>
Mon, 3 Aug 2020 23:11:05 +0000 (16:11 -0700)
PAGE_SIZE is not all 4096 for all architecture, so we can get it by Environment.SystemPageSize

Co-authored-by: Sunguoyun <sunguoyun@loongson.cn>
src/libraries/System.IO.Pipes/tests/AnonymousPipeTests/AnonymousPipeTest.Specific.cs

index 4dd1018..f7ef3d6 100644 (file)
@@ -85,7 +85,7 @@ namespace System.IO.Pipes.Tests
             // On Linux, setting the buffer size of the server will also set the buffer size of the
             // client, regardless of the direction of the flow
 
-            int desiredBufferSize = 4096;
+            int desiredBufferSize = Environment.SystemPageSize;
             using (var server = new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.None, desiredBufferSize))
             {
                 Assert.Equal(desiredBufferSize, server.OutBufferSize);