Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Switch from using _setjmp()/_longjmp() (on BSD system...



details:   https://anonhg.NetBSD.org/src/rev/c750c7955bb8
branches:  trunk
changeset: 373917:c750c7955bb8
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Mar 19 17:47:48 2023 +0000

description:
Switch from using _setjmp()/_longjmp() (on BSD systems which aren't SVR4)
(and setjmp()/longjmp() elsewhere) to using sigsetjmp()/siglongjmp()
everywhere.

NFCI.

diffstat:

 bin/sh/error.h |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (24 lines):

diff -r 808b018cabf5 -r c750c7955bb8 bin/sh/error.h
--- a/bin/sh/error.h    Sun Mar 19 17:45:29 2023 +0000
+++ b/bin/sh/error.h    Sun Mar 19 17:47:48 2023 +0000
@@ -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 @@
 
 /*
  * 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))



Home | Main Index | Thread Index | Old Index