• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/libc/
1<html lang="en">
2<head>
3<title>signal - Untitled</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Untitled">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Signals.html#Signals" title="Signals">
9<link rel="prev" href="raise.html#raise" title="raise">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<meta http-equiv="Content-Style-Type" content="text/css">
12<style type="text/css"><!--
13  pre.display { font-family:inherit }
14  pre.format  { font-family:inherit }
15  pre.smalldisplay { font-family:inherit; font-size:smaller }
16  pre.smallformat  { font-family:inherit; font-size:smaller }
17  pre.smallexample { font-size:smaller }
18  pre.smalllisp    { font-size:smaller }
19  span.sc    { font-variant:small-caps }
20  span.roman { font-family:serif; font-weight:normal; } 
21  span.sansserif { font-family:sans-serif; font-weight:normal; } 
22--></style>
23<link rel="stylesheet" type="text/css" href="../cs.css">
24</head>
25<body>
26<div class="node">
27<a name="signal"></a>
28<p>
29Previous:&nbsp;<a rel="previous" accesskey="p" href="raise.html#raise">raise</a>,
30Up:&nbsp;<a rel="up" accesskey="u" href="Signals.html#Signals">Signals</a>
31<hr>
32</div>
33
34<h3 class="section">7.3 <code>signal</code>&mdash;specify handler subroutine for a signal</h3>
35
36<p><a name="index-signal-426"></a><a name="index-g_t_005fsignal_005fr-427"></a><strong>Synopsis</strong>
37<pre class="example">     #include &lt;signal.h&gt;
38     void (*signal(int <var>sig</var>, void(*<var>func</var>)(int))) (int);
39     
40     void (*_signal_r(void *<var>reent</var>, int <var>sig</var>, void(*<var>func</var>)(int))) (int);
41     
42</pre>
43   <p><strong>Description</strong><br>
44<code>signal</code> provides a simple signal-handling implementation for embedded
45targets.
46
47   <p><code>signal</code> allows you to request changed treatment for a particular
48signal <var>sig</var>.  You can use one of the predefined macros <code>SIG_DFL</code>
49(select system default handling) or <code>SIG_IGN</code> (ignore this signal)
50as the value of <var>func</var>; otherwise, <var>func</var> is a function pointer
51that identifies a subroutine in your program as the handler for this signal.
52
53   <p>Some of the execution environment for signal handlers is
54unpredictable; notably, the only library function required to work
55correctly from within a signal handler is <code>signal</code> itself, and
56only when used to redefine the handler for the current signal value.
57
58   <p>Static storage is likewise unreliable for signal handlers, with one
59exception: if you declare a static storage location as `<code>volatile
60sig_atomic_t</code>', then you may use that location in a signal handler to
61store signal values.
62
63   <p>If your signal handler terminates using <code>return</code> (or implicit
64return), your program's execution continues at the point
65where it was when the signal was raised (whether by your program
66itself, or by an external event).  Signal handlers can also
67use functions such as <code>exit</code> and <code>abort</code> to avoid returning.
68
69   <p>The alternate function <code>_signal_r</code> is the reentrant version. 
70The extra argument <var>reent</var> is a pointer to a reentrancy structure.
71
72<!-- FIXME: do we have setjmp.h and assoc fns? -->
73   <p><br>
74<strong>Returns</strong><br>
75If your request for a signal handler cannot be honored, the result is
76<code>SIG_ERR</code>; a specific error number is also recorded in <code>errno</code>.
77
78   <p>Otherwise, the result is the previous handler (a function pointer or
79one of the predefined macros).
80
81   <p><br>
82<strong>Portability</strong><br>
83ANSI C requires <code>signal</code>.
84
85   <p>No supporting OS subroutines are required to link with <code>signal</code>, but
86it will not have any useful effects, except for software generated signals,
87without an operating system that can actually raise exceptions.
88
89   <p><br>
90
91   </body></html>
92
93