signal.h

signal.h

signal.h es un archivo de cabecera definido en la Biblioteca Estandar C para especificar como un programa maneja señales mientras se ejecuta. Una señal puede reportar un comportamiento excepcional en el programa (tales como la división por cero ), o una señal puede reportar algún evento asíncrono fuera del programa (como alguien esta pulsando una tecla de atención interactiva en el teclado)

Una señal puede ser generada llamando a raise (para enviar una señal al proceso actual) o kill (para enviar una señal a cualquier proceso). Cada implementación define lo que genera las señales (en su caso) y en qué circunstancias las genera. Una implementación puede definir otras señales además de las que figuran en esta lista. La cabecera estándar <signal.h> pueden definir macros adicionales con nombres que empiezan con SIG para especificar los valores de señales adicionales. Todos los valores son expresiones constantes enteras >= 0.

Un manejador de la señal se puede especificar para todas las señales excepto dos (SIGKILL y SIGSTOP no puede ser atrapadas, bloqueadas o ignoradas). Un manejador de la señal es una función que el entorno de destino llama cuando se produce la señal correspondiente. El entorno de destino suspende la ejecución del programa hasta que vuelva la señal de controlador o llama a longjmp. Para una máxima portabilidad, un manejador de la señal asíncrona sólo debe:

  • hacer llamadas (que tienen éxito) a la señal de la función
  • asignar valores a los objetos de tipo volátiles sig_atomic_t
  • devolver el control a la función que la llamó

Si la señal informa de un error en el programa (y la señal no es asincrónica), el manejador de la señal puede terminala llamando a abort, exit, o longjmp.

Contenido

Funciones miembro

  • int raise(int sig). Envia una señal artificialmente.
  • psignal(int sig, const char *s), devuelve a stderr una cadena que representa un numero de señal. Esta en 4.3BSD, Solaris y Linux, pero no esta especificada por POSIX o SUS.

En los mismos sistemas, string.h contiene la funcion no estandar strsignal(int sig) que opera de la misma forma que strerror.

  • void* signal(int sig, void (*func)(int)), establece las medidas adoptadas cuando el programa recibe la señal sig. Si el valor de func es SIG_DFL, se usará el manejo por defecto para esa señal. Si el valor de func es SIG_IGN, la señal será ignorada. De lo contrario se apuntará a una función manejador de señal que se llamará cuando la señar se active.

The function func may terminate by executing a return statement or by calling the abort, exit or longjmp functions. If func executes a return statement, and the value of sig was SIGFPE or any other implementation-defined value corresponding to a computational exception, the behavior is undefined. Otherwise, the program will resume execution at the point it was interrupted. If the function returns and the return request can be honored, the signal function returns the value of func for the most recent call to signal for the specified signal sig. Otherwise a value of SIG_ERR is returned and a positive value is stored in errno.

If the signal occurs other than as the result of calling the abort or raise function, the behavior is undefined if the signal handler calls any function in the standard library other than the signal function itself (with a first argument of the signal number corresponding to the signal that cause the invocation of the handler) or refers to any object with status storage duration other than by assigning to a static storage duration variable of type volatile sig_atomic_t. Furthermore, if such a call to the signal function results in a SIG_ERR return, the value of errno is indeterminate. [1]

Tipos miembro

typedef i-type sig_atomic_t

Macros miembro

  • SIG_DFL - Usado para seleccionar el manejo por defecto.
  • SIG_IGN - Usado para manejar una señal ignorandola.
  • SIG_ERR - Un numero usado para errores.

Constantes Miembro

Constante Significado Sistemas
SIGHUP Hangup POSIX
SIGINT Interrupt ANSI
SIGQUIT Quit POSIX
SIGILL Illegal instruction ANSI
SIGABRT Abort ANSI
SIGTRAP Trace trap POSIX
SIGIOT IOT trap 4.2 BSD
SIGEMT EMT trap 4.2 BSD
SIGINFO Information 4.2 BSD
SIGFPE Floating-point exception ANSI
SIGKILL Kill, unblock-able POSIX
SIGBUS Bus error 4.2 BSD
SIGSEGV Segmentation violation ANSI
SIGSYS Bad argument to system call 4.2 BSD
SIGPIPE Broken pipe POSIX
SIGALRM Alarm clock POSIX
SIGTERM Termination ANSI
SIGUSR1 User-defined signal 1 POSIX
SIGUSR2 User-defined signal 2 POSIX
SIGCHLD Child status has changed POSIX
SIGCLD Same as SIGCHLD System V
SIGPWR Power failure restart System V
SIGXCPU Exceeded CPU time POSIX
SIGSTOP Pause execution POSIX
SIGCONT Resume execution POSIX

Enlaces externos

Véase también


Wikimedia foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Mira otros diccionarios:

  • signal — signal, aux [ siɲal, o ] n. m. • 1540; « signe distinctif, cachet » déb. XIIIe; réfect., d apr. signe, de seignal; bas lat. signale, neutre subst. de signalis « qui sert de signe » 1 ♦ Signe convenu (geste, son...) fait par qqn pour indiquer le… …   Encyclopédie Universelle

  • Signal.h — is a header file defined in the C Standard Library to specify how a program handles signals while it executes. A signal can report some exceptional behavior within the program ( such as division by zero ), or a signal can report some asynchronous …   Wikipedia

  • Signal — Signal, signals, signaling, or signalling may refer to: Scientific concepts * Signal (electrical engineering), a physical quantity that can carry information. * Signal processing, the field of techniques used to extract information from signals * …   Wikipedia

  • Signal — Sig nal, a. [From signal, n.: cf. F. signal[ e].] 1. Noticeable; distinguished from what is ordinary; eminent; remarkable; memorable; as, a signal exploit; a signal service; a signal act of benevolence. [1913 Webster] As signal now in low,… …   The Collaborative International Dictionary of English

  • signal — SIGNÁL, signale, s.n. (Rar) 1. Semnal convenţional emis de o sirenă, de un fluier etc. 2. Fluier mic de metal (cu care se dau aceste semnale convenţionale). – Din fr. signal. Trimis de LauraGellner, 22.07.2004. Sursa: DEX 98  SIGNÁL s. v.… …   Dicționar Român

  • Signal.h — Стандартная библиотека языка программирования С assert.h complex.h ctype.h errno.h fenv.h float.h inttypes.h iso646.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h …   Википедия

  • Signal FM — Langue Français, Créole Pays  Haiti !Haïti Statut …   Wikipédia en Français

  • signal — sìgnāl m <G signála> DEFINICIJA 1. znak koji služi da bi se dojavila poruka ili upozorenje [crvena krpa predstavljat će signal za upozorenje] 2. stvar, znak i sl. koji ukazuje da će se nešto početi događati [dim iz vulkana je signal moguće… …   Hrvatski jezični portal

  • Signal — Sn std. (17. Jh.) Entlehnung. Entlehnt aus frz. signal m., zu l. sīgnālis bestimmt, ein Zeichen zu geben , zu l. sīgnum Zeichen, Kennzeichen, Merkmal . Verb: signalisieren.    Ebenso nndl. signaal, ne. signal, nfrz. signal, nschw. signal, nnorw.… …   Etymologisches Wörterbuch der deutschen sprache

  • Signal — Saltar a navegación, búsqueda Signal era órgano de propaganda principal publicado no tanto por los nazis cuanto por el Ejército Alemán durante la Segunda Guerra Mundial. Era famoso por sus fotografías en color de calidad, lo que en la época… …   Wikipedia Español

  • signal — sub. m. Signe que l on donne pour servir d advertissement. Faire un signal. donner le signal. à ce signal ils mirent tous l espée à la main. ils tirerent trois coups de canon pour signal. On leur fit plusieurs signaux. ils firent les signaux dont …   Dictionnaire de l'Académie française

Compartir el artículo y extractos

Link directo
Do a right-click on the link above
and select “Copy Link”