9.90 sigaltstack

typedef struct {
    void  *ss_sp;
    size_t ss_size;
    int    ss_flags;
} stack_t;

int sigaltstack(const stack_t *ss, stack_t *old_ss);

This syscall allows a thread to define an alternative stack to use for signal handling. The alternative stack will be only used if sa_sigaction requested it by using SA_ONSTACK.

If old_ss is not NULL, the old alternative stack being replaced is returned there.

If ss is not NULL, the alternative stack will be replaced with the pointed contents.

The ss_flags field of both old and new values is a bitfield with the following values:

By default, the alternative stack of every thread at creation points to a null address, and is disabled.

SS_ONSTACK

The thread is currently executing on the alternate signal stack. (Note that it is not possible to change the alternate signal stack if the thread is currently executing on it).

SS_DISABLE

Disable the use of this stack, using this stack with sigaction will not result on anything.

This syscall returns 0 on success, and returns -1 on failure, with the errno:

EAGAIN

Thread is not handling a signal.