git: 8dc3fdfe69d5 - main - amd64: -m32 support for machine/counter.h

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Mon, 13 Jun 2022 17:36:12 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=8dc3fdfe69d588851237cc9e2e8cdc90a4a6aa0f

commit 8dc3fdfe69d588851237cc9e2e8cdc90a4a6aa0f
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2022-06-13 17:35:40 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2022-06-13 17:35:40 +0000

    amd64: -m32 support for machine/counter.h
    
    Install the i386 counter.h under /usr/include/i386 on amd64 and include
    when targeting i386.
    
    This is a kernel-only header required by procstat's ZFS support.
    
    Reviewed by:    jhb, imp
---
 include/i386/Makefile       | 1 +
 sys/amd64/include/counter.h | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/i386/Makefile b/include/i386/Makefile
index de270655fb69..58c619f4dbdf 100644
--- a/include/i386/Makefile
+++ b/include/i386/Makefile
@@ -14,6 +14,7 @@ INCS=	\
 # These kernel-only headers are used by procstat's ZFS support.
 # This should be fixed.
 INCS+=	\
+	counter.h \
 	pcpu.h \
 	pcpu_aux.h
 INCSDIR=	${INCLUDEDIR}/i386
diff --git a/sys/amd64/include/counter.h b/sys/amd64/include/counter.h
index e7eb19e058cd..1d641a365e3f 100644
--- a/sys/amd64/include/counter.h
+++ b/sys/amd64/include/counter.h
@@ -28,6 +28,10 @@
  * $FreeBSD$
  */
 
+#ifdef __i386__
+#include <i386/counter.h>
+#else /* !__i386__ */
+
 #ifndef __MACHINE_COUNTER_H__
 #define __MACHINE_COUNTER_H__
 
@@ -90,3 +94,5 @@ counter_u64_add(counter_u64_t c, int64_t inc)
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
+
+#endif /* __i386__ */