Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-186B9876-2A08-5F23-BB49-49EC34C51507"><title>Using Signals to Terminate Processes</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>A P.I.P.S. process can terminate another P.I.P.S process by sending a <codeph>SIGKILL</codeph> or a <codeph>SIGTERM</codeph> signal to it using <xref href="GUID-16DC4A9D-44BC-36E2-AB97-5E9E7521937D.dita"><apiname>kill()</apiname></xref> or <xref href="GUID-3C70BF0B-CD6E-3A30-A9E6-4CCF11D47EEC.dita"><apiname>sigqueue()</apiname></xref>. </p> <p> <codeph>SIGKILL</codeph> terminates a process without any notification. Typically it used by a parent process to manage its children, or by a system utility to terminate other applications. </p> <p> <b>Note:</b> Your process must have the <b>PowerMangement</b> capability to send a SIGKILL signal to another process. </p> <p> <codeph> SIGTERM</codeph> is a request for termination. The receiving process can choose to shutdown gracefully or ignore the request. The following example code demonstrates how you can handle a <codeph>SIGTERM</codeph> signal and shutdown a process: </p> <codeblock id="GUID-F07EC689-C3DD-51BF-BFA8-6A430D42814A" xml:space="preserve">#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
void sighandler(int signum)
{
if(signum == SIGTERM)
{
// Perform clean up
exit(-1);
}
else
printf(“Error: Unknown signal”);
}
int main()
{
signal(SIGTERM,sighandler); // When SIGTERM arrives, invoke sighandler()
// program logic
return 0;
}</codeblock> </conbody><related-links><link href="GUID-66C1493D-5B85-558A-9A39-454E6EBA307B.dita"><linktext>Signal Emulation on Symbian
Platform</linktext> </link> <link href="GUID-E65D91AE-482F-5592-B83C-0F29126C2EFA.dita"><linktext>Using Signals to Handle Exceptions</linktext> </link> <link href="GUID-6CF8A41B-C2DD-5D57-A71D-6405CE08A06B.dita"><linktext>Using Signals to Handle Asynchronous
Events</linktext> </link> </related-links></concept>