SIGLONGJMP(3POSIX)

🌸 SIGLONGJMP πŸ’…

okay bestie, so this one's from the POSIX Programmer's Manual β€” that's the manual this page lives in. Just a heads up before we dive in: the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. πŸ™ˆ


✨ PROLOG ✨

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.


πŸ‘‘ NAME πŸ‘‘

siglongjmp β€” non-local goto with signal handling. yeah. it jumps. but make it signal-aware. ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <setjmp.h>

void siglongjmp(sigjmp_buf env, int val);

πŸ’– DESCRIPTION πŸ’–

So siglongjmp() is literally the same vibe as the longjmp() function, except for these two things, and you gotta know both of them:

  • References to setjmp() shall be equivalent to sigsetjmp(). πŸͺ„
  • The siglongjmp() function shall restore the saved signal mask if and only if the env argument was initialized by a call to sigsetjmp() with a non-zero savemask argument. no nonzero savemask, no mask restore. that's the whole deal. πŸ’…

🌈 RETURN VALUE 🌈

Once siglongjmp() is completed, program execution shall continue as if the corresponding invocation of sigsetjmp() had just returned the value specified by val. it's giving time travel but make it a function call. πŸ¦‹

Also, super important: the siglongjmp() function shall not cause sigsetjmp() to return 0. So if val is 0, then sigsetjmp() shall return the value 1 instead. yeah, it just does that. no cap. ⭐


πŸ’€ ERRORS πŸ’€

No errors are defined. iconic behavior honestly. 🫢

The following sections are informative. (so like, the rest of this is context, not contract, iykyk)


πŸ“ EXAMPLES πŸ“

None.


🧚 APPLICATION USAGE 🧚

The distinction between setjmp() or longjmp() and sigsetjmp() or siglongjmp() is only significant for programs which use sigaction(), sigprocmask(), or sigsuspend(). if you're not touching those three, this whole signal-mask subplot is not your problem bestie. πŸ’œ


🌸 RATIONALE 🌸

None.


⭐ FUTURE DIRECTIONS ⭐

None.


πŸŽ€ SEE ALSO πŸŽ€

  • longjmp()
  • pthread_sigmask()
  • setjmp()
  • sigsetjmp()
  • sigsuspend()

The Base Definitions volume of POSIX.1‐2017, <setjmp.h> β€” go read it, it's right there. πŸ‘‘


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .

and that's the whole page, bestie!! courtesy of IEEE/The Open Group, 2017, filed under SIGLONGJMP(3POSIX). mwah, go restore that signal mask responsibly πŸ’–βœ¨