From ce6a89e27cd190313be39bb479880aeda4778436 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 6 Apr 2020 23:08:07 +0000 Subject: [PATCH] kqueue tests: fix -fno-common build vnode_fd and kqfd are both shared among multiple CU; define them exactly once. In the case of vnode_fd, it was simply the declaration that needed correction. -fno-common will become the default in GCC10/LLVM11. MFC after: 3 days --- tests/sys/kqueue/libkqueue/common.h | 3 ++- tests/sys/kqueue/libkqueue/proc.c | 1 - tests/sys/kqueue/libkqueue/read.c | 1 - tests/sys/kqueue/libkqueue/signal.c | 1 - tests/sys/kqueue/libkqueue/timer.c | 1 - tests/sys/kqueue/libkqueue/user.c | 1 - tests/sys/kqueue/libkqueue/vnode.c | 1 - 7 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/sys/kqueue/libkqueue/common.h b/tests/sys/kqueue/libkqueue/common.h index 814d6cc0fc93..c73df382b4cc 100644 --- a/tests/sys/kqueue/libkqueue/common.h +++ b/tests/sys/kqueue/libkqueue/common.h @@ -41,7 +41,8 @@ #include extern char *cur_test_id; -int vnode_fd; +extern int vnode_fd; +extern int kqfd; extern char * kevent_to_str(struct kevent *); struct kevent * kevent_get(int); diff --git a/tests/sys/kqueue/libkqueue/proc.c b/tests/sys/kqueue/libkqueue/proc.c index 32735454b8b2..6e87353320f5 100644 --- a/tests/sys/kqueue/libkqueue/proc.c +++ b/tests/sys/kqueue/libkqueue/proc.c @@ -25,7 +25,6 @@ static int sigusr1_caught = 0; -int kqfd; static void sig_handler(int signum) diff --git a/tests/sys/kqueue/libkqueue/read.c b/tests/sys/kqueue/libkqueue/read.c index 28371444383f..9fd09ba8e182 100644 --- a/tests/sys/kqueue/libkqueue/read.c +++ b/tests/sys/kqueue/libkqueue/read.c @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int sockfd[2]; static void diff --git a/tests/sys/kqueue/libkqueue/signal.c b/tests/sys/kqueue/libkqueue/signal.c index df620f14b841..de342d69e2db 100644 --- a/tests/sys/kqueue/libkqueue/signal.c +++ b/tests/sys/kqueue/libkqueue/signal.c @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; void test_kevent_signal_add(void) diff --git a/tests/sys/kqueue/libkqueue/timer.c b/tests/sys/kqueue/libkqueue/timer.c index d1d92691c177..83346458ab8a 100644 --- a/tests/sys/kqueue/libkqueue/timer.c +++ b/tests/sys/kqueue/libkqueue/timer.c @@ -26,7 +26,6 @@ #define MS_TO_US(t) ((t) * THOUSAND) /* Convert milliseconds to microseconds. */ #define US_TO_NS(t) ((t) * THOUSAND) /* Convert microseconds to nanoseconds. */ -int kqfd; /* Get the current time with microsecond precision. Used for * sub-second timing to make some timer tests run faster. diff --git a/tests/sys/kqueue/libkqueue/user.c b/tests/sys/kqueue/libkqueue/user.c index 51ccac672ae6..0f7791c9567b 100644 --- a/tests/sys/kqueue/libkqueue/user.c +++ b/tests/sys/kqueue/libkqueue/user.c @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; static void add_and_delete(void) diff --git a/tests/sys/kqueue/libkqueue/vnode.c b/tests/sys/kqueue/libkqueue/vnode.c index 418cd2e3d64b..d9e043e15a98 100644 --- a/tests/sys/kqueue/libkqueue/vnode.c +++ b/tests/sys/kqueue/libkqueue/vnode.c @@ -18,7 +18,6 @@ #include "common.h" -int kqfd; int vnode_fd; void