Symbian3/PDK/Source/GUID-B58D282E-E6EC-4AE1-96DB-30A5FB850563.dita
changeset 1 25a17d01db0c
child 5 f345bda72bc4
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-B58D282E-E6EC-4AE1-96DB-30A5FB850563" xml:lang="en"><title><codeph>exec()</codeph> without
       
    13 forking using <apiname>posix_spawn()</apiname></title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>A UNIX® program may exec without forking. The result is that the calling
       
    15 process executes another binary, but inherits certain properties, for example,
       
    16 file descriptors.  </p>
       
    17 <p>The P.I.P.S. equivalent would be to call <xref href="GUID-E7C4DE71-BC5B-34AE-ACB3-C34A0DB1FC16.dita"><apiname>posix_spawn()</apiname></xref> and
       
    18 pass any inherited data via <codeph>argv</codeph> parameters.  </p>
       
    19 <p>Note that if a parent process is waiting for the child to terminate then
       
    20 the termination of the newly created task must be synchronised. Therefore
       
    21 a <xref href="GUID-8F5C89A4-7813-32C7-973E-F7F0F3690BC6.dita"><apiname>waitpid()</apiname></xref> call should follow the <xref href="GUID-E7C4DE71-BC5B-34AE-ACB3-C34A0DB1FC16.dita"><apiname>posix_spawn()</apiname></xref> call
       
    22 so that it does not exit prematurely. Otherwise <xref href="GUID-FED685F4-5FAD-39F4-9812-3B0A85D8718C.dita"><apiname>exit()</apiname></xref> can
       
    23 be called after the posix_spawn().  </p>
       
    24 <p>Also, note that if the process which formerly executed and
       
    25 which now uses <xref href="GUID-E7C4DE71-BC5B-34AE-ACB3-C34A0DB1FC16.dita"><apiname>posix_spawn()</apiname></xref> stores its PID (for example,
       
    26 in the file system) to allow other processes to target it, then care must
       
    27 be taken to store the relevant PID (Process ID). This is because the PID for
       
    28 the newly spawned process may need to be stored instead.</p>
       
    29 </conbody></concept>