Module Name: src Committed By: kre Date: Sun Mar 19 17:47:48 UTC 2023
Modified Files: src/bin/sh: error.h Log Message: Switch from using _setjmp()/_longjmp() (on BSD systems which aren't SVR4) (and setjmp()/longjmp() elsewhere) to using sigsetjmp()/siglongjmp() everywhere. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/bin/sh/error.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/bin/sh/error.h diff -u src/bin/sh/error.h:1.23 src/bin/sh/error.h:1.24 --- src/bin/sh/error.h:1.23 Sun Mar 19 17:45:29 2023 +++ src/bin/sh/error.h Sun Mar 19 17:47:48 2023 @@ -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))