unix: add MNT_* flags on OpenBSD

Now that all BSDs define MNT_NOWAIT, use it in TestGetfsstat instead of
the locally defined copy.

Change-Id: Ib6cee08a6d3a034464c7b79591605b49889a46ae
Reviewed-on: https://go-review.googlesource.com/137195
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/unix/mkerrors.sh b/unix/mkerrors.sh
index d6127d1..ec8e613 100755
--- a/unix/mkerrors.sh
+++ b/unix/mkerrors.sh
@@ -292,6 +292,7 @@
 #include <sys/param.h>
 #include <sys/event.h>
 #include <sys/mman.h>
+#include <sys/mount.h>
 #include <sys/socket.h>
 #include <sys/sockio.h>
 #include <sys/stat.h>
@@ -440,6 +441,7 @@
 		$2 ~ /^KERN_(HOSTNAME|OS(RELEASE|TYPE)|VERSION)$/ ||
 		$2 ~ /^HW_MACHINE$/ ||
 		$2 ~ /^SYSCTL_VERS/ ||
+		$2 !~ "MNT_BITS" &&
 		$2 ~ /^(MS|MNT|UMOUNT)_/ ||
 		$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
 		$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
diff --git a/unix/syscall_bsd_test.go b/unix/syscall_bsd_test.go
index 6c4e2ac..12924cb 100644
--- a/unix/syscall_bsd_test.go
+++ b/unix/syscall_bsd_test.go
@@ -15,18 +15,14 @@
 	"golang.org/x/sys/unix"
 )
 
