Content deleted Content added
Hannes Röst (talk | contribs) Adding local short description: "Handling of signals in the C programming language", overriding Wikidata description "header file" (Shortdesc helper) |
No edit summary |
||
Line 8:
{{see also|Unix signal}}
The C standard defines only 6 signals. They are all defined in <code>signal.h</code> header (<code>csignal</code> header in [[C++]]):<ref name=c99>{{cite book | url=
*<code>SIGABRT</code> - "abort", abnormal termination.
Line 17:
*<code>SIGTERM</code> - "terminate", termination request sent to the program.
Additional signals may be specified in the <code>signal.h</code> header by the implementation. For example, Unix and [[Unix-like]] operating systems (such as [[Linux]]) define more than 15 additional signals; see [[Unix signal]].<ref name="sus">{{cite web | url=
=== Debugging ===
Line 28:
A signal handler is a [[Function (computer science)|function]] which is called by the target environment when the corresponding signal occurs. The target environment suspends execution of the program until the signal handler returns or calls <code>longjmp()</code>.
Signal handlers can be set with <code>signal()</code> or <code>sigaction()</code>. The behavior of <code>signal()</code> has been changed multiple times across history and is now considered deprecated.<ref>
If the signal reports an error within the program (and the signal is not asynchronous), the signal handler can terminate by calling <code>abort()</code>, <code>exit()</code>, or <code>longjmp()</code>.
Line 38:
! Description
|-
| {{anchor|raise}}<code>[
| artificially sends a signal to the calling process
|-
Line 44:
|artificially sends a signal to a specified process
|-
| {{anchor|signal}}<code>[
| sets the action taken when the program receives a specific signal
|}
|