summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkre <kre@NetBSD.org>2023-03-19 17:47:48 +0000
committerkre <kre@NetBSD.org>2023-03-19 17:47:48 +0000
commit793738ecf8a601304d08a7f6f8c0a3c7a9fe63c8 (patch)
treee850189052af4ac8bf7853e0c002a41ad6e608f6
parentd04846ae6e6cc945a2120e2ac77190f5af609266 (diff)
Switch from using _setjmp()/_longjmp() (on BSD systems which aren't SVR4)
(and setjmp()/longjmp() elsewhere) to using sigsetjmp()/siglongjmp() everywhere. NFCI.
-rw-r--r--bin/sh/error.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/bin/sh/error.h b/bin/sh/error.h
index 1500f97eb47..1a5d1846593 100644
--- a/bin/sh/error.h
+++ b/bin/sh/error.h
@@ -1,4 +1,4 @@
-/* $NetBSD: error.h,v 1.23 2023/03/19 17:45:29 kre Exp $ */
+/* $NetBSD: error.h,v 1.24 2023/03/19 17:47:48 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -114,10 +114,9 @@ void sh_exit(int) __dead;
/*
* BSD setjmp saves the signal mask, which violates ANSI C and takes time,
- * so we use _setjmp instead.
+ * so we use sigsetjmp instead, and explicitly do not save it.
+ * sh does a lot of setjmp() calls (fewer longjmp though).
*/
-#if defined(BSD) && !defined(__SVR4)
-#define setjmp(jmploc) _setjmp(jmploc)
-#define longjmp(jmploc, val) _longjmp(jmploc, val)
-#endif
+#define setjmp(jmploc) sigsetjmp((jmploc), 0)
+#define longjmp(jmploc, val) siglongjmp((jmploc), (val))