Previous | Table of Contents | Next

Page 857

> The SA_NODEFER flag is compatible with the SVR4 flag of the same name under kernels 1.3.9 and newer. On older kernels, the Linux implementation will allow the receipt of any signal, not just the one you are installing (effectively overriding any sa_mask settings).

The SA_RESETHAND and SA_NODEFER names for SVR4 compatibility are present only in library versions 3.0.9 and greater.

sigaction can be called with a null second argument to query the current signal handler. It can also be used to check whether a given signal is valid for the current machine by calling it with null second and third arguments.

See sigsetops(3) for details on manipulating signal sets.

CONFORMS TO

POSIX, SVR4

SEE ALSO

kill(1), kill(2), killpg(2), pause(2), raise(3), siginterrupt(3), signal(2), signal(7), sigse-tops(3), sigvec(2)

Linux 1.3, 24 August 1995

signal

signal—ANSI C signal handling

SYPNOSIS

#include <signal.h>
void (*signal(int signum,void (*handler)(int)))(int);

DESCRIPTION

The signal system call installs a new signal handler for the signal with number signum. The signal handler is set to handler, which can be a user-specified function or one of the following:

SIG_IGN Ignores the signal.
SIG_DFL Resets the signal to its default behavior.

The integer argument that is handed over to the signal-handling routine is the signal number. This makes it possible to use one signal handler for several signals.

RETURN VALUE

signal returns the previous value of the signal handler, or SIG_ERR on error.

NOTES

Signal handlers cannot be set for SIGKILL or SIGSTOP.

Unlike on BSD systems, signals under Linux are reset to their default behavior when raised. However, if you include <bsd/signal.h> instead of <signal.h>, signal is redefined as _bsd_signal, and signal has the BSD semantics. Both versions of signal are library routines built on top of sigaction(2).

If you're confused by the prototype at the top of this man page, it may help to see it separated out like this:

typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);

According to POSIX, the behavior of a process is undefined after it ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated by the kill() or raise() function. Integer division by 0 has undefined result. On some architectures it will generate a SIGFPE signal. Ignoring this signal might lead to an endless loop.

Page 858

CONFORMS TO

ANSI C

SEE ALSO

kill(1), kill(2), killpg(2), pause(2), raise(3), sigaction(2), signal(7), sigsetops(3), sigvec(2), alarm(2)

Linux 2.0, 21 July 1996

sigblock, siggetmask, sigsetmask, sigmask

sigblock, siggetmask, sigsetmask, sigmask—Manipulate the signal mask

SYPNOSIS

#include <signal.h>
int sigblock(int mask);
int siggetmask(void);
int sigsetmask(int mask);
int sigmask(int signum);

DESCRIPTION

This interface is made obsolete by sigprocmask(2).

The sigblock system call adds the signals specified in mask to the set of signals currently being blocked from delivery.

The sigsetmask system call replaces the set of blocked signals totally with a new set specified in mask. Signals are blocked if the corresponding bit in mask is a 1.

The current set of blocked signals can be obtained using siggetmask.

The sigmask macro is provided to construct the mask for a given signum.

RETURN VALUES

siggetmask returns the current set of masked signals.

sigsetmask and sigblock return the previous set of masked signals.

NOTES

Prototypes for these functions are only available if __USE_BSD is defined before <signal.h> is included.

It is not possible to block SIGKILL or SIGSTOP—this restriction is silently imposed by the system.

HISTORY

These function calls appeared in BSD 4.3 and are deprecated.

SEE ALSO

kill(2), sigprocmask(2), signal(7)

Linux 1.3, 31 August 1995

sigpause

sigpause—Atomically releases blocked signals and waits for interrupt

Page 859

SYPNOSIS

#include <signal.h>
int sigpause(int sigmask);

DESCRIPTION

This interface is made obsolete by sigsuspend(2).

sigpause assigns sigmask to the set of masked signals and then waits for a signal to arrive; on return, the set of masked signals is restored.

sigmask is usually 0 to indicate that no signals are to be blocked. sigpause always terminates by being interrupted, returning
_1 with errno set to EINTR.

HISTORY

The sigpause function call appeared in BSD 4.3 and is deprecated.

SEE ALSO

sigsuspend(2), kill(2), sigaction(2), sigprocmask(2), sigblock(2), sigvec(2)

Linux 1.3, 24 July 1993

sigreturn

sigreturn—Returns from the signal handler and cleans up the stack frame

SYPNOSIS

int sigreturn(unsigned long __unused);

DESCRIPTION

When the Linux kernel creates the stack frame for a signal handler, a call to sigreturn is inserted into the stack frame so that the signal handler will call sigreturn upon return. This inserted call to sigreturn cleans up the stack so that the process can restart from where it was interrupted by the signal.

RETURN VALUE

sigreturn never returns.

WARNING

The sigreturn call is used by the kernel to implement signal handlers. It should never be called directly. Better yet, the specific use of the unused argument varies depending on the architecture.

CONFORMS TO

sigreturn is specific to Linux.

FILEs

/usr/src/linux/arch/i386/kernel/signal.c
/usr/src/linux/arch/alpha/kernel/entry.S

SEE ALSO

kill(2), signal(2), signal(7)P

Linux 1.3.20, 21 August 1995

Previous | Table of Contents | Next

1