Skip to content

Commit 67f5cae

Browse files
committed
update script to generate mremap flags
1 parent b090860 commit 67f5cae

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

unix/mkerrors.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ ccflags="$@"
519519
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
520520
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
521521
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
522-
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
522+
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MREMAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
523523
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
524524
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
525525
$2 ~ /^RAW_PAYLOAD_/ ||

unix/mremap_linux_test.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2023 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build linux
6+
// +build linux
7+
8+
package unix_test
9+
10+
import (
11+
"golang.org/x/sys/unix"
12+
"testing"
13+
)
14+
15+
func TestMremap(t *testing.T) {
16+
17+
}
18+
19+
func TestMremap2(t *testing.T) {
20+
b, err := unix.Mmap(-1, 0, unix.Getpagesize()*2, unix.PROT_NONE, unix.MAP_ANON|unix.MAP_PRIVATE)
21+
if err != nil {
22+
t.Fatalf("Mmap: %v", err)
23+
}
24+
25+
b[0] = 42
26+
if err := unix.Msync(b, unix.MS_SYNC); err != nil {
27+
t.Fatalf("Msync: %v", err)
28+
}
29+
30+
newB, err := unix.Mremap2(b, unix.Getpagesize())
31+
}

0 commit comments

Comments
 (0)