git: c29cba408d19 - main - stand: Narrow the 'signal emulation' we provide

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 20 Nov 2024 03:35:49 UTC
The branch main has been updated by imp:

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

commit c29cba408d197ed2c267d0605e4225bb54153e01
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-11-20 03:05:11 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-11-20 03:24:41 +0000

    stand: Narrow the 'signal emulation' we provide
    
    We only need to provide sig_atomic_t in emulation. However, including
    machine/signal.h brings in too much namespace pollution related to
    signals. Instead, define sig_atomic_t as long. Setting long is async
    atomic on all platforms (though powerpc64 defines it to an int), though
    that doesn't matter since the boot loader doesn't use signals.
    
    Sponsored by:           Netflix
---
 stand/libsa/stand.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h
index 260defa3a33d..e1188fb73a26 100644
--- a/stand/libsa/stand.h
+++ b/stand/libsa/stand.h
@@ -82,8 +82,13 @@
 #define	EOFFSET	(ELAST+8)	/* relative seek not supported */
 #define	ESALAST	(ELAST+8)	/* */
 
-/* Partial signal emulation for sig_atomic_t */
-#include <machine/signal.h>
+/*
+ * LUA needs sig_atomic_t. This is defined to be long or int on all our
+ * platforms. On all but powerpc, these are all the same thing as long. 64-bit
+ * powerpc defines this as int, but long can also be accessed atomically. It's
+ * also OK because we don't have signal handlers in the boot loader.
+ */
+typedef long sig_atomic_t;
 
 __BEGIN_DECLS