proc.c
static void configure_child_limits(gpointer userdata)
{
    // Some of these may fail, not sure what to do.
    for (gint i = 0; i < RLIMIT_NLIMITS; i++) {
        if (setrlimit(i, &kChildLimits[i]) == -1) {
            g_critical("a call to setrlimit for %u failed(), %m", i);
        }
    }

    // Try to cleanup if we get killed.
    prctl(PR_SET_PDEATHSIG, SIGKILL);

    // Make sure we create a new pgrp so that we can kill all subprocesses.
    setpgid(0, 0);

    // Try to be as consistent as possible.
    personality(personality(~0) | ADDR_NO_RANDOMIZE);

    // Useful to help debug synchronization problems.
    if (kSleepSeconds)
        g_usleep(kSleepSeconds * G_USEC_PER_SEC);

    return;
}
// This routine is called in the child process before the execve(), so it's
// useful for configuring limits and file descriptors, prctl and so on. Note
// that intefering with the heap will most likely deadlock the process (even
// calling g_message or whatever, which can cause a malloc()).
This routine is called in the child process before the execve(), so it's
useful for configuring limits and file descriptors, prctl and so on. Note
that intefering with the heap will most likely deadlock the process (even
calling g_message or whatever, which can cause a malloc()).
This routine is called in the child process before the execve () so it ' s useful for configuring limits and file descriptors prctl and so on . Note that intefering with the heap will most likely deadlock the process ( even calling g_message or whatever which can cause a malloc () ) .
static void configure_child_limits(gpointer userdata)
{
    for (gint i = 0; i < RLIMIT_NLIMITS; i++) {
        if (setrlimit(i, &kChildLimits[i]) == -1) {
            g_critical("a call to setrlimit for %u failed(), %m", i);
        }
    }
    prctl(PR_SET_PDEATHSIG, SIGKILL);
    setpgid(0, 0);
    personality(personality(~0) | ADDR_NO_RANDOMIZE);
    if (kSleepSeconds)
        g_usleep(kSleepSeconds * G_USEC_PER_SEC);
    return;
}
static void configure_child_limits ( gpointer userdata ) { for ( gint i = 0 ; i < RLIMIT_NLIMITS ; i ++ ) { if ( setrlimit ( i , & kChildLimits [ i ] ) == -1 ) { g_critical ( " " , i ) ; } } prctl ( PR_SET_PDEATHSIG , SIGKILL ) ; setpgid ( 0 , 0 ) ; personality ( personality ( ~ 0 ) | ADDR_NO_RANDOMIZE ) ; if ( kSleepSeconds ) g_usleep ( kSleepSeconds * G_USEC_PER_SEC ) ; return ; }
This routine is called in the child process before the execve(), so it's
useful for configuring limits and file descriptors, prctl and so on.
This routine is called in the child process before the execve () so it ' s useful for configuring limits and file descriptors prctl and so on .
// Some of these may fail, not sure what to do. // Try to cleanup if we get killed. // Make sure we create a new pgrp so that we can kill all subprocesses. // Try to be as consistent as possible. // Useful to help debug synchronization problems.