-const MNT_WAIT = 1
-const MNT_NOWAIT = 2
-
 func TestGetfsstat(t *testing.T) {
-	const flags = MNT_NOWAIT // see golang.org/issue/16937
-	n, err := unix.Getfsstat(nil, flags)
+	n, err := unix.Getfsstat(nil, unix.MNT_NOWAIT)
 	if err != nil {
 		t.Fatal(err)
 	}
 
 	data := make([]unix.Statfs_t, n)
-	n2, err := unix.Getfsstat(data, flags)
+	n2, err := unix.Getfsstat(data, unix.MNT_NOWAIT)
 	if err != nil {
 		t.Fatal(err)
 	}
diff --git a/unix/zerrors_openbsd_386.go b/unix/zerrors_openbsd_386.go
index 7d92f2c..d8be045 100644
--- a/unix/zerrors_openbsd_386.go
+++ b/unix/zerrors_openbsd_386.go
@@ -899,6 +899,32 @@
 	MAP_TRYFIXED                      = 0x400
 	MCL_CURRENT                       = 0x1
 	MCL_FUTURE                        = 0x2
+	MNT_ASYNC                         = 0x40
+	MNT_DEFEXPORTED                   = 0x200
+	MNT_DELEXPORT                     = 0x20000
+	MNT_DOOMED                        = 0x8000000
+	MNT_EXPORTANON                    = 0x400
+	MNT_EXPORTED                      = 0x100
+	MNT_EXRDONLY                      = 0x80
+	MNT_FORCE                         = 0x80000
+	MNT_LAZY                          = 0x3
+	MNT_LOCAL                         = 0x1000
+	MNT_NOATIME                       = 0x8000
+	MNT_NODEV                         = 0x10
+	MNT_NOEXEC                        = 0x4
+	MNT_NOSUID                        = 0x8
+	MNT_NOWAIT                        = 0x2
+	MNT_QUOTA                         = 0x2000
+	MNT_RDONLY                        = 0x1
+	MNT_RELOAD                        = 0x40000
+	MNT_ROOTFS                        = 0x4000
+	MNT_SOFTDEP                       = 0x4000000
+	MNT_SYNCHRONOUS                   = 0x2
+	MNT_UPDATE                        = 0x10000
+	MNT_VISFLAGMASK                   = 0x400ffff
+	MNT_WAIT                          = 0x1
+	MNT_WANTRDWR                      = 0x2000000
+	MNT_WXALLOWED                     = 0x800
 	MSG_BCAST                         = 0x100
 	MSG_CTRUNC                        = 0x20
 	MSG_DONTROUTE                     = 0x4
diff --git a/unix/zerrors_openbsd_amd64.go b/unix/zerrors_openbsd_amd64.go
index b0a7eba..12261a5 100644
--- a/unix/zerrors_openbsd_amd64.go
+++ b/unix/zerrors_openbsd_amd64.go
@@ -939,6 +939,32 @@
 	MAP_TRYFIXED                      = 0x0
 	MCL_CURRENT                       = 0x1
 	MCL_FUTURE                        = 0x2
+	MNT_ASYNC                         = 0x40
+	MNT_DEFEXPORTED                   = 0x200
+	MNT_DELEXPORT                     = 0x20000
+	MNT_DOOMED                        = 0x8000000
+	MNT_EXPORTANON                    = 0x400
+	MNT_EXPORTED                      = 0x100
+	MNT_EXRDONLY                      = 0x80
+	MNT_FORCE                         = 0x80000
+	MNT_LAZY                          = 0x3
+	MNT_LOCAL                         = 0x1000
+	MNT_NOATIME                       = 0x8000
+	MNT_NODEV                         = 0x10
+	MNT_NOEXEC                        = 0x4
+	MNT_NOSUID                        = 0x8
+	MNT_NOWAIT                        = 0x2
+	MNT_QUOTA                         = 0x2000
+	MNT_RDONLY                        = 0x1
+	MNT_RELOAD                        = 0x40000
+	MNT_ROOTFS                        = 0x4000
+	MNT_SOFTDEP                       = 0x4000000
+	MNT_SYNCHRONOUS                   = 0x2
+	MNT_UPDATE                        = 0x10000
+	MNT_VISFLAGMASK                   = 0x400ffff
+	MNT_WAIT                          = 0x1
+	MNT_WANTRDWR                      = 0x2000000
+	MNT_WXALLOWED                     = 0x800
 	MSG_BCAST                         = 0x100
 	MSG_CMSG_CLOEXEC                  = 0x800
 	MSG_CTRUNC                        = 0x20
diff --git a/unix/zerrors_openbsd_arm.go b/unix/zerrors_openbsd_arm.go
index 50c1d9f..79d5695 100644
--- a/unix/zerrors_openbsd_arm.go
+++ b/unix/zerrors_openbsd_arm.go
@@ -899,6 +899,32 @@
 	MAP_TRYFIXED                      = 0x0
 	MCL_CURRENT                       = 0x1
 	MCL_FUTURE                        = 0x2
+	MNT_ASYNC                         = 0x40
+	MNT_DEFEXPORTED                   = 0x200
+	MNT_DELEXPORT                     = 0x20000
+	MNT_DOOMED                        = 0x8000000
+	MNT_EXPORTANON                    = 0x400
+	MNT_EXPORTED                      = 0x100
+	MNT_EXRDONLY                      = 0x80
+	MNT_FORCE                         = 0x80000
+	MNT_LAZY                          = 0x3
+	MNT_LOCAL                         = 0x1000
+	MNT_NOATIME                       = 0x8000
+	MNT_NODEV                         = 0x10
+	MNT_NOEXEC                        = 0x4
+	MNT_NOSUID                        = 0x8
+	MNT_NOWAIT                        = 0x2
+	MNT_QUOTA                         = 0x2000
+	MNT_RDONLY                        = 0x1
+	MNT_RELOAD                        = 0x40000
+	MNT_ROOTFS                        = 0x4000
+	MNT_SOFTDEP                       = 0x4000000
+	MNT_SYNCHRONOUS                   = 0x2
+	MNT_UPDATE                        = 0x10000
+	MNT_VISFLAGMASK                   = 0x400ffff
+	MNT_WAIT                          = 0x1
+	MNT_WANTRDWR                      = 0x2000000
+	MNT_WXALLOWED                     = 0x800
 	MSG_BCAST                         = 0x100
 	MSG_CMSG_CLOEXEC                  = 0x800
 	MSG_CTRUNC                        = 0x20