.\" Copyright (c) 1994 Mike Battersby .\" based on work by faith@cs.unc.edu .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" .\" Modified, aeb, 960424, 960621 .TH SIGNAL 2 "21 July 1996" "Linux 2.0" "Linux Programmer's Manual" .SH NAME signal \- ANSI C signal handling .SH SYNOPSIS .B #include .sp 2 .BI "void (*signal(int " signum ", void (*" handler ")(int)))(int);" .SH DESCRIPTION The .B signal system call installs a new signal handler for the signal with number .I signum. The signal handler is set to .I handler which may be a user specified function, or one of the following: .RS .TP .B SIG_IGN Ignore the signal. .TP .B SIG_DFL Reset the signal to its default behavior. .RE .PP The integer argument that is handed over to the signal handler routine is the signal number. This makes it possible to use one signal handler for several signals. .SH "RETURN VALUE" .B signal returns the previous value of the signal handler, or .B SIG_ERR on error. .SH NOTES Signal handlers cannot be set for .B SIGKILL or .BR SIGSTOP . .PP Unlike on BSD systems, signals under Linux are reset to their default behavior when raised. However, if you include .B "" instead of .B "" then .B signal is redefined as .B __bsd_signal and signal has the BSD semantics. Both versions of .B signal are library routines built on top of .BR sigaction (2). .PP If you're confused by the prototype at the top of this manpage, it may help to see it separated out thus: .PP typedef void (*sighandler_t)(int); .br .BI "sighandler_t signal(int " signum ", sighandler_t " handler ); .PP According to POSIX, the behaviour of a process is undefined after it ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated by the \fIkill()\fP or the \fIraise()\fP functions. Integer division by zero has undefined result. On some architectures it will generate a SIGFPE signal. Ignoring this signal might lead to an endless loop. .SH "CONFORMING TO" ANSI C .SH "SEE ALSO" .BR kill "(1), " kill "(2), " killpg "(2), " pause "(2), " raise "(3), " .BR sigaction "(2), " signal "(7), " sigsetops "(3), " sigvec (2), .BR alarm (2).