#if DEBUG_OS
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got control code %d from parent\n", sig);
-#endif
- raise (sig);
-#if DEBUG_OS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Re-scheduling the parent control handler pipe\n");
#endif
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
control_pipe,
&parent_control_handler, control_pipe);
+ raise (sig);
}
}
}
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);
}
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 */
}
}
#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;
}
cmdlen = 0;
va_copy (ap, va);
while (NULL != (arg = va_arg (ap, char *)))
- {
+ {
if (cmdlen == 0)
cmdlen = cmdlen + strlen (path) + 3;
else
cmdlen = cmdlen + strlen (arg) + 3;
- }
+ }
va_end (ap);
cmd = idx = GNUNET_malloc (sizeof (char) * (cmdlen + 1));
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);
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);
return GNUNET_OK;
}
+
/**
* Wait for a process
* @param proc pointer to process structure