.\" 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. .\" .\" German translation by René Tschirley (gremlin@cs.tu-berlin.de) .\" Modified Mon Jun 10 21:00:42 1996 by Martin Schulze (joey@linux.de) .\" .TH SIGNAL 2 "10. Juni 1996" "Linux 1.0" "Systemaufrufe" .SH BEZEICHNUNG signal \- ANSI C Signalmanagement .SH ÜBERSICHT .B #include .sp 2 .BI "void (*signal(int " signum ", void (*" handler ")(int)))(int);" .SH BESCHREIBUNG Der Systemaufruf .B signal trägt einen neuen Signalhandler für das Signal mit der Nummer .I signum ein. Der Signalhandler wird auf .I handler gesetzt, die eine benutzerdefinierte Funktion oder eines der folgenden Makros sein darf: .RS .TP .B SIG_IGN Das Signal ist zu ignorieren. .TP .B SIG_DFL Setzt das Signal auf das voreingestellte Verhalten zurück. .RE .PP Das Ganzzahlargument, das an den Signalhandler durchgereicht wird, ist die Signalnummer. Dadurch wird es möglich, einen Signalhandler für mehrere Signale zu verwenden. Signalhandler sind Routinen, die aufgerufen werden wenn der Prozess ein entsprechendes Signal empfängt. Mittels .BR alarm (2), das ein .B SIGALRM schickt, kann der Prozess z.B. an regelmäßige Aufgaben erinnert werden. So kann auch erreicht werden, dass der Prozess z.B. seine Konfigurationsdateien neu einliest. .SH "RÜCKGABEWERT" .B signal liefert den vorherigen Signalhandler zurück oder .B SIG_ERR bei aufgetretenem Fehler. .SH ANMERKUNGEN Für .B SIGKILL und .B SIGSTOP können keine Signalhandler gesetzt werden. .PP Im Gegensatz zu BSD-Systemen werden Signale unter Linux auf das voreingestellte Verhalten zurückgesetzt, wenn das Signal ausgelöst wurde. .PP Wenn Sie vielleicht erstaunt über den Prototypen oben sind, betrachten Sie Folgendes: .PP typedef void (*sighandler_t)(int); .br .BI "sighandler_t signal(int " signum ", sighandler_t " handler ); .SH "KOMPATIBEL ZU" ANSI C .SH "SIEHE AUCH" .BR kill (1), .BR kill (2), .BR killpg (2), .BR pause (2), .BR raise (3), .BR sigaction (2), .BR signal (7), .BR sigsetops (3), .BR sigvec (2), .BR alarm (2).