Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 3 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>Signals (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="Signals (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="Signals (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="index.html#Top" rel="up" title="Top">
  16. <link href="psignal.html#psignal" rel="next" title="psignal">
  17. <link href="wcwidth.html#wcwidth" rel="prev" title="wcwidth">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="Signals"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="Timefns.html#Timefns" accesskey="n" rel="next">Timefns</a>, Previous: <a href="Wchar-strings.html#Wchar-strings" accesskey="p" rel="prev">Wchar strings</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="Signal-Handling-_0028signal_002eh_0029"></a>
  54. <h2 class="chapter">7 Signal Handling (<samp>signal.h</samp>)</h2>
  55. <p>A <em>signal</em> is an event that interrupts the normal flow of control
  56. in your program. Your operating environment normally defines the full
  57. set of signals available (see <samp>sys/signal.h</samp>), as well as the
  58. default means of dealing with them&mdash;typically, either printing an
  59. error message and aborting your program, or ignoring the signal.
  60. </p>
  61. <p>All systems support at least the following signals:
  62. </p><dl compact="compact">
  63. <dt><code>SIGABRT</code></dt>
  64. <dd><p>Abnormal termination of a program; raised by the <code>abort</code> function.
  65. </p>
  66. </dd>
  67. <dt><code>SIGFPE</code></dt>
  68. <dd><p>A domain error in arithmetic, such as overflow, or division by zero.
  69. </p>
  70. </dd>
  71. <dt><code>SIGILL</code></dt>
  72. <dd><p>Attempt to execute as a function data that is not executable.
  73. </p>
  74. </dd>
  75. <dt><code>SIGINT</code></dt>
  76. <dd><p>Interrupt; an interactive attention signal.
  77. </p>
  78. </dd>
  79. <dt><code>SIGSEGV</code></dt>
  80. <dd><p>An attempt to access a memory location that is not available.
  81. </p>
  82. </dd>
  83. <dt><code>SIGTERM</code></dt>
  84. <dd><p>A request that your program end execution.
  85. </p></dd>
  86. </dl>
  87. <p>Two functions are available for dealing with asynchronous
  88. signals&mdash;one to allow your program to send signals to itself (this is
  89. called <em>raising</em> a signal), and one to specify subroutines (called
  90. <em>handlers</em> to handle particular signals that you anticipate may
  91. occur&mdash;whether raised by your own program or the operating environment.
  92. </p>
  93. <p>To support these functions, <samp>signal.h</samp> defines three macros:
  94. </p>
  95. <dl compact="compact">
  96. <dt><code>SIG_DFL</code></dt>
  97. <dd><p>Used with the <code>signal</code> function in place of a pointer to a
  98. handler subroutine, to select the operating environment&rsquo;s default
  99. handling of a signal.
  100. </p>
  101. </dd>
  102. <dt><code>SIG_IGN</code></dt>
  103. <dd><p>Used with the <code>signal</code> function in place of a pointer to a
  104. handler, to ignore a particular signal.
  105. </p>
  106. </dd>
  107. <dt><code>SIG_ERR</code></dt>
  108. <dd><p>Returned by the <code>signal</code> function in place of a pointer to a
  109. handler, to indicate that your request to set up a handler could not
  110. be honored for some reason.
  111. </p></dd>
  112. </dl>
  113. <p><samp>signal.h</samp> also defines an integral type, <code>sig_atomic_t</code>.
  114. This type is not used in any function declarations; it exists only to
  115. allow your signal handlers to declare a static storage location where
  116. they may store a signal value. (Static storage is not otherwise
  117. reliable from signal handlers.)
  118. </p>
  119. <table class="menu" border="0" cellspacing="0">
  120. <tr><td align="left" valign="top">&bull; <a href="psignal.html#psignal" accesskey="1">psignal</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Print a signal message to standard error
  121. </td></tr>
  122. <tr><td align="left" valign="top">&bull; <a href="raise.html#raise" accesskey="2">raise</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Send a signal
  123. </td></tr>
  124. <tr><td align="left" valign="top">&bull; <a href="signal.html#signal" accesskey="3">signal</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Specify handler subroutine for a signal
  125. </td></tr>
  126. </table>
  127. <hr>
  128. <div class="header">
  129. <p>
  130. Next: <a href="Timefns.html#Timefns" accesskey="n" rel="next">Timefns</a>, Previous: <a href="Wchar-strings.html#Wchar-strings" accesskey="p" rel="prev">Wchar strings</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  131. </div>
  132. </body>
  133. </html>