diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-11-03 21:26:40 +0000 |
commit | 721e49caeea6ba5073f8bc5c6c08359295c02bb5 (patch) | |
tree | e06e80ba90af91e9452a48a7a5782913199b4877 /src/core | |
parent | 37ac1b7c9e9e05f93d4100cfb53450ec2d370989 (diff) | |
download | gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.tar.gz gnunet-721e49caeea6ba5073f8bc5c6c08359295c02bb5.zip |
original patch from Mantis 1614
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/test_core_api.c | 12 | ||||
-rw-r--r-- | src/core/test_core_api_reliability.c | 12 | ||||
-rw-r--r-- | src/core/test_core_api_start_only.c | 12 | ||||
-rw-r--r-- | src/core/test_core_quota_compliance.c | 6 |
4 files changed, 25 insertions, 17 deletions
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index b04430eea..a4c3b0a78 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -54,7 +54,7 @@ struct PeerContext | |||
54 | struct GNUNET_MessageHeader *hello; | 54 | struct GNUNET_MessageHeader *hello; |
55 | int connect_status; | 55 | int connect_status; |
56 | #if START_ARM | 56 | #if START_ARM |
57 | pid_t arm_pid; | 57 | GNUNET_OS_Process *arm_proc; |
58 | #endif | 58 | #endif |
59 | }; | 59 | }; |
60 | 60 | ||
@@ -289,7 +289,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
289 | { | 289 | { |
290 | p->cfg = GNUNET_CONFIGURATION_create (); | 290 | p->cfg = GNUNET_CONFIGURATION_create (); |
291 | #if START_ARM | 291 | #if START_ARM |
292 | p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 292 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
293 | "gnunet-service-arm", | 293 | "gnunet-service-arm", |
294 | #if VERBOSE | 294 | #if VERBOSE |
295 | "-L", "DEBUG", | 295 | "-L", "DEBUG", |
@@ -332,12 +332,14 @@ static void | |||
332 | stop_arm (struct PeerContext *p) | 332 | stop_arm (struct PeerContext *p) |
333 | { | 333 | { |
334 | #if START_ARM | 334 | #if START_ARM |
335 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) | 335 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) |
336 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 336 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
337 | if (GNUNET_OS_process_wait(p->arm_pid) != GNUNET_OK) | 337 | if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK) |
338 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 338 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 339 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
340 | "ARM process %u stopped\n", p->arm_pid); | 340 | "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_pid)); |
341 | GNUNET_OS_process_close (p->arm_proc); | ||
342 | p->arm_proc = NULL; | ||
341 | #endif | 343 | #endif |
342 | GNUNET_CONFIGURATION_destroy (p->cfg); | 344 | GNUNET_CONFIGURATION_destroy (p->cfg); |
343 | } | 345 | } |
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index b25cb89f2..0b3be2f82 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -74,7 +74,7 @@ struct PeerContext | |||
74 | struct GNUNET_MessageHeader *hello; | 74 | struct GNUNET_MessageHeader *hello; |
75 | int connect_status; | 75 | int connect_status; |
76 | #if START_ARM | 76 | #if START_ARM |
77 | pid_t arm_pid; | 77 | GNUNET_OS_Process *arm_proc; |
78 | #endif | 78 | #endif |
79 | }; | 79 | }; |
80 | 80 | ||
@@ -436,7 +436,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
436 | { | 436 | { |
437 | p->cfg = GNUNET_CONFIGURATION_create (); | 437 | p->cfg = GNUNET_CONFIGURATION_create (); |
438 | #if START_ARM | 438 | #if START_ARM |
439 | p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 439 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
440 | "gnunet-service-arm", | 440 | "gnunet-service-arm", |
441 | #if VERBOSE | 441 | #if VERBOSE |
442 | "-L", "DEBUG", | 442 | "-L", "DEBUG", |
@@ -479,12 +479,14 @@ static void | |||
479 | stop_arm (struct PeerContext *p) | 479 | stop_arm (struct PeerContext *p) |
480 | { | 480 | { |
481 | #if START_ARM | 481 | #if START_ARM |
482 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) | 482 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) |
483 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 483 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
484 | if (GNUNET_OS_process_wait(p->arm_pid) != GNUNET_OK) | 484 | if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK) |
485 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 485 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
486 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 486 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
487 | "ARM process %u stopped\n", p->arm_pid); | 487 | "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc)); |
488 | GNUNET_OS_process_close (p->arm_proc); | ||
489 | p->arm_proc = NULL; | ||
488 | #endif | 490 | #endif |
489 | GNUNET_CONFIGURATION_destroy (p->cfg); | 491 | GNUNET_CONFIGURATION_destroy (p->cfg); |
490 | } | 492 | } |
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index b55d3c972..e82f12ed3 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -49,7 +49,7 @@ struct PeerContext | |||
49 | struct GNUNET_CORE_Handle *ch; | 49 | struct GNUNET_CORE_Handle *ch; |
50 | struct GNUNET_PeerIdentity id; | 50 | struct GNUNET_PeerIdentity id; |
51 | #if START_ARM | 51 | #if START_ARM |
52 | pid_t arm_pid; | 52 | GNUNET_OS_Process *arm_proc; |
53 | #endif | 53 | #endif |
54 | }; | 54 | }; |
55 | 55 | ||
@@ -153,7 +153,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
153 | { | 153 | { |
154 | p->cfg = GNUNET_CONFIGURATION_create (); | 154 | p->cfg = GNUNET_CONFIGURATION_create (); |
155 | #if START_ARM | 155 | #if START_ARM |
156 | p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 156 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
157 | "gnunet-service-arm", | 157 | "gnunet-service-arm", |
158 | #if VERBOSE | 158 | #if VERBOSE |
159 | "-L", "DEBUG", | 159 | "-L", "DEBUG", |
@@ -193,12 +193,14 @@ static void | |||
193 | stop_arm (struct PeerContext *p) | 193 | stop_arm (struct PeerContext *p) |
194 | { | 194 | { |
195 | #if START_ARM | 195 | #if START_ARM |
196 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) | 196 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) |
197 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 197 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
198 | if (GNUNET_OS_process_wait(p->arm_pid) != GNUNET_OK) | 198 | if (GNUNET_OS_process_wait(p->arm_proc) != GNUNET_OK) |
199 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 199 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 200 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
201 | "ARM process %u stopped\n", p->arm_pid); | 201 | "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc)); |
202 | GNUNET_OS_process_close (p->arm_proc); | ||
203 | p->arm_proc = NULL; | ||
202 | #endif | 204 | #endif |
203 | GNUNET_CONFIGURATION_destroy (p->cfg); | 205 | GNUNET_CONFIGURATION_destroy (p->cfg); |
204 | } | 206 | } |
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index d4df96611..99d9ed4ad 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -479,7 +479,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
479 | { | 479 | { |
480 | p->cfg = GNUNET_CONFIGURATION_create (); | 480 | p->cfg = GNUNET_CONFIGURATION_create (); |
481 | #if START_ARM | 481 | #if START_ARM |
482 | p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 482 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
483 | "gnunet-service-arm", | 483 | "gnunet-service-arm", |
484 | #if VERBOSE | 484 | #if VERBOSE |
485 | "-L", "DEBUG", | 485 | "-L", "DEBUG", |
@@ -539,10 +539,12 @@ static void | |||
539 | stop_arm (struct PeerContext *p) | 539 | stop_arm (struct PeerContext *p) |
540 | { | 540 | { |
541 | #if START_ARM | 541 | #if START_ARM |
542 | if (0 != PLIBC_KILL (p->arm_pid, SIGTERM)) | 542 | if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) |
543 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 543 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
544 | if (GNUNET_OS_process_wait(p->arm_pid) != GNUNET_OK) | 544 | if (GNUNET_OS_process_wait(p->arm_pid) != GNUNET_OK) |
545 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 545 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
546 | GNUNET_OS_process_close (p->arm_proc); | ||
547 | p->arm_proc = NULL; | ||
546 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
547 | "ARM process %u stopped\n", p->arm_pid); | 549 | "ARM process %u stopped\n", p->arm_pid); |
548 | #endif | 550 | #endif |