1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
.\" Copyright (c) 1994 Mike Battersby <mike@starbug.apana.org.au>
.\" 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
.\" FIXME - error conditions need to be documented
.\" Modified Mon Jun 10 21:00:42 1996 by Martin Schulze <joey@linux.de>
.\" Modified Wed Aug 27 21:09:52 1997 by Nicols Lichtmaier <nick@debian.org>
.\"
.\" Translated into Spanish Fri Jan 30 1998 by Gerardo Aburruzaga
.\" Garca <gerardo.aburruzaga@uca.es>
.\"
.TH SIGNAL 2 "21 Agosto 1997" "Linux 2.0" "Manual del Programador Linux"
.SH NOMBRE
signal \- manejo de seales segn C ANSI
.SH SINOPSIS
.B #include <signal.h>
.sp 2
.BI "void (*signal(int " signum ", void (*" manejador ")(int)))(int);"
.SH DESCRIPCIN
La llamada al sistema
.B signal
instala un nuevo manejador de seal para la seal cuyo nmero es
.I signum.
El manejador de seal se establece como
.IR manejador ,
que puede ser una funcin especificada por el usuario, o una de las
siguientes macros:
.RS
.TP
.B SIG_IGN
No tener en cuenta la seal.
.TP
.B SIG_DFL
Dejar la seal con su comportamiento predefinido.
.RE
.PP
El argumento entero que se pasa a la rutina de manejo de seal es el
nmero de la seal. Esto hace posible emplear un mismo manejador de
seal para varias de ellas.
Los manejadores de seales son rutinas que se llaman en cualquier momento en
el que el proceso recibe la seal correspondiente. Usando la funcin
.BR alarm (2),
que envia una seal
.B SIGALRM
al proceso, es posible manejar fcilmente trabajos regulares.
A un proceso tambin se le puede decir que relea sus ficheros de
configuracin usando un manejador de seal (normalmente, la seal es
SIGHUP).
.SH "VALOR DEVUELTO"
.B signal
devuelve el valor anterior del manejador de seal, o
.B SIG_ERR
si ocurre un error.
.SH OBSERVACIONES
No se pueden instalar manejadores para las seales
.B SIGKILL
ni
.BR SIGSTOP .
.PP
Desde libc6,
.B signal
usa la semntica BSD y el comportamiento por defecto es no reasignar una
seal a su comportamiento por defecto. Puede usar
.B sysv_signal
para obtener la semntica SysV.
.PP
Ambas,
.BR signal " and " sysv_signal
son rutinas de biblioteca construidas sobre
.BR sigaction (2).
.PP
Si usted no entiende bien el prototipo del principio de esta pgina,
puede ayudar el verlo separado as:
.PP
typedef void (*sighandler_t)(int);
.br
.BI "sighandler_t signal(int " signum ", sighandler_t " manejador );
.PP
De acuerdo con POSIX, el comportamiento de un proceso es indefinido
despus de no hacer caso a una seal
.BR SIGFPE ", " SIGILL " o " SIGSEGV
que no ha sido generada por las funciones
.BR kill (2)
ni
.BR raise (2) .
La divisin entera por cero tiene un resultado indefinido.
En algunas arquitecturas generar una seal
.B SIGFPE.
No hacer caso a esta seal puede conducir a un bucle infinito.
.SH "CONFORME CON"
C ANSI
.SH "VASE TAMBIN"
.BR kill "(1), " kill "(2), " killpg "(2), " pause "(2), " raise "(3), "
.BR sigaction "(2), " signal "(7), " sigsetops "(3), " sigvec (2),
.BR alarm (2).
|