[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13944 - in branches/gnunet/mantis_0001616: . src/arm src/c
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13944 - in branches/gnunet/mantis_0001616: . src/arm src/core src/datastore src/dht src/fs src/hostlist src/include src/peerinfo src/statistics src/testing src/transport src/util src/vpn |
Date: |
Mon, 20 Dec 2010 17:14:16 +0100 |
Author: durner
Date: 2010-12-20 17:14:16 +0100 (Mon, 20 Dec 2010)
New Revision: 13944
Modified:
branches/gnunet/mantis_0001616/configure.ac
branches/gnunet/mantis_0001616/src/arm/gnunet-service-arm.c
branches/gnunet/mantis_0001616/src/core/test_core_api.c
branches/gnunet/mantis_0001616/src/core/test_core_api_reliability.c
branches/gnunet/mantis_0001616/src/core/test_core_api_start_only.c
branches/gnunet/mantis_0001616/src/core/test_core_quota_compliance.c
branches/gnunet/mantis_0001616/src/datastore/perf_datastore_api.c
branches/gnunet/mantis_0001616/src/datastore/test_datastore_api.c
branches/gnunet/mantis_0001616/src/datastore/test_datastore_api_management.c
branches/gnunet/mantis_0001616/src/dht/test_dht_api.c
branches/gnunet/mantis_0001616/src/fs/test_fs_download.c
branches/gnunet/mantis_0001616/src/fs/test_fs_download_indexed.c
branches/gnunet/mantis_0001616/src/fs/test_fs_download_persistence.c
branches/gnunet/mantis_0001616/src/fs/test_fs_list_indexed.c
branches/gnunet/mantis_0001616/src/fs/test_fs_namespace.c
branches/gnunet/mantis_0001616/src/fs/test_fs_namespace_list_updateable.c
branches/gnunet/mantis_0001616/src/fs/test_fs_publish.c
branches/gnunet/mantis_0001616/src/fs/test_fs_publish_persistence.c
branches/gnunet/mantis_0001616/src/fs/test_fs_search.c
branches/gnunet/mantis_0001616/src/fs/test_fs_search_persistence.c
branches/gnunet/mantis_0001616/src/fs/test_fs_start_stop.c
branches/gnunet/mantis_0001616/src/fs/test_fs_unindex.c
branches/gnunet/mantis_0001616/src/fs/test_fs_unindex_persistence.c
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist.c
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist_learning.c
branches/gnunet/mantis_0001616/src/include/gnunet_os_lib.h
branches/gnunet/mantis_0001616/src/peerinfo/perf_peerinfo_api.c
branches/gnunet/mantis_0001616/src/peerinfo/test_peerinfo_api.c
branches/gnunet/mantis_0001616/src/statistics/test_statistics_api.c
branches/gnunet/mantis_0001616/src/statistics/test_statistics_api_loop.c
branches/gnunet/mantis_0001616/src/testing/testing.c
branches/gnunet/mantis_0001616/src/transport/plugin_transport_tcp.c
branches/gnunet/mantis_0001616/src/transport/plugin_transport_udp.c
branches/gnunet/mantis_0001616/src/transport/test_quota_compliance.c
branches/gnunet/mantis_0001616/src/transport/test_transport_api.c
branches/gnunet/mantis_0001616/src/transport/test_transport_api_reliability.c
branches/gnunet/mantis_0001616/src/util/crypto_random.c
branches/gnunet/mantis_0001616/src/util/os_priority.c
branches/gnunet/mantis_0001616/src/util/test_os_start_process.c
branches/gnunet/mantis_0001616/src/util/test_resolver_api.c
branches/gnunet/mantis_0001616/src/vpn/gnunet-daemon-vpn.c
Log:
use select() instead of scheduler to wait for the control pipe
Modified: branches/gnunet/mantis_0001616/configure.ac
===================================================================
--- branches/gnunet/mantis_0001616/configure.ac 2010-12-20 15:30:34 UTC (rev
13943)
+++ branches/gnunet/mantis_0001616/configure.ac 2010-12-20 16:14:16 UTC (rev
13944)
@@ -755,6 +755,23 @@
AM_CONDITIONAL([HAVE_MALICIOUS], [test "x$enable_malicious" = "x1"])
AC_DEFINE_UNQUOTED([HAVE_MALICIOUS], $enable_malicious, [Compile malicious
code])
+# should code be enabled that works around missing OS functionality on Windows?
+# used for test cases
+AC_ARG_ENABLE(windows_workarounds,
[AS_HELP_STRING([--enable-windows_workarounds],
+ [enable workarounds used on Windows (only useful for test
cases)])])
+if test $build_target = "mingw"
+then
+ workarounds=1
+else
+ if test x$enable_windows_workarounds = "xyes"
+ then
+ workarounds=1
+ else
+ workarounds=0
+ fi
+fi
+AC_DEFINE_UNQUOTED([ENABLE_WINDOWS_WORKAROUNDS], $workarounds, [enable
workarounds used on Windows (only useful for test cases)])
+
# gcov compilation
use_gcov=no
AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage],
Modified: branches/gnunet/mantis_0001616/src/arm/gnunet-service-arm.c
===================================================================
--- branches/gnunet/mantis_0001616/src/arm/gnunet-service-arm.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/arm/gnunet-service-arm.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -198,7 +198,7 @@
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Restarting service `%s' due to configuration file
change.\n"));
- if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM, GNUNET_YES))
+ if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
else
pos->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
@@ -579,7 +579,7 @@
"Sending kill signal to service `%s', waiting for process to
die.\n",
servicename);
#endif
- if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM, GNUNET_YES))
+ if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
pos->next = running;
running = pos;
@@ -730,7 +730,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Stopping service `%s'\n",
pos->name);
- if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM, GNUNET_YES))
+ if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
}
pos = pos->next;
Modified: branches/gnunet/mantis_0001616/src/core/test_core_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/core/test_core_api.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/core/test_core_api.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -322,7 +322,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/core/test_core_api_reliability.c
===================================================================
--- branches/gnunet/mantis_0001616/src/core/test_core_api_reliability.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/core/test_core_api_reliability.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -477,7 +477,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/core/test_core_api_start_only.c
===================================================================
--- branches/gnunet/mantis_0001616/src/core/test_core_api_start_only.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/core/test_core_api_start_only.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -215,7 +215,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stopping peer\n");
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/core/test_core_quota_compliance.c
===================================================================
--- branches/gnunet/mantis_0001616/src/core/test_core_quota_compliance.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/core/test_core_quota_compliance.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -667,7 +667,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/datastore/perf_datastore_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/datastore/perf_datastore_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/datastore/perf_datastore_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -391,7 +391,7 @@
GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
argv, "perf-datastore-api", "nohelp",
options, &run, NULL);
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/datastore/test_datastore_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/datastore/test_datastore_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/datastore/test_datastore_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -660,7 +660,7 @@
argv, "test-datastore-api", "nohelp",
options, &run, NULL);
#if START_DATASTORE
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified:
branches/gnunet/mantis_0001616/src/datastore/test_datastore_api_management.c
===================================================================
---
branches/gnunet/mantis_0001616/src/datastore/test_datastore_api_management.c
2010-12-20 15:30:34 UTC (rev 13943)
+++
branches/gnunet/mantis_0001616/src/datastore/test_datastore_api_management.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -370,7 +370,7 @@
GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
argv, "test-datastore-api", "nohelp",
options, &run, NULL);
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/dht/test_dht_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/dht/test_dht_api.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/dht/test_dht_api.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -120,7 +120,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (p->arm_proc);
GNUNET_OS_process_close (p->arm_proc);
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_download.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_download.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_download.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -256,7 +256,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_download_indexed.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_download_indexed.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_download_indexed.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -258,7 +258,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_download_persistence.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_download_persistence.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_download_persistence.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -317,7 +317,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_list_indexed.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_list_indexed.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_list_indexed.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -209,7 +209,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_namespace.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_namespace.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_namespace.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -82,7 +82,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified:
branches/gnunet/mantis_0001616/src/fs/test_fs_namespace_list_updateable.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_namespace_list_updateable.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_namespace_list_updateable.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -86,7 +86,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_publish.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_publish.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_publish.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -195,7 +195,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_publish_persistence.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_publish_persistence.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_publish_persistence.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -252,7 +252,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_search.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_search.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_search.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -200,7 +200,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_search_persistence.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_search_persistence.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_search_persistence.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -269,7 +269,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_start_stop.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_start_stop.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_start_stop.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -72,7 +72,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_unindex.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_unindex.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_unindex.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -205,7 +205,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/fs/test_fs_unindex_persistence.c
===================================================================
--- branches/gnunet/mantis_0001616/src/fs/test_fs_unindex_persistence.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/fs/test_fs_unindex_persistence.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -273,7 +273,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified:
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist.c
===================================================================
--- branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -154,7 +154,7 @@
#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Killing ARM process.\n");
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified:
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist_learning.c
===================================================================
---
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist_learning.c
2010-12-20 15:30:34 UTC (rev 13943)
+++
branches/gnunet/mantis_0001616/src/hostlist/test_gnunet_daemon_hostlist_learning.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -133,7 +133,7 @@
#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Killing hostlist server ARM process.\n");
- if (0 != GNUNET_OS_process_kill (adv_peer.arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (adv_peer.arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(adv_peer.arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
@@ -147,7 +147,7 @@
#if START_ARM
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Killing hostlist client ARM process.\n");
- if (0 != GNUNET_OS_process_kill (learn_peer.arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (learn_peer.arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
if (GNUNET_OS_process_wait(learn_peer.arm_proc) != GNUNET_OK)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
Modified: branches/gnunet/mantis_0001616/src/include/gnunet_os_lib.h
===================================================================
--- branches/gnunet/mantis_0001616/src/include/gnunet_os_lib.h 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/include/gnunet_os_lib.h 2010-12-20
16:14:16 UTC (rev 13944)
@@ -192,13 +192,9 @@
*
* @param proc pointer to process structure
* @param sig signal
- * @param time_out GNUNET_YES to add a scheduler task that will kill() the
- * process directly if signaling via control pipe times out, GNUNET_NO
- * otherwise. Use GNUNET_NO when running outside of a scheduler, or
- * when you are going to use GNUNET_OS_process_wait() right away.
* @return 0 on success, -1 on error
*/
-int GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig, int
time_out);
+int GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig);
/**
Modified: branches/gnunet/mantis_0001616/src/peerinfo/perf_peerinfo_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/peerinfo/perf_peerinfo_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/peerinfo/perf_peerinfo_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -185,7 +185,7 @@
numpeers,
NUM_REQUESTS * NUM_REQUESTS / 2);
#if START_SERVICE
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/peerinfo/test_peerinfo_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/peerinfo/test_peerinfo_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/peerinfo/test_peerinfo_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -182,7 +182,7 @@
GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
argv, "test-peerinfo-api", "nohelp",
options, &run, &ok);
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/statistics/test_statistics_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/statistics/test_statistics_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/statistics/test_statistics_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -166,7 +166,7 @@
GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp",
options, &run, &ok);
#if START_SERVICE
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
@@ -190,7 +190,7 @@
GNUNET_PROGRAM_run (5, argv, "test-statistics-api", "nohelp",
options, &run_more, &ok);
#if START_SERVICE
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified:
branches/gnunet/mantis_0001616/src/statistics/test_statistics_api_loop.c
===================================================================
--- branches/gnunet/mantis_0001616/src/statistics/test_statistics_api_loop.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/statistics/test_statistics_api_loop.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -106,7 +106,7 @@
GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp",
options, &run, &ok);
#if START_SERVICE
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/testing/testing.c
===================================================================
--- branches/gnunet/mantis_0001616/src/testing/testing.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/testing/testing.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -401,7 +401,7 @@
d->cb = NULL;
GNUNET_DISK_pipe_close (d->pipe_stdout);
d->pipe_stdout = NULL;
- (void) GNUNET_OS_process_kill (d->proc, SIGKILL, GNUNET_NO);
+ (void) GNUNET_OS_process_kill (d->proc, SIGKILL);
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (d->proc));
GNUNET_OS_process_close (d->proc);
d->proc = NULL;
@@ -411,7 +411,7 @@
}
GNUNET_DISK_pipe_close (d->pipe_stdout);
d->pipe_stdout = NULL;
- (void) GNUNET_OS_process_kill (d->proc, SIGKILL, GNUNET_NO);
+ (void) GNUNET_OS_process_kill (d->proc, SIGKILL);
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (d->proc));
GNUNET_OS_process_close (d->proc);
d->proc = NULL;
Modified: branches/gnunet/mantis_0001616/src/transport/plugin_transport_tcp.c
===================================================================
--- branches/gnunet/mantis_0001616/src/transport/plugin_transport_tcp.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/transport/plugin_transport_tcp.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -3021,7 +3021,7 @@
if ((plugin->behind_nat == GNUNET_YES) &&
(plugin->enable_nat_server == GNUNET_YES))
{
- if (0 != GNUNET_OS_process_kill (plugin->server_proc, SIGTERM,
GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (plugin->server_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (plugin->server_proc);
GNUNET_OS_process_close (plugin->server_proc);
Modified: branches/gnunet/mantis_0001616/src/transport/plugin_transport_udp.c
===================================================================
--- branches/gnunet/mantis_0001616/src/transport/plugin_transport_udp.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/transport/plugin_transport_udp.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -522,7 +522,7 @@
}
if (plugin->behind_nat == GNUNET_YES)
{
- if (0 != GNUNET_OS_process_kill (plugin->server_proc, SIGTERM,
GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (plugin->server_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (plugin->server_proc);
GNUNET_OS_process_close (plugin->server_proc);
Modified: branches/gnunet/mantis_0001616/src/transport/test_quota_compliance.c
===================================================================
--- branches/gnunet/mantis_0001616/src/transport/test_quota_compliance.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/transport/test_quota_compliance.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -196,7 +196,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (p->arm_proc);
GNUNET_OS_process_close (p->arm_proc);
Modified: branches/gnunet/mantis_0001616/src/transport/test_transport_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/transport/test_transport_api.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/transport/test_transport_api.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -118,7 +118,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (p->arm_proc);
GNUNET_OS_process_close (p->arm_proc);
Modified:
branches/gnunet/mantis_0001616/src/transport/test_transport_api_reliability.c
===================================================================
---
branches/gnunet/mantis_0001616/src/transport/test_transport_api_reliability.c
2010-12-20 15:30:34 UTC (rev 13943)
+++
branches/gnunet/mantis_0001616/src/transport/test_transport_api_reliability.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -139,7 +139,7 @@
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
GNUNET_OS_process_wait (p->arm_proc);
GNUNET_OS_process_close (p->arm_proc);
Modified: branches/gnunet/mantis_0001616/src/util/crypto_random.c
===================================================================
--- branches/gnunet/mantis_0001616/src/util/crypto_random.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/util/crypto_random.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -208,7 +208,7 @@
{
if (genproc != NULL)
{
- if (0 != GNUNET_OS_process_kill (genproc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
GNUNET_OS_process_close (genproc);
@@ -226,7 +226,7 @@
GNUNET_break (0);
return;
}
- if (0 != GNUNET_OS_process_kill (genproc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (genproc, SIGTERM))
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "kill");
GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (genproc));
GNUNET_OS_process_close (genproc);
@@ -247,7 +247,7 @@
{
if (genproc != NULL)
{
- GNUNET_OS_process_kill (genproc, SIGKILL, GNUNET_NO);
+ GNUNET_OS_process_kill (genproc, SIGKILL);
GNUNET_OS_process_close (genproc);
genproc = NULL;
}
Modified: branches/gnunet/mantis_0001616/src/util/os_priority.c
===================================================================
--- branches/gnunet/mantis_0001616/src/util/os_priority.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/util/os_priority.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -40,7 +40,6 @@
#endif
int sig;
struct GNUNET_DISK_FileHandle *control_pipe;
- GNUNET_SCHEDULER_TaskIdentifier kill_timeout_task;
};
static struct GNUNET_OS_Process current_process;
@@ -55,7 +54,7 @@
GNUNET_SCHEDULER_TaskContext * tc)
{
struct GNUNET_DISK_FileHandle *control_pipe = (struct GNUNET_DISK_FileHandle
*) cls;
- unsigned char code;
+ int sig;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n",
__FUNCTION__, tc->reason);
@@ -65,32 +64,15 @@
}
else
{
- if (GNUNET_DISK_file_read (control_pipe, &code, sizeof (char)) != sizeof
(char))
+ if (GNUNET_DISK_file_read (control_pipe, &sig, sizeof (sig)) != sizeof
(sig))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "GNUNET_DISK_file_read");
GNUNET_DISK_npipe_close (control_pipe);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got control code %d from
parent\n", code);
- switch (code)
- {
- case 0:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Raising SIGTERM\n");
- raise (SIGTERM);
- break;
- case 1:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Raising SIGKILL\n");
- raise (SIGKILL);
- break;
- case 255:
- /* read more bytes - a possibility for extended signals
- * in case 254 different valies is not enough
- */
- break;
- default:
- break;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got control code %d from
parent\n", sig);
+ raise (sig);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Re-scheduling the parent control
handler pipe\n");
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
control_pipe, GNUNET_OS_parent_control_handler, control_pipe);
}
@@ -148,129 +130,66 @@
return ¤t_process;
}
-struct GNUNET_OS_process_kill_timeout_cls
-{
- struct GNUNET_OS_Process *proc;
- int sig;
-};
-
-void
-GNUNET_OS_process_kill_timeout (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
- struct GNUNET_OS_Process *proc = (struct GNUNET_OS_Process *) cls;
- enum GNUNET_OS_ProcessStatusType type;
- unsigned long code;
- unsigned char c;
- size_t s;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_OS_process_kill_timeout() is
called because of %d\n", tc->reason);
-
- if (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT && GNUNET_OS_process_status
(proc, &type, &code) == GNUNET_NO)
- {
- switch (proc->sig)
- {
- case SIGTERM:
- c = 0;
- break;
- case SIGKILL:
- c = 1;
- break;
- }
-
- s = sizeof (c);
- if (GNUNET_DISK_file_write (proc->control_pipe, &c, s) != s)
- {
-#if !WINDOWS || defined(__CYGWIN__)
- kill (proc->pid, proc->sig);
-#else
- DWORD dwresult, error_code;
- BOOL bresult;
- SetLastError (0);
- dwresult = WaitForSingleObject (proc->handle, 0);
- error_code = GetLastError ();
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Woke up, returned %d, GLE is %d\n", dwresult, error_code);
- if (WAIT_OBJECT_0 != dwresult || error_code != NO_ERROR)
- {
- SetLastError (0);
- bresult = TerminateProcess (proc->handle, 0);
- error_code = GetLastError ();
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TerminateProcess for the child returned %d, GLE is %d\n", bresult,
- error_code);
- }
-#endif
- }
- }
- proc->kill_timeout_task = 0;
-}
-
int
-GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig, int time_out)
+GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig)
{
- unsigned char c;
- size_t s;
- int res = 0;
- int ret = 0;
+#if ENABLE_WINDOWS_WORKAROUNDS
+ int res;
+ int ret;
- if (proc->kill_timeout_task)
+ ret = GNUNET_DISK_file_write (proc->control_pipe, &sig, sizeof(sig));
+ if (ret != sizeof(sig))
{
- GNUNET_SCHEDULER_cancel (proc->kill_timeout_task);
- proc->kill_timeout_task = 0;
- }
-
- switch (sig)
- {
- case SIGTERM:
- c = 0;
- break;
- case SIGKILL:
- c = 1;
- break;
- default:
- errno = EINVAL;
- return -1;
- }
-
- s = sizeof (c);
- ret = GNUNET_DISK_file_write (proc->control_pipe, &c, s);
- if (ret != s)
- {
if (errno == ECOMM)
- {
/* Child process is not controllable via pipe */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Child process is not controllable, will kill it directly\n");
- if (time_out == GNUNET_YES)
- {
- proc->sig = sig;
- proc->kill_timeout_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 0), GNUNET_OS_process_kill_timeout,
proc);
- }
- else
- {
- struct GNUNET_SCHEDULER_TaskContext tc;
- tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT;
- GNUNET_OS_process_kill_timeout (proc, &tc);
- }
- }
else
- {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to write into control pipe , errno is %d\n", errno);
- res = -1;
- }
+ res = PLIBC_KILL (proc->pid, sig);
}
- else if (time_out == GNUNET_YES)
+ else
{
- proc->sig = sig;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Wrote control code into control pipe, now waiting\n");
- proc->kill_timeout_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 3), GNUNET_OS_process_kill_timeout, proc);
- }
- return res;
+ struct GNUNET_NETWORK_FDSet *rfds;
+ struct GNUNET_NETWORK_FDSet *efds;
+
+ rfds = GNUNET_NETWORK_fdset_create ();
+ efds = GNUNET_NETWORK_fdset_create ();
+
+ GNUNET_NETWORK_fdset_handle_set (rfds, proc->control_pipe);
+ GNUNET_NETWORK_fdset_handle_set (efds, proc->control_pipe);
+
+ read_next:
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Wrote control code into control pipe, now waiting\n");
+
+ ret = GNUNET_NETWORK_socket_select (rfds, NULL, efds,
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_unit (),
+ 5000));
+
+ if (ret < 1 || GNUNET_NETWORK_fdset_handle_isset (efds,
+ proc->control_pipe))
+ {
+ /* Just to be sure */
+ PLIBC_KILL (proc->pid, sig);
+ res = 0;
+ }
+ else
+ {
+ if (GNUNET_DISK_file_read (proc->control_pipe, &ret,
+ sizeof(ret)) != GNUNET_OK)
+ res = PLIBC_KILL (proc->pid, sig);
+
+ /* Child signaled shutdown is in progress */
+ goto read_next;
+ }
+ }
+
+ return res;
+#else
+ return kill (proc->pid, sig);
+#endif
}
/**
@@ -289,18 +208,20 @@
void
GNUNET_OS_process_close (struct GNUNET_OS_Process *proc)
{
- if (proc->kill_timeout_task)
- GNUNET_SCHEDULER_cancel (proc->kill_timeout_task);
+#if ENABLE_WINDOWS_WORKAROUNDS
if (proc->control_pipe)
GNUNET_DISK_npipe_close (proc->control_pipe);
-#if WINDOWS && !defined(__CYGWIN__)
+#endif
+// FIXME NILS
+#ifdef WINDOWS
if (proc->handle != NULL)
CloseHandle (proc->handle);
-#endif
+#endif
GNUNET_free (proc);
}
-#if WINDOWS && !defined(__CYGWIN__)
+// FIXME NILS
+#if WINDOWS
#include "gnunet_signal_lib.h"
extern GNUNET_SIGNAL_Handler w32_sigchld_handler;
@@ -434,7 +355,7 @@
return GNUNET_OK;
}
-#if WINDOWS && !defined(__CYGWIN__)
+#if MINGW
char *
CreateCustomEnvTable (char **vars)
{
@@ -548,8 +469,10 @@
const char *filename, ...)
{
va_list ap;
+#if ENABLE_WINDOWS_WORKAROUNDS
char *childpipename = NULL;
struct GNUNET_DISK_FileHandle *control_pipe = NULL;
+#endif
struct GNUNET_OS_Process *gnunet_proc = NULL;
#ifndef MINGW
@@ -561,11 +484,13 @@
int fd_stdin_read;
int fd_stdin_write;
+#if ENABLE_WINDOWS_WORKAROUNDS
control_pipe = GNUNET_DISK_npipe_open (&childpipename,
GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
if (control_pipe == NULL)
return NULL;
+#endif
argc = 0;
va_start (ap, filename);
@@ -599,7 +524,9 @@
if (ret == -1)
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "fork");
+#if ENABLE_WINDOWS_WORKAROUNDS
GNUNET_DISK_npipe_close (control_pipe);
+#endif
}
else
{
@@ -621,15 +548,21 @@
#endif
gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
gnunet_proc->pid = ret;
+#if ENABLE_WINDOWS_WORKAROUNDS
gnunet_proc->control_pipe = control_pipe;
+#endif
}
GNUNET_free (argv);
+#if ENABLE_WINDOWS_WORKAROUNDS
GNUNET_free (childpipename);
+#endif
return gnunet_proc;
}
+#if ENABLE_WINDOWS_WORKAROUNDS
setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1);
GNUNET_free (childpipename);
+#endif
if (pipe_stdout != NULL)
{
@@ -823,8 +756,10 @@
GNUNET_OS_start_process_v (const int *lsocks,
const char *filename, char *const argv[])
{
+#if ENABLE_WINDOWS_WORKAROUNDS
struct GNUNET_DISK_FileHandle *control_pipe = NULL;
char *childpipename = NULL;
+#endif
#ifndef MINGW
pid_t ret;
@@ -839,11 +774,13 @@
int *lscp;
unsigned int ls;
+#if ENABLE_WINDOWS_WORKAROUNDS
control_pipe = GNUNET_DISK_npipe_open (&childpipename,
GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
if (control_pipe == NULL)
return NULL;
+#endif
lscp = NULL;
ls = 0;
@@ -864,7 +801,9 @@
if (ret == -1)
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "fork");
+#if ENABLE_WINDOWS_WORKAROUNDS
GNUNET_DISK_npipe_close (control_pipe);
+#endif
}
else
{
@@ -881,15 +820,22 @@
#endif
gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
gnunet_proc->pid = ret;
+#if ENABLE_WINDOWS_WORKAROUNDS
gnunet_proc->control_pipe = control_pipe;
+
+#endif
}
GNUNET_array_grow (lscp, ls, 0);
+#if ENABLE_WINDOWS_WORKAROUNDS
GNUNET_free (childpipename);
+#endif
return gnunet_proc;
}
- setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1);
- GNUNET_free (childpipename);
+#if ENABLE_WINDOWS_WORKAROUNDS
+ setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1);
+ GNUNET_free (childpipename);
+#endif
if (lscp != NULL)
{
@@ -1209,13 +1155,8 @@
int
GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc)
{
-#if !WINDOWS || defined(__CYGWIN__)
- if (proc->kill_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (proc->kill_timeout_task);
- proc->kill_timeout_task = 0;
- kill (proc->pid, proc->sig);
- }
+
+#ifndef MINGW
pid_t pid = proc->pid;
if (pid != waitpid (pid, NULL, 0))
return GNUNET_SYSERR;
@@ -1236,35 +1177,13 @@
if (h == NULL)
h = GetCurrentProcess ();
- if (proc->kill_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (proc->kill_timeout_task);
- proc->kill_timeout_task = 0;
- if (WAIT_OBJECT_0 != WaitForSingleObject (h, 4000))
+ if (WAIT_OBJECT_0 != WaitForSingleObject (h, INFINITE))
{
- struct GNUNET_SCHEDULER_TaskContext tc;
- tc.reason = GNUNET_SCHEDULER_REASON_TIMEOUT;
- GNUNET_OS_process_kill_timeout (proc, &tc);
- if (WAIT_OBJECT_0 != WaitForSingleObject (h, INFINITE))
- {
- ret = GNUNET_SYSERR;
- SetErrnoFromWinError (GetLastError ());
- }
- else
- ret = GNUNET_OK;
+ SetErrnoFromWinError (GetLastError ());
+ ret = GNUNET_SYSERR;
}
- ret = GNUNET_OK;
- }
else
- {
- if (WAIT_OBJECT_0 != WaitForSingleObject (h, INFINITE))
- {
- SetErrnoFromWinError (GetLastError ());
- ret = GNUNET_SYSERR;
- }
- else
- ret = GNUNET_OK;
- }
+ ret = GNUNET_OK;
return ret;
#endif
Modified: branches/gnunet/mantis_0001616/src/util/test_os_start_process.c
===================================================================
--- branches/gnunet/mantis_0001616/src/util/test_os_start_process.c
2010-12-20 15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/util/test_os_start_process.c
2010-12-20 16:14:16 UTC (rev 13944)
@@ -50,7 +50,7 @@
end_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
}
Modified: branches/gnunet/mantis_0001616/src/util/test_resolver_api.c
===================================================================
--- branches/gnunet/mantis_0001616/src/util/test_resolver_api.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/util/test_resolver_api.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -378,7 +378,7 @@
GNUNET_free(fn);
GNUNET_assert(GNUNET_OK == GNUNET_PROGRAM_run((sizeof(argv) / sizeof(char *))
- 1, argv, "test-resolver-api", "nohelp", options, &run, &ok));
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM, GNUNET_NO))
+ if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
{
GNUNET_log_strerror(GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
Modified: branches/gnunet/mantis_0001616/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- branches/gnunet/mantis_0001616/src/vpn/gnunet-daemon-vpn.c 2010-12-20
15:30:34 UTC (rev 13943)
+++ branches/gnunet/mantis_0001616/src/vpn/gnunet-daemon-vpn.c 2010-12-20
16:14:16 UTC (rev 13944)
@@ -209,7 +209,7 @@
/* stop the helper */
if (helper_proc != NULL)
{
- GNUNET_OS_process_kill (helper_proc, SIGTERM, GNUNET_NO);
+ GNUNET_OS_process_kill (helper_proc, SIGTERM);
GNUNET_OS_process_wait (helper_proc);
GNUNET_OS_process_close (helper_proc);
helper_proc = NULL;
@@ -270,7 +270,7 @@
static void
restart_helper(void* cls, const struct GNUNET_SCHEDULER_TaskContext* tskctx) {
// Kill the helper
- GNUNET_OS_process_kill (helper_proc, SIGKILL, GNUNET_NO);
+ GNUNET_OS_process_kill (helper_proc, SIGKILL);
GNUNET_OS_process_wait (helper_proc);
GNUNET_OS_process_close (helper_proc);
helper_proc = NULL;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13944 - in branches/gnunet/mantis_0001616: . src/arm src/core src/datastore src/dht src/fs src/hostlist src/include src/peerinfo src/statistics src/testing src/transport src/util src/vpn,
gnunet <=