# setjmp usage

- Thread: https://externals.io/message/36186
- Original archive: https://news-web.php.net/php.internals/36186
- Started by Rasmus Lerdorf on 2008-03-18T03:53:38+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #36186 — Rasmus Lerdorf — 2008-03-18T03:53:38+00:00

URL: https://externals.io/message/36186#36186

We are using setjmp(__bailout) in zend_try, but setjmp behaves 
differently on BSD and Linux.  POSIX doesn't specify whether the signal 
mask should be saved or not for this call, so different operating 
systems do different things here.  I think it would be more consistent 
if we used sigsetjmp(__bailout,0) to always specify that we don't need 
to store the signal mask.  This avoids an expensive sigprocmask syscall.

-Rasmus

---

## #36194 — Stanislav Malyshev — 2008-03-18T18:14:11+00:00

URL: https://externals.io/message/36186#36194 · In reply to: #36186

Hi!

> We are using setjmp(__bailout) in zend_try, but setjmp behaves 
> differently on BSD and Linux.  POSIX doesn't specify whether the signal 
> mask should be saved or not for this call, so different operating 
> systems do different things here.  I think it would be more consistent 
> if we used sigsetjmp(__bailout,0) to always specify that we don't need 
> to store the signal mask.  This avoids an expensive sigprocmask syscall.

Sounds good. Can we still use longjmp or have to use siglongjmp?
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #36195 — Rasmus Lerdorf — 2008-03-18T18:24:41+00:00

URL: https://externals.io/message/36186#36195 · In reply to: #36194

Stanislav Malyshev wrote:
> Hi!
> 
> > […]
> 
> Sounds good. Can we still use longjmp or have to use siglongjmp?

It's the same thing for longjmp.  POSIX doesn't specify what should be 
done with the signal mask after a longjmp either, so to be consistent we 
should use siglongjmp() as well and explicitly define what we want to do 
with the signal mask.

I'll work up a patch.

-Rasmus
