wvtest/cpp/wvtest.cc
static bool no_running_children()
{
#ifndef _WIN32
    pid_t wait_result;

    // Acknowledge and complain about any zombie children
    do
    {
	int status = 0;
        wait_result = waitpid(-1, &status, WNOHANG);

        if (wait_result > 0)
        {
            char buf[256];
            snprintf(buf, sizeof(buf) - 1, "%d", wait_result);
            buf[sizeof(buf)-1] = '\0';
            WVFAILEQ("Unclaimed dead child process", buf);
        }
    } while (wait_result > 0);

    // There should not be any running children, so waitpid should return -1
    WVPASSEQ(errno, ECHILD);
    WVPASSEQ(wait_result, -1);
    return (wait_result == -1 && errno == ECHILD);
#endif
    return true;
}
// Return 1 if no children are running or zombies, 0 if there are any running
// or zombie children.
// Will wait for any already-terminated children first.
// Passes if no rogue children were running, fails otherwise.
// If your test gets a failure in here, either you're not killing all your
// children, or you're not calling waitpid(2) on all of them.
Return 1 if no children are running or zombies, 0 if there are any running
or zombie children.
Will wait for any already-terminated children first.
Passes if no rogue children were running, fails otherwise.
If your test gets a failure in here, either you're not killing all your
children, or you're not calling waitpid(2) on all of them.
Return 1 if no children are running or zombies 0 if there are any running or zombie children . Will wait for any already - terminated children first . Passes if no rogue children were running fails otherwise . If your test gets a failure in here either you ' re not killing all your children or you ' re not calling waitpid ( 2 ) on all of them .
static bool no_running_children()
{
#ifndef _WIN32
    pid_t wait_result;
    do
    {
	int status = 0;
        wait_result = waitpid(-1, &status, WNOHANG);
        if (wait_result > 0)
        {
            char buf[256];
            snprintf(buf, sizeof(buf) - 1, "%d", wait_result);
            buf[sizeof(buf)-1] = '\0';
            WVFAILEQ("Unclaimed dead child process", buf);
        }
    } while (wait_result > 0);
    WVPASSEQ(errno, ECHILD);
    WVPASSEQ(wait_result, -1);
    return (wait_result == -1 && errno == ECHILD);
#endif
    return true;
}
static bool no_running_children ( ) { #ifndef _WIN32 pid_t wait_result ; do { int status = 0 ; wait_result = waitpid ( -1 , & status , WNOHANG ) ; if ( wait_result > 0 ) { char buf [ 256 ] ; snprintf ( buf , sizeof ( buf ) - 1 , " " , wait_result ) ; buf [ sizeof ( buf ) - 1 ] = ' \0 ' ; WVFAILEQ ( " " , buf ) ; } } while ( wait_result > 0 ) ; WVPASSEQ ( errno , ECHILD ) ; WVPASSEQ ( wait_result , -1 ) ; return ( wait_result == -1 && errno == ECHILD ) ; #endif return true ; }
Return 1 if no children are running or zombies, 0 if there are any running
or zombie children.
Return 1 if no children are running or zombies 0 if there are any running or zombie children .
// Acknowledge and complain about any zombie children // There should not be any running children, so waitpid should return -1