unix: add Mremap for netbsd

Fixes golang/go#60409

Change-Id: I2d872a1a6fb63c27ab3753deff370e1c2f752bdd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/508397
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Tobias Klauser
2023-07-13 05:43:33 +00:00
committed by Gopher Robot
parent a1a9c4b846
commit 3fead03e7d
15 changed files with 119 additions and 89 deletions
+5 -5
View File
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build linux
// +build linux
//go:build linux || netbsd
// +build linux netbsd
package unix_test
@@ -24,7 +24,7 @@ func TestMremap(t *testing.T) {
b[0] = 42
bNew, err := unix.Mremap(b, unix.Getpagesize()*2, unix.MREMAP_MAYMOVE)
bNew, err := unix.Mremap(b, unix.Getpagesize()*2, unix.MremapMaymove)
if err != nil {
t.Fatalf("Mremap2: %v", err)
}
@@ -40,8 +40,8 @@ func TestMremap(t *testing.T) {
t.Fatal("new memory cap not equal to specified len")
}
_, err = unix.Mremap(b, unix.Getpagesize(), unix.MREMAP_FIXED)
_, err = unix.Mremap(b, unix.Getpagesize(), unix.MremapFixed)
if err != unix.EINVAL {
t.Fatalf("unix.MREMAP_FIXED should be forbidden")
t.Fatalf("remapping to a fixed address; got %v, want %v", err, unix.EINVAL)
}
}