aboutsummaryrefslogtreecommitdiffstats
path: root/sys/netbsd
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-10-19 19:08:19 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-10-19 19:11:22 +0100
commitecb386fe6f6849c451955e16556d04b388b1fde1 (patch)
tree96b30f75d77e5c950103da0ee202bb42b587265a /sys/netbsd
parent9aba67b521aa5a2669f2f0c3cee2c4f46d23a4f3 (diff)
sys: check that target consts are defined
Currently when we get target consts with target.ConstMap["name"] during target initialization, we just get 0 for missing consts. This is error-prone as we can mis-type a const, or a const may be undefined only on some archs (as we have common unix code shared between several OSes). Check that all the consts are actually defined. The check detects several violations, to fix them: 1. move mremap to linux as it's only defined on linux 2. move S_IFMT to openbsd, as it's only defined and used on openbsd 3. define missing MAP_ANONYMOUS for freebsd and netbsd 4. fix extract for netbsd
Diffstat (limited to 'sys/netbsd')
-rw-r--r--sys/netbsd/gen/amd64.go28
-rw-r--r--sys/netbsd/mm.txt2
-rw-r--r--sys/netbsd/mm_amd64.const1
-rw-r--r--sys/netbsd/socket.txt1
-rw-r--r--sys/netbsd/socket_inet.txt1
-rw-r--r--sys/netbsd/socket_inet6.txt1
-rw-r--r--sys/netbsd/socket_unix.txt1
-rw-r--r--sys/netbsd/sys_amd64.const25
8 files changed, 9 insertions, 51 deletions
diff --git a/sys/netbsd/gen/amd64.go b/sys/netbsd/gen/amd64.go
index ece51bee1..441dd86f3 100644
--- a/sys/netbsd/gen/amd64.go
+++ b/sys/netbsd/gen/amd64.go
@@ -1396,6 +1396,7 @@ var consts_amd64 = []ConstValue{
{Name: "MADV_SEQUENTIAL", Value: 2},
{Name: "MADV_WILLNEED", Value: 3},
{Name: "MAP_ANON", Value: 4096},
+ {Name: "MAP_ANONYMOUS", Value: 4096},
{Name: "MAP_FILE"},
{Name: "MAP_FIXED", Value: 16},
{Name: "MAP_HASSEMAPHORE", Value: 512},
@@ -1449,22 +1450,10 @@ var consts_amd64 = []ConstValue{
{Name: "POLLRDNORM", Value: 64},
{Name: "POLLWRBAND", Value: 256},
{Name: "POLLWRNORM", Value: 4},
- {Name: "POSIX_FADV_DONTNEED", Value: 4},
- {Name: "POSIX_FADV_NOREUSE", Value: 5},
- {Name: "POSIX_FADV_NORMAL"},
- {Name: "POSIX_FADV_RANDOM", Value: 1},
- {Name: "POSIX_FADV_SEQUENTIAL", Value: 2},
- {Name: "POSIX_FADV_WILLNEED", Value: 3},
- {Name: "PRIO_PGRP", Value: 1},
- {Name: "PRIO_PROCESS"},
- {Name: "PRIO_USER", Value: 2},
{Name: "PROT_EXEC", Value: 4},
{Name: "PROT_NONE"},
{Name: "PROT_READ", Value: 1},
{Name: "PROT_WRITE", Value: 2},
- {Name: "P_ALL"},
- {Name: "P_PGID", Value: 4},
- {Name: "P_PID", Value: 1},
{Name: "RLIMIT_AS", Value: 10},
{Name: "RLIMIT_CORE", Value: 4},
{Name: "RLIMIT_CPU"},
@@ -1478,13 +1467,6 @@ var consts_amd64 = []ConstValue{
{Name: "RLIMIT_STACK", Value: 3},
{Name: "RUSAGE_CHILDREN", Value: 18446744073709551615},
{Name: "RUSAGE_SELF"},
- {Name: "SA_NOCLDSTOP", Value: 8},
- {Name: "SA_NOCLDWAIT", Value: 32},
- {Name: "SA_NODEFER", Value: 16},
- {Name: "SA_ONSTACK", Value: 1},
- {Name: "SA_RESETHAND", Value: 4},
- {Name: "SA_RESTART", Value: 2},
- {Name: "SA_SIGINFO", Value: 64},
{Name: "SCM_RIGHTS", Value: 1},
{Name: "SEEK_CUR", Value: 1},
{Name: "SEEK_END", Value: 2},
@@ -1499,12 +1481,6 @@ var consts_amd64 = []ConstValue{
{Name: "SHUT_RD"},
{Name: "SHUT_RDWR", Value: 2},
{Name: "SHUT_WR", Value: 1},
- {Name: "SIGEV_NONE"},
- {Name: "SIGEV_SIGNAL", Value: 1},
- {Name: "SIGEV_THREAD", Value: 2},
- {Name: "SIG_BLOCK", Value: 1},
- {Name: "SIG_SETMASK", Value: 3},
- {Name: "SIG_UNBLOCK", Value: 2},
{Name: "SOCK_CLOEXEC", Value: 268435456},
{Name: "SOCK_DGRAM", Value: 2},
{Name: "SOCK_NONBLOCK", Value: 536870912},
@@ -1680,4 +1656,4 @@ var consts_amd64 = []ConstValue{
{Name: "WUNTRACED", Value: 2},
}
-const revision_amd64 = "741d8f94955b7b371dee88f03db02ab85d5a9384"
+const revision_amd64 = "f7c2c212cb60211857a9c1c50c9336f899bb9ce9"
diff --git a/sys/netbsd/mm.txt b/sys/netbsd/mm.txt
index c98caee13..432ac8287 100644
--- a/sys/netbsd/mm.txt
+++ b/sys/netbsd/mm.txt
@@ -17,3 +17,5 @@ mmap_prot = PROT_EXEC, PROT_READ, PROT_WRITE, PROT_NONE
mmap_flags = MAP_ANON, MAP_FILE, MAP_FIXED, MAP_HASSEMAPHORE, MAP_INHERIT, MAP_TRYFIXED, MAP_WIRED, MAP_PRIVATE, MAP_SHARED
madvise_flags = MADV_NORMAL, MADV_RANDOM, MADV_SEQUENTIAL, MADV_WILLNEED, MADV_DONTNEED, MADV_FREE
mlockall_flags = MCL_CURRENT, MCL_FUTURE
+
+define MAP_ANONYMOUS MAP_ANON
diff --git a/sys/netbsd/mm_amd64.const b/sys/netbsd/mm_amd64.const
index 7cffb10ce..12ee91b0b 100644
--- a/sys/netbsd/mm_amd64.const
+++ b/sys/netbsd/mm_amd64.const
@@ -6,6 +6,7 @@ MADV_RANDOM = 1
MADV_SEQUENTIAL = 2
MADV_WILLNEED = 3
MAP_ANON = 4096
+MAP_ANONYMOUS = 4096
MAP_FILE = 0
MAP_FIXED = 16
MAP_HASSEMAPHORE = 512
diff --git a/sys/netbsd/socket.txt b/sys/netbsd/socket.txt
index 4b3dbfa34..05bd059f4 100644
--- a/sys/netbsd/socket.txt
+++ b/sys/netbsd/socket.txt
@@ -3,6 +3,7 @@
# TODO: due to autobind a socket can bind to port 0, that will result in a random port which is not reproducible
+include <stddef.h>
include <sys/types.h>
include <sys/socket.h>
include <netinet/in.h>
diff --git a/sys/netbsd/socket_inet.txt b/sys/netbsd/socket_inet.txt
index 98b72d23c..0b12eadff 100644
--- a/sys/netbsd/socket_inet.txt
+++ b/sys/netbsd/socket_inet.txt
@@ -1,6 +1,7 @@
# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+include <stddef.h>
include <sys/types.h>
include <sys/socket.h>
include <sys/sockio.h>
diff --git a/sys/netbsd/socket_inet6.txt b/sys/netbsd/socket_inet6.txt
index dce4f2ec5..1ede058ab 100644
--- a/sys/netbsd/socket_inet6.txt
+++ b/sys/netbsd/socket_inet6.txt
@@ -1,6 +1,7 @@
# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
+include <stddef.h>
include <sys/types.h>
include <sys/param.h>
include <sys/socket.h>
diff --git a/sys/netbsd/socket_unix.txt b/sys/netbsd/socket_unix.txt
index 4a42c5845..0e42b74a0 100644
--- a/sys/netbsd/socket_unix.txt
+++ b/sys/netbsd/socket_unix.txt
@@ -3,6 +3,7 @@
# AF_UNIX support.
+include <stddef.h>
include <sys/types.h>
include <sys/socket.h>
include <netinet/in.h>
diff --git a/sys/netbsd/sys_amd64.const b/sys/netbsd/sys_amd64.const
index 4931e5592..c88ee22b3 100644
--- a/sys/netbsd/sys_amd64.const
+++ b/sys/netbsd/sys_amd64.const
@@ -50,18 +50,6 @@ POLLRDBAND = 128
POLLRDNORM = 64
POLLWRBAND = 256
POLLWRNORM = 4
-POSIX_FADV_DONTNEED = 4
-POSIX_FADV_NOREUSE = 5
-POSIX_FADV_NORMAL = 0
-POSIX_FADV_RANDOM = 1
-POSIX_FADV_SEQUENTIAL = 2
-POSIX_FADV_WILLNEED = 3
-PRIO_PGRP = 1
-PRIO_PROCESS = 0
-PRIO_USER = 2
-P_ALL = 0
-P_PGID = 4
-P_PID = 1
RLIMIT_AS = 10
RLIMIT_CORE = 4
RLIMIT_CPU = 0
@@ -75,19 +63,6 @@ RLIMIT_RSS = 5
RLIMIT_STACK = 3
RUSAGE_CHILDREN = 18446744073709551615
RUSAGE_SELF = 0
-SA_NOCLDSTOP = 8
-SA_NOCLDWAIT = 32
-SA_NODEFER = 16
-SA_ONSTACK = 1
-SA_RESETHAND = 4
-SA_RESTART = 2
-SA_SIGINFO = 64
-SIGEV_NONE = 0
-SIGEV_SIGNAL = 1
-SIGEV_THREAD = 2
-SIG_BLOCK = 1
-SIG_SETMASK = 3
-SIG_UNBLOCK = 2
SYS_chdir = 12
SYS_chmod = 15
SYS_chown = 16