summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkn <kn@openbsd.org>2020-05-17 11:12:55 +0000
committerkn <kn@openbsd.org>2020-05-17 11:12:55 +0000
commite1ce6058128bbedce7f4d8f766a5a82a09a46cc3 (patch)
treecba371adda9923d5e43c75260f8ed49fd569b6cc
parentAdd machdep.compatible. (diff)
downloadwireguard-openbsd-e1ce6058128bbedce7f4d8f766a5a82a09a46cc3.tar.xz
wireguard-openbsd-e1ce6058128bbedce7f4d8f766a5a82a09a46cc3.zip
Fix WITNESS build
sparc64 (and arm mem.c) are the only architectures/places where RWLOCK_INITIALIZER() is used with static function variables, all other (mem.c) usages place it into the global scope. Fix builds with WITNESS enabled for sparc64 and arm by moving physlock into global scope: mem.c:93: error: initializer element is not constant mem.c:93: error: (near initialization for 'physlock.rwl_lock_obj.lo_type') OK visa
-rw-r--r--sys/arch/arm/arm/mem.c5
-rw-r--r--sys/arch/sparc64/sparc64/mem.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/arch/arm/arm/mem.c b/sys/arch/arm/arm/mem.c
index e37b44deaaa..9272ce0daf1 100644
--- a/sys/arch/arm/arm/mem.c
+++ b/sys/arch/arm/arm/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.21 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: mem.c,v 1.22 2020/05/17 11:12:55 kn Exp $ */
/* $NetBSD: mem.c,v 1.11 2003/10/16 12:02:58 jdolecek Exp $ */
/*
@@ -141,10 +141,11 @@ mmclose(dev_t dev, int flag, int mode, struct proc *p)
return (0);
}
+static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
+
int
mmrw(dev_t dev, struct uio *uio, int flags)
{
- static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
vaddr_t o, v;
size_t c;
struct iovec *iov;
diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c
index f4deaa41c5b..b0314bf27ad 100644
--- a/sys/arch/sparc64/sparc64/mem.c
+++ b/sys/arch/sparc64/sparc64/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.19 2017/12/14 03:30:43 guenther Exp $ */
+/* $OpenBSD: mem.c,v 1.20 2020/05/17 11:12:55 kn Exp $ */
/* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */
/*
@@ -87,10 +87,11 @@ mmclose(dev_t dev, int flag, int mode, struct proc *p)
return (0);
}
+static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
+
int
mmrw(dev_t dev, struct uio *uio, int flags)
{
- static struct rwlock physlock = RWLOCK_INITIALIZER("mmrw");
vaddr_t o, v;
size_t c;
struct iovec *iov;