gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16286 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r16286 - gnunet/src/util
Date: Mon, 1 Aug 2011 22:34:27 +0200

Author: grothoff
Date: 2011-08-01 22:34:26 +0200 (Mon, 01 Aug 2011)
New Revision: 16286

Modified:
   gnunet/src/util/os_priority.c
Log:
LRN: Fix _kill() debugging and I/O interpretation

* Don't be verbose by default anymore - use #if DEBUG_OS
* Don't count a failure to write into a control pipe as an error
  this DOES happen when the child is dead (which is how a utility
    should be when it finishes)



Modified: gnunet/src/util/os_priority.c
===================================================================
--- gnunet/src/util/os_priority.c       2011-08-01 20:33:26 UTC (rev 16285)
+++ gnunet/src/util/os_priority.c       2011-08-01 20:34:26 UTC (rev 16286)
@@ -161,18 +161,29 @@
 GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
 {
 #if ENABLE_WINDOWS_WORKAROUNDS
-  int res;
-  int ret;
+  int res = 0;
+  int ret = 0;
 
   ret = GNUNET_DISK_file_write (proc->control_pipe, &sig, sizeof(sig));
   if (ret != sizeof(sig))
   {
     if (errno == ECOMM)
+    {
       /* Child process is not controllable via pipe */
+#if DEBUG_OS
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
           "Child process is not controllable, will kill it directly\n");
+#endif
+    }
+    else if (errno == EPIPE)
+    {
+#if DEBUG_OS
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+          "Failed to write into control pipe, because pipe is invalid (the 
child is most likely dead)\n");
+#endif
+    }
     else
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
           "Failed to write into control pipe , errno is %d\n", errno);
 #if WINDOWS && !defined(__CYGWIN__)
     TerminateProcess (proc->handle, 0);
@@ -182,8 +193,10 @@
   }
   else
   {
+#if DEBUG_OS
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
         "Wrote control code into control pipe, now waiting\n");
+#endif
 
 #if WINDOWS
     /* Give it 3 seconds to die, then kill it in a nice Windows-specific way */
@@ -400,9 +413,11 @@
         }
     }
 #else
+#if DEBUG_OS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
              "Priority management not availabe for this platform\n");
 #endif
+#endif
   return GNUNET_OK;
 }
 
@@ -750,9 +765,11 @@
     return NULL;
   }
 
+#if DEBUG_OS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
              "Opened the parent end of the pipe `%s'\n", 
              childpipename);
+#endif
 
   GNUNET_asprintf (&our_env[0], "%s=", GNUNET_OS_CONTROL_PIPE);
   GNUNET_asprintf (&our_env[1], "%s", childpipename);
@@ -1090,7 +1107,9 @@
     return NULL;
   }
 
+#if DEBUG_OS
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Opened the parent end of the pipe 
`%s'\n", childpipename);
+#endif
 
   GNUNET_asprintf (&our_env[0], "%s=", GNUNET_OS_CONTROL_PIPE);
   GNUNET_asprintf (&our_env[1], "%s", childpipename);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]