Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sigsetjmp(3C) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getcontext(2)

priocntl(2)

sigaction(2)

sigaltstack(2)

sigprocmask(2)

reentrant(3)

setjmp(3C)



sigsetjmp(3C)                  DG/UX 5.4R3.00                  sigsetjmp(3C)


NAME
       sigsetjmp, siglongjmp - a non-local goto with signal state

SYNOPSIS
       #include <setjmp.h>

       int sigsetjmp (sigjmpbuf env, int savemask);

       void siglongjmp (sigjmpbuf env, int val);

DESCRIPTION
       These functions are useful for dealing with errors and interrupts
       encountered in a low-level subroutine of a program.

       sigsetjmp saves the calling process's registers and stack environment
       [see sigaltstack(2)] in env (whose type, sigjmpbuf, is defined in
       the <setjmp.h> header file) for later use by siglongjmp. If savemask
       is non-zero, the calling process's signal mask [see sigprocmask(2)]
       and scheduling parameters [see priocntl(2)] are also saved.
       sigsetjmp returns the value 0.

       siglongjmp restores the environment saved by the last call of
       sigsetjmp with the corresponding env argument.  After siglongjmp is
       completed, program execution continues as if the corresponding call
       of sigsetjmp had just returned the value val.  siglongjmp cannot
       cause sigsetjmp to return the value zero.  If siglongjmp is invoked
       with a second argument of zero, sigsetjmp will return 1.  At the time
       of the second return from sigsetjmp, all external and static
       variables have values as of the time siglongjmp is called. The values
       of register and automatic variables are undefined.  Register or
       automatic variables whose value must be relied upon must be declared
       as volatile.

       If a signal-catching function interrupts sleep and calls siglongjmp
       to restore an environment saved prior to the sleep call, the action
       associated with SIGALRM and time it is scheduled to be generated are
       unspecified. It is also unspecified whether the SIGALRM signal is
       blocked, unless the process's signal mask is restored as part of the
       environment.

       The function siglongjmp restores the saved signal mask if and only if
       the env argument was initialized by a call to the sigsetjmp function
       with a non-zero savemask argument.


   Considerations for Threads Programming
                    +-----------+-----------------------------+
                    |           |                      async- |
                    |function   | reentrant   cancel   cancel |
                    |           |              point    safe  |
                    +-----------+-----------------------------+
                    |siglongjmp |     Y          N        N   |
                    |sigsetjmp  |     Y          N        N   |
                    +-----------+-----------------------------+



Licensed material--property of copyright holder(s)                         1




sigsetjmp(3C)                  DG/UX 5.4R3.00                  sigsetjmp(3C)


SEE ALSO
       getcontext(2), priocntl(2), sigaction(2), sigaltstack(2),
       sigprocmask(2), reentrant(3), setjmp(3C).

NOTES
       If siglongjmp is called even though env was never primed by a call to
       sigsetjmp, or when the last such call was in a function that has
       since returned, absolute chaos is guaranteed.

       The sigsetjmp and siglongjmp routines are incorrectly implemented in
       the ELF environments in DG/UX 5.4 and 5.4.1 and the default 5.4.2 ELF
       environment.  In particular, they fail to save and restore the stack
       definition and previous context pointer (ucstack and uclink fields
       of a ucontextt structure).  An application which uses alternate
       stacks (sigaltstack()) or manipulates the uclink field explicitly
       may not operate correctly.  Although such an application cannot be
       built to operate correctly on DG/UX 5.4, it is possible to build an
       executable on 5.4.2 using a special compilation option that will
       correct this problem.  If this is done, the executable will NOT run
       on a 5.4 machine.  To obtain the correct behavior for sigsetjmp and
       siglongjmp, define the ABISETJMPFLAVOR macro.  (An easy way to
       define this macro is to include the -DABISETJMPFLAVOR option on
       your compilation line.)  Also, make sure that any source file using
       sigsetjmp or siglongjmp includes <setjmp.h>.

































Licensed material--property of copyright holder(s)                         2


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026