signalHandling_8c-source.html 3.92 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>xmlrpc: system/signalHandling.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<h1>system/signalHandling.c</h1><a href="signalHandling_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include &lt;signal.h&gt;</span>     <span class="comment">/* for signal() and signal names */</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="preprocessor">#include "../include/monitor.h"</span>
<a name="l00004"></a>00004 
<a name="l00005"></a><a class="code" href="signalHandling_8c.html#960e985a396acaabb1bbed4f15668ade">00005</a> <span class="keyword">volatile</span> <span class="keywordtype">int</span> <a class="code" href="signalHandling_8h.html#960e985a396acaabb1bbed4f15668ade">doShutdown</a>;
<a name="l00006"></a>00006 
<a name="l00007"></a><a class="code" href="signalHandling_8c.html#64612b9588ed0fb05d70680db02b3630">00007</a> <span class="keywordtype">void</span> <a class="code" href="signalHandling_8h.html#64612b9588ed0fb05d70680db02b3630">terminate</a>(<span class="keywordtype">int</span> signum)
<a name="l00008"></a>00008 {
<a name="l00009"></a>00009     signal(signum, SIG_IGN);
<a name="l00010"></a>00010     <a class="code" href="monitor_8h.html#5d332cf84a9d6dd9c77382a74960cccf">syslogMonitor</a>(LOG_INFO, <a class="code" href="monitor_8h.html#d702c7f3311c0b76ee05d7efd27c87b2">MON_INFO</a>, <span class="stringliteral">"signals"</span>,
<a name="l00011"></a>00011                   <span class="stringliteral">"caugth deadly signal %d, service terminated"</span>, signum);
<a name="l00012"></a>00012     <a class="code" href="signalHandling_8h.html#960e985a396acaabb1bbed4f15668ade">doShutdown</a> = 1;
<a name="l00013"></a>00013 }
<a name="l00014"></a>00014 
<a name="l00015"></a><a class="code" href="signalHandling_8c.html#1de31bdef82f181f8045b94ae0933916">00015</a> <span class="keywordtype">void</span> <a class="code" href="signalHandling_8h.html#1de31bdef82f181f8045b94ae0933916">init_signals</a>(<span class="keywordtype">void</span>)
<a name="l00016"></a>00016 {
<a name="l00017"></a>00017     signal(SIGTERM, <a class="code" href="signalHandling_8h.html#64612b9588ed0fb05d70680db02b3630">terminate</a>);
<a name="l00018"></a>00018     signal(SIGHUP, SIG_IGN);
<a name="l00019"></a>00019     signal(SIGINT, <a class="code" href="signalHandling_8h.html#64612b9588ed0fb05d70680db02b3630">terminate</a>);
<a name="l00020"></a>00020     signal(SIGQUIT, <a class="code" href="signalHandling_8h.html#64612b9588ed0fb05d70680db02b3630">terminate</a>);
<a name="l00021"></a>00021     signal(SIGABRT, <a class="code" href="signalHandling_8h.html#64612b9588ed0fb05d70680db02b3630">terminate</a>);
<a name="l00022"></a>00022     signal(SIGALRM, SIG_IGN);
<a name="l00023"></a>00023     signal(SIGURG, SIG_IGN);
<a name="l00024"></a>00024 
<a name="l00025"></a>00025     signal(SIGPIPE, SIG_IGN);
<a name="l00026"></a>00026 }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Sun Oct 10 01:24:35 2010 for xmlrpc by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>