[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    icecream/daemon
From:       Dirk Mueller <mueller () kde ! org>
Date:       2006-09-03 20:22:35
Message-ID: 1157314955.016428.2466.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 580537 by mueller:

- fix sigchld handling again
- add -pipe to the command line to reduce disk usage


 M  +12 -2     main.cpp  
 M  +8 -10     workit.cpp  


--- trunk/icecream/daemon/main.cpp #580536:580537
@@ -270,6 +270,10 @@
     }
 };
 
+static void empty_func( int )
+{
+}
+
 static int set_new_pgrp(void)
 {
     /* If we're a session group leader, then we are not able to call
@@ -1027,6 +1031,11 @@
 
 #endif
 
+    /* reap zombis */
+    int status;
+    while (waitpid(-1, &status, WNOHANG) < 0 && errno == EINTR)
+        ;
+
     handle_old_request();
 
     /* collect the stats after the children exited icecream_load */
@@ -1427,10 +1436,11 @@
         exit( EXIT_DISTCC_FAILED );
     }
 
-    if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
-        log_warning() << "signal(SIGCHLD, ignore) failed: " << strerror(errno) << endl;
+    if (signal(SIGCHLD, empty_func) == SIG_ERR) {
+        log_warning() << "signal(SIGCHLD) failed: " << strerror(errno) << endl;
         exit( EXIT_DISTCC_FAILED );
     }
+
     /* This is called in the master daemon, whether that is detached or
      * not.  */
     dcc_master_pid = getpid();
--- trunk/icecream/daemon/workit.cpp #580536:580537
@@ -228,6 +228,7 @@
         argc++; // the program
         argc += 6; // -x c - -o file.o -fpreprocessed
         argc += 4; // gpc parameters
+        argc += 1; // -pipe
         char **argv = new char*[argc + 1];
 	int i = 0;
         if (j.language() == CompileJob::Lang_C)
@@ -237,13 +238,16 @@
         else
             assert(0);
 
-        //TODOlist.push_back( "-Busr/lib/gcc-lib/i586-suse-linux/3.3.1/" );
-
+        bool hasPipe = false;
         for ( std::list<string>::const_iterator it = list.begin();
               it != list.end(); ++it) {
+            if(*it == "-pipe")
+                hasPipe = true;
             argv[i++] = strdup( it->c_str() );
         }
         argv[i++] = strdup("-fpreprocessed");
+        if(!hasPipe)
+           argv[i++] = strdup("-pipe");
         argv[i++] = strdup("-x");
         argv[i++] = strdup((j.language() == CompileJob::Lang_CXX) ? "c++" : "c");
         argv[i++] = strdup( "-" );
@@ -257,14 +261,8 @@
         argv[i++] = strdup( buffer );
         // before you add new args, check above for argc
         argv[i] = 0;
-	if (i > argc)
-	    printf ("Ohh bummer.  You can't count.\n");
-#if 0
-        printf( "forking " );
-        for ( int index = 0; argv[index]; index++ )
-            printf( "%s ", argv[index] );
-        printf( "\n" );
-#endif
+        assert(i <= argc);
+
         close_debug();
         dup2 (sock_out[1], STDOUT_FILENO );
         close(sock_out[1]);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic