VirtualBox

Changeset 33009 in vbox


Ignore:
Timestamp:
Oct 8, 2010 12:37:24 PM (14 years ago)
Author:
vboxsync
Message:

Runtime/Process: avoid a hanging around zombie process when creating a detached process on posix platforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/process-posix.cpp

    r32990 r33009  
    4545#endif
    4646#if defined(RT_OS_LINUX) || defined(RT_OS_OS2)
     47/* While Solaris has posix_spawn() of course we don't want to use it as
     48 * we need to have the child in a different process contract, no matter
     49 * whether it is started detached or not. */
    4750# define HAVE_POSIX_SPAWN 1
    4851#endif
     
    526529            if (phProcess)
    527530                *phProcess = pid;
     531            else if (fFlags & (RTPROC_FLAGS_DAEMONIZE_DEPRECATED | RTPROC_FLAGS_DETACHED))
     532            {
     533                /* If the process is detached straight away wait for the
     534                 * intermediate process to exit (it should do that quickly)
     535                 * if the caller didn't want to know the PID. If it wants the
     536                 * PID it's his job to wait for it or he gets a zombie. */
     537                waitpid(pid, NULL, 0);
     538            }
    528539            return VINF_SUCCESS;
    529540        }
     
    561572
    562573    /*
    563      * Performe the wait.
     574     * Perform the wait.
    564575     */
    565576    int iStatus = 0;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette