Question: 10. What happnes as the signal SIGINT hits the current process in the program?<div class="hk1_style-wrap4"><div class="hk1_style-wrap3"><div class="hk1_style-wrap2"><div class="hk1_style-wrap"><div class="hk1_style"><div class="c"><ol><li class="li1"><pre class="de1"> <span class="co2">#include&lt;stdio.h&gt;</span></pre></li><li class="li1"><pre class="de1"> <span class="co2">#include&lt;signal.h&gt;</span></pre></li><li class="li1"><pre class="de1">&nbsp;</pre></li><li class="li1"><pre class="de1"> <span class="kw4">void</span> response <span class="br0">(</span><span class="kw4">int</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">void</span> response <span class="br0">(</span><span class="kw4">int</span> sig_no<span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Linux<span class="es1">\n</span>"</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw4">struct</span> sigaction act<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> act.<span class="me1">sa_handler</span> <span class="sy0">=</span> response<span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> act.<span class="me1">sa_flags</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> sigemptyset<span class="br0">(</span><span class="sy0">&amp;</span>act.<span class="me1">sa_mask</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> sigaction<span class="br0">(</span>SIGINT<span class="sy0">,&amp;</span>act<span class="sy0">,</span><span class="nu0">0</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">while</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span><span class="br0">{</span></pre></li><li class="li1"><pre class="de1"> <span class="kw3">printf</span><span class="br0">(</span><span class="st0">"Sanfoundry<span class="es1">\n</span>"</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> sleep<span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li><li class="li1"><pre class="de1"> <span class="kw1">return</span> <span class="nu0">0</span><span class="sy0">;</span></pre></li><li class="li1"><pre class="de1"> <span class="br0">}</span></pre></li></ol></div></div></div></div></div></div>
Options:
the process terminates
the string “Linux” prints
the string “Linux” prints and then process terminates
none of the mentioned
Answer: B