diff options
47 files changed, 120 insertions, 192 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 81f1c2d5c..e404f8d27 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -375,7 +375,7 @@ arm_service_report (void *cls, | |||
375 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 375 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
376 | { | 376 | { |
377 | struct RequestContext *pos = cls; | 377 | struct RequestContext *pos = cls; |
378 | GNUNET_OS_Process *proc; | 378 | struct GNUNET_OS_Process *proc; |
379 | char *binary; | 379 | char *binary; |
380 | char *config; | 380 | char *config; |
381 | char *loprefix; | 381 | char *loprefix; |
diff --git a/src/arm/do_start_process.c b/src/arm/do_start_process.c index 7d691ce60..139d0c429 100644 --- a/src/arm/do_start_process.c +++ b/src/arm/do_start_process.c | |||
@@ -12,7 +12,7 @@ | |||
12 | * @param ... more arguments, NULL terminated | 12 | * @param ... more arguments, NULL terminated |
13 | * @return PID of the started process, -1 on error | 13 | * @return PID of the started process, -1 on error |
14 | */ | 14 | */ |
15 | static GNUNET_OS_Process * | 15 | static struct GNUNET_OS_Process * |
16 | do_start_process (const int *lsocks, | 16 | do_start_process (const int *lsocks, |
17 | const char *first_arg, ...) | 17 | const char *first_arg, ...) |
18 | { | 18 | { |
@@ -24,7 +24,7 @@ do_start_process (const int *lsocks, | |||
24 | char *pos; | 24 | char *pos; |
25 | char *cp; | 25 | char *cp; |
26 | const char *last; | 26 | const char *last; |
27 | GNUNET_OS_Process *proc; | 27 | struct GNUNET_OS_Process *proc; |
28 | 28 | ||
29 | argv_size = 1; | 29 | argv_size = 1; |
30 | va_start (ap, first_arg); | 30 | va_start (ap, first_arg); |
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 543e65557..ab4db97c7 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c | |||
@@ -93,7 +93,7 @@ struct ServiceList | |||
93 | /** | 93 | /** |
94 | * Process structure pointer of the child. | 94 | * Process structure pointer of the child. |
95 | */ | 95 | */ |
96 | GNUNET_OS_Process *proc; | 96 | struct GNUNET_OS_Process *proc; |
97 | 97 | ||
98 | /** | 98 | /** |
99 | * Last time the config of this service was | 99 | * Last time the config of this service was |
@@ -434,12 +434,10 @@ start_process (struct ServiceList *sl, | |||
434 | sl->name); | 434 | sl->name); |
435 | else | 435 | else |
436 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 436 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
437 | _("Starting service `%s' (PID: %d)\n"), | 437 | _("Starting service `%s'\n"), |
438 | sl->name, | 438 | sl->name); |
439 | (int) GNUNET_OS_process_get_pid (sl->proc)); | ||
440 | GNUNET_free (loprefix); | 439 | GNUNET_free (loprefix); |
441 | GNUNET_free (options); | 440 | GNUNET_free (options); |
442 | /* FIXME: should check sl->proc */ | ||
443 | } | 441 | } |
444 | 442 | ||
445 | 443 | ||
@@ -735,9 +733,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
735 | if (pos->proc != NULL) | 733 | if (pos->proc != NULL) |
736 | { | 734 | { |
737 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 735 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
738 | "Stopping service `%s' (PID: %d)\n", | 736 | "Stopping service `%s'\n", |
739 | pos->name, | 737 | pos->name); |
740 | GNUNET_OS_process_get_pid (pos->proc)); | ||
741 | if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM)) | 738 | if (0 != GNUNET_OS_process_kill (pos->proc, SIGTERM)) |
742 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 739 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
743 | } | 740 | } |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index a4c3b0a78..eb7bc60f6 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 | GNUNET_OS_Process *arm_proc; | 57 | struct GNUNET_OS_Process *arm_proc; |
58 | #endif | 58 | #endif |
59 | }; | 59 | }; |
60 | 60 | ||
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 0b3be2f82..49fe8f9de 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 | GNUNET_OS_Process *arm_proc; | 77 | struct GNUNET_OS_Process *arm_proc; |
78 | #endif | 78 | #endif |
79 | }; | 79 | }; |
80 | 80 | ||
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index e82f12ed3..958defbf9 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 | GNUNET_OS_Process *arm_proc; | 52 | struct GNUNET_OS_Process *arm_proc; |
53 | #endif | 53 | #endif |
54 | }; | 54 | }; |
55 | 55 | ||
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 07bb16016..8dd7e6680 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -372,7 +372,7 @@ run (void *cls, | |||
372 | static int | 372 | static int |
373 | check () | 373 | check () |
374 | { | 374 | { |
375 | GNUNET_OS_Process *proc; | 375 | struct GNUNET_OS_Process *proc; |
376 | char cfg_name[128]; | 376 | char cfg_name[128]; |
377 | char *const argv[] = { | 377 | char *const argv[] = { |
378 | "perf-datastore-api", | 378 | "perf-datastore-api", |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index feba0b7ac..3b7202005 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -641,7 +641,7 @@ check () | |||
641 | { | 641 | { |
642 | char cfg_name[128]; | 642 | char cfg_name[128]; |
643 | #if START_DATASTORE | 643 | #if START_DATASTORE |
644 | GNUNET_OS_Process *proc; | 644 | struct GNUNET_OS_Process *proc; |
645 | #endif | 645 | #endif |
646 | char *const argv[] = { | 646 | char *const argv[] = { |
647 | "test-datastore-api", | 647 | "test-datastore-api", |
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index fbb8795a6..81450d12a 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -350,7 +350,7 @@ run (void *cls, | |||
350 | static int | 350 | static int |
351 | check () | 351 | check () |
352 | { | 352 | { |
353 | GNUNET_OS_Process *proc; | 353 | struct GNUNET_OS_Process *proc; |
354 | char cfg_name[128]; | 354 | char cfg_name[128]; |
355 | char *const argv[] = { | 355 | char *const argv[] = { |
356 | "test-datastore-api-management", | 356 | "test-datastore-api-management", |
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 5ef70407c..5eeb44d13 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -85,7 +85,7 @@ struct PeerContext | |||
85 | struct GNUNET_DHT_FindPeerHandle *find_peer_handle; | 85 | struct GNUNET_DHT_FindPeerHandle *find_peer_handle; |
86 | 86 | ||
87 | #if START_ARM | 87 | #if START_ARM |
88 | GNUNET_OS_Process *arm_proc; | 88 | struct GNUNET_OS_Process *arm_proc; |
89 | #endif | 89 | #endif |
90 | }; | 90 | }; |
91 | 91 | ||
diff --git a/src/fs/test_fs.c b/src/fs/test_fs.c index a97faf94f..41a155407 100644 --- a/src/fs/test_fs.c +++ b/src/fs/test_fs.c | |||
@@ -104,7 +104,7 @@ int | |||
104 | main (int argc, char *argv[]) | 104 | main (int argc, char *argv[]) |
105 | { | 105 | { |
106 | #if START_DAEMON | 106 | #if START_DAEMON |
107 | GNUNET_OS_Process *daemon; | 107 | struct GNUNET_OS_Process *daemon; |
108 | #endif | 108 | #endif |
109 | int ok; | 109 | int ok; |
110 | struct GNUNET_ECRS_URI *uri; | 110 | struct GNUNET_ECRS_URI *uri; |
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 305dee07e..4bcedcb4d 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c | |||
@@ -52,7 +52,7 @@ struct PeerContext | |||
52 | { | 52 | { |
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | #if START_ARM | 54 | #if START_ARM |
55 | GNUNET_OS_Process *arm_proc; | 55 | struct GNUNET_OS_Process *arm_proc; |
56 | #endif | 56 | #endif |
57 | }; | 57 | }; |
58 | 58 | ||
diff --git a/src/fs/test_fs_download_indexed.c b/src/fs/test_fs_download_indexed.c index b55f2221b..21d95d584 100644 --- a/src/fs/test_fs_download_indexed.c +++ b/src/fs/test_fs_download_indexed.c | |||
@@ -52,7 +52,7 @@ struct PeerContext | |||
52 | { | 52 | { |
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | #if START_ARM | 54 | #if START_ARM |
55 | GNUNET_OS_Process *arm_proc; | 55 | struct GNUNET_OS_Process *arm_proc; |
56 | #endif | 56 | #endif |
57 | }; | 57 | }; |
58 | 58 | ||
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index 6bb4ab865..966d52412 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c | |||
@@ -52,7 +52,7 @@ struct PeerContext | |||
52 | { | 52 | { |
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | #if START_ARM | 54 | #if START_ARM |
55 | GNUNET_OS_Process *arm_proc; | 55 | struct GNUNET_OS_Process *arm_proc; |
56 | #endif | 56 | #endif |
57 | }; | 57 | }; |
58 | 58 | ||
diff --git a/src/fs/test_fs_download_recursive.c b/src/fs/test_fs_download_recursive.c index a60a2da9a..ee320640c 100644 --- a/src/fs/test_fs_download_recursive.c +++ b/src/fs/test_fs_download_recursive.c | |||
@@ -256,7 +256,7 @@ int | |||
256 | main (int argc, char *argv[]) | 256 | main (int argc, char *argv[]) |
257 | { | 257 | { |
258 | #if START_DAEMON | 258 | #if START_DAEMON |
259 | GNUNET_OS_Process *daemon; | 259 | struct GNUNET_OS_Process *daemon; |
260 | #endif | 260 | #endif |
261 | int ok; | 261 | int ok; |
262 | char *fn = NULL; | 262 | char *fn = NULL; |
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c index 1221ff6c4..0e46336df 100644 --- a/src/fs/test_fs_list_indexed.c +++ b/src/fs/test_fs_list_indexed.c | |||
@@ -56,7 +56,7 @@ struct PeerContext | |||
56 | { | 56 | { |
57 | struct GNUNET_CONFIGURATION_Handle *cfg; | 57 | struct GNUNET_CONFIGURATION_Handle *cfg; |
58 | #if START_ARM | 58 | #if START_ARM |
59 | GNUNET_OS_Process *arm_proc; | 59 | struct GNUNET_OS_Process *arm_proc; |
60 | #endif | 60 | #endif |
61 | }; | 61 | }; |
62 | 62 | ||
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index efe44af0b..b7641ab3b 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c | |||
@@ -59,7 +59,7 @@ struct PeerContext | |||
59 | { | 59 | { |
60 | struct GNUNET_CONFIGURATION_Handle *cfg; | 60 | struct GNUNET_CONFIGURATION_Handle *cfg; |
61 | #if START_ARM | 61 | #if START_ARM |
62 | GNUNET_OS_Process *arm_proc; | 62 | struct GNUNET_OS_Process *arm_proc; |
63 | #endif | 63 | #endif |
64 | }; | 64 | }; |
65 | 65 | ||
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c index 1cf8653bb..2637b1665 100644 --- a/src/fs/test_fs_namespace_list_updateable.c +++ b/src/fs/test_fs_namespace_list_updateable.c | |||
@@ -55,7 +55,7 @@ struct PeerContext | |||
55 | { | 55 | { |
56 | struct GNUNET_CONFIGURATION_Handle *cfg; | 56 | struct GNUNET_CONFIGURATION_Handle *cfg; |
57 | #if START_ARM | 57 | #if START_ARM |
58 | GNUNET_OS_Process *arm_proc; | 58 | struct GNUNET_OS_Process *arm_proc; |
59 | #endif | 59 | #endif |
60 | }; | 60 | }; |
61 | 61 | ||
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index 4e65e7590..b5472ca93 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c | |||
@@ -53,7 +53,7 @@ struct PeerContext | |||
53 | { | 53 | { |
54 | struct GNUNET_CONFIGURATION_Handle *cfg; | 54 | struct GNUNET_CONFIGURATION_Handle *cfg; |
55 | #if START_ARM | 55 | #if START_ARM |
56 | GNUNET_OS_Process *arm_proc; | 56 | struct GNUNET_OS_Process *arm_proc; |
57 | #endif | 57 | #endif |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index afbee2ec8..b1260456b 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -52,7 +52,7 @@ struct PeerContext | |||
52 | { | 52 | { |
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | #if START_ARM | 54 | #if START_ARM |
55 | GNUNET_OS_Process *arm_proc; | 55 | struct GNUNET_OS_Process *arm_proc; |
56 | #endif | 56 | #endif |
57 | }; | 57 | }; |
58 | 58 | ||
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index 515730689..1609cd8e3 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c | |||
@@ -53,7 +53,7 @@ struct PeerContext | |||
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | struct GNUNET_PeerIdentity id; | 54 | struct GNUNET_PeerIdentity id; |
55 | #if START_ARM | 55 | #if START_ARM |
56 | GNUNET_OS_Process *arm_proc; | 56 | struct GNUNET_OS_Process *arm_proc; |
57 | #endif | 57 | #endif |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c index c2af22de4..d755a9582 100644 --- a/src/fs/test_fs_search_persistence.c +++ b/src/fs/test_fs_search_persistence.c | |||
@@ -53,7 +53,7 @@ struct PeerContext | |||
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | struct GNUNET_PeerIdentity id; | 54 | struct GNUNET_PeerIdentity id; |
55 | #if START_ARM | 55 | #if START_ARM |
56 | GNUNET_OS_Process *arm_proc; | 56 | struct GNUNET_OS_Process *arm_proc; |
57 | #endif | 57 | #endif |
58 | }; | 58 | }; |
59 | 59 | ||
diff --git a/src/fs/test_fs_search_ranking.c b/src/fs/test_fs_search_ranking.c index 06a069a32..06c37dfc2 100644 --- a/src/fs/test_fs_search_ranking.c +++ b/src/fs/test_fs_search_ranking.c | |||
@@ -126,7 +126,7 @@ int | |||
126 | main (int argc, char *argv[]) | 126 | main (int argc, char *argv[]) |
127 | { | 127 | { |
128 | #if START_DAEMON | 128 | #if START_DAEMON |
129 | GNUNET_OS_Process *daemon; | 129 | struct GNUNET_OS_Process *daemon; |
130 | #endif | 130 | #endif |
131 | int ok; | 131 | int ok; |
132 | char *fn = NULL; | 132 | char *fn = NULL; |
diff --git a/src/fs/test_fs_start_stop.c b/src/fs/test_fs_start_stop.c index 22fb64ae7..f64596061 100644 --- a/src/fs/test_fs_start_stop.c +++ b/src/fs/test_fs_start_stop.c | |||
@@ -41,7 +41,7 @@ struct PeerContext | |||
41 | { | 41 | { |
42 | struct GNUNET_CONFIGURATION_Handle *cfg; | 42 | struct GNUNET_CONFIGURATION_Handle *cfg; |
43 | #if START_ARM | 43 | #if START_ARM |
44 | GNUNET_OS_Process *arm_proc; | 44 | struct GNUNET_OS_Process *arm_proc; |
45 | #endif | 45 | #endif |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c index 0afed8f06..7adc4d229 100644 --- a/src/fs/test_fs_unindex.c +++ b/src/fs/test_fs_unindex.c | |||
@@ -52,7 +52,7 @@ struct PeerContext | |||
52 | { | 52 | { |
53 | struct GNUNET_CONFIGURATION_Handle *cfg; | 53 | struct GNUNET_CONFIGURATION_Handle *cfg; |
54 | #if START_ARM | 54 | #if START_ARM |
55 | GNUNET_OS_Process *arm_proc; | 55 | struct GNUNET_OS_Process *arm_proc; |
56 | #endif | 56 | #endif |
57 | }; | 57 | }; |
58 | 58 | ||
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c index d33ecb5fc..42f047b70 100644 --- a/src/fs/test_fs_unindex_persistence.c +++ b/src/fs/test_fs_unindex_persistence.c | |||
@@ -51,7 +51,7 @@ struct PeerContext | |||
51 | { | 51 | { |
52 | struct GNUNET_CONFIGURATION_Handle *cfg; | 52 | struct GNUNET_CONFIGURATION_Handle *cfg; |
53 | #if START_ARM | 53 | #if START_ARM |
54 | GNUNET_OS_Process *arm_proc; | 54 | struct GNUNET_OS_Process *arm_proc; |
55 | #endif | 55 | #endif |
56 | }; | 56 | }; |
57 | 57 | ||
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index a13f58a65..63ba53b69 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c | |||
@@ -49,7 +49,7 @@ struct PeerContext | |||
49 | struct GNUNET_TRANSPORT_Handle *th; | 49 | struct GNUNET_TRANSPORT_Handle *th; |
50 | struct GNUNET_MessageHeader *hello; | 50 | struct GNUNET_MessageHeader *hello; |
51 | #if START_ARM | 51 | #if START_ARM |
52 | GNUNET_OS_Process *arm_proc; | 52 | struct GNUNET_OS_Process *arm_proc; |
53 | #endif | 53 | #endif |
54 | }; | 54 | }; |
55 | 55 | ||
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index b5e6ca0bf..aa4e6b9ab 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -71,7 +71,7 @@ struct PeerContext | |||
71 | struct GNUNET_CORE_Handle *core; | 71 | struct GNUNET_CORE_Handle *core; |
72 | struct GNUNET_STATISTICS_Handle *stats; | 72 | struct GNUNET_STATISTICS_Handle *stats; |
73 | #if START_ARM | 73 | #if START_ARM |
74 | GNUNET_OS_Process *arm_proc; | 74 | struct GNUNET_OS_Process *arm_proc; |
75 | #endif | 75 | #endif |
76 | }; | 76 | }; |
77 | 77 | ||
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index 2152b279c..bb29e89df 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -47,7 +47,7 @@ extern "C" | |||
47 | /** | 47 | /** |
48 | * Process information (OS-dependent) | 48 | * Process information (OS-dependent) |
49 | */ | 49 | */ |
50 | typedef struct _GNUNET_OS_Process GNUNET_OS_Process; | 50 | struct GNUNET_OS_Process; |
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
@@ -175,15 +175,6 @@ void GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor | |||
175 | #define GNUNET_OS_get_hostname_max_length() 255 | 175 | #define GNUNET_OS_get_hostname_max_length() 255 |
176 | #endif | 176 | #endif |
177 | 177 | ||
178 | /** | ||
179 | * Allocates new process structure | ||
180 | * | ||
181 | * Should be made internal? | ||
182 | * | ||
183 | * @return pointer to allocated structure | ||
184 | */ | ||
185 | GNUNET_OS_Process *GNUNET_OS_process_alloc (); | ||
186 | |||
187 | 178 | ||
188 | /** | 179 | /** |
189 | * Get process structure for current process | 180 | * Get process structure for current process |
@@ -193,7 +184,7 @@ GNUNET_OS_Process *GNUNET_OS_process_alloc (); | |||
193 | * | 184 | * |
194 | * @return pointer to the process sturcutre for this process | 185 | * @return pointer to the process sturcutre for this process |
195 | */ | 186 | */ |
196 | GNUNET_OS_Process *GNUNET_OS_process_current (); | 187 | struct GNUNET_OS_Process *GNUNET_OS_process_current (void); |
197 | 188 | ||
198 | 189 | ||
199 | /** | 190 | /** |
@@ -203,56 +194,16 @@ GNUNET_OS_Process *GNUNET_OS_process_current (); | |||
203 | * @param sig signal | 194 | * @param sig signal |
204 | * @return 0 on success, -1 on error | 195 | * @return 0 on success, -1 on error |
205 | */ | 196 | */ |
206 | int GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig); | 197 | int GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig); |
207 | |||
208 | /** | ||
209 | * Get process ID | ||
210 | * | ||
211 | * Should be made internal? | ||
212 | * | ||
213 | * @param proc pointer to process structure | ||
214 | * @return process ID | ||
215 | */ | ||
216 | pid_t GNUNET_OS_process_get_pid (GNUNET_OS_Process *proc); | ||
217 | |||
218 | /** | ||
219 | * Set process ID | ||
220 | * | ||
221 | * Should be made internal? | ||
222 | * | ||
223 | * @param proc pointer to process structure | ||
224 | * @param pid process ID | ||
225 | */ | ||
226 | void GNUNET_OS_process_set_pid (GNUNET_OS_Process *proc, pid_t pid); | ||
227 | 198 | ||
228 | #if WINDOWS | ||
229 | /** | ||
230 | * Get process handle | ||
231 | * | ||
232 | * Should be made internal? | ||
233 | * | ||
234 | * @param proc pointer to process structure | ||
235 | * @return process handle | ||
236 | */ | ||
237 | HANDLE GNUNET_OS_process_get_handle (GNUNET_OS_Process *proc); | ||
238 | |||
239 | /** | ||
240 | * Set process handle | ||
241 | * | ||
242 | * Should be made internal? | ||
243 | * | ||
244 | * @param proc pointer to process structure | ||
245 | * @param handle process handle | ||
246 | */ | ||
247 | void GNUNET_OS_process_set_handle(GNUNET_OS_Process *proc, HANDLE handle); | ||
248 | #endif | ||
249 | 199 | ||
250 | /** | 200 | /** |
251 | * Cleans up process structure contents (OS-dependent) and deallocates it | 201 | * Cleans up process structure contents (OS-dependent) and deallocates it |
252 | * | 202 | * |
253 | * @param proc pointer to process structure | 203 | * @param proc pointer to process structure |
254 | */ | 204 | */ |
255 | void GNUNET_OS_process_close (GNUNET_OS_Process *proc); | 205 | void GNUNET_OS_process_close (struct GNUNET_OS_Process *proc); |
206 | |||
256 | 207 | ||
257 | /** | 208 | /** |
258 | * Set process priority | 209 | * Set process priority |
@@ -261,7 +212,7 @@ void GNUNET_OS_process_close (GNUNET_OS_Process *proc); | |||
261 | * @param prio priority value | 212 | * @param prio priority value |
262 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 213 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
263 | */ | 214 | */ |
264 | int GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | 215 | int GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, |
265 | enum GNUNET_SCHEDULER_Priority prio); | 216 | enum GNUNET_SCHEDULER_Priority prio); |
266 | 217 | ||
267 | 218 | ||
@@ -274,7 +225,7 @@ int GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | |||
274 | * @param ... NULL-terminated list of arguments to the process | 225 | * @param ... NULL-terminated list of arguments to the process |
275 | * @return pointer to process structure of the new process, NULL on error | 226 | * @return pointer to process structure of the new process, NULL on error |
276 | */ | 227 | */ |
277 | GNUNET_OS_Process * | 228 | struct GNUNET_OS_Process * |
278 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 229 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, |
279 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 230 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
280 | const char *filename, ...); | 231 | const char *filename, ...); |
@@ -290,7 +241,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
290 | * including the process name as the first argument | 241 | * including the process name as the first argument |
291 | * @return pointer to process structure of the new process, NULL on error | 242 | * @return pointer to process structure of the new process, NULL on error |
292 | */ | 243 | */ |
293 | GNUNET_OS_Process * | 244 | struct GNUNET_OS_Process * |
294 | GNUNET_OS_start_process_v (const int *lsocks, const char *filename, | 245 | GNUNET_OS_start_process_v (const int *lsocks, const char *filename, |
295 | char *const argv[]); | 246 | char *const argv[]); |
296 | 247 | ||
@@ -302,8 +253,8 @@ GNUNET_OS_start_process_v (const int *lsocks, const char *filename, | |||
302 | * @param code return code/signal number | 253 | * @param code return code/signal number |
303 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise | 254 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise |
304 | */ | 255 | */ |
305 | int GNUNET_OS_process_status (GNUNET_OS_Process *proc, | 256 | int GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, |
306 | enum GNUNET_OS_ProcessStatusType *type, unsigned long *code); | 257 | enum GNUNET_OS_ProcessStatusType *type, unsigned long *code); |
307 | 258 | ||
308 | 259 | ||
309 | /** | 260 | /** |
@@ -311,7 +262,7 @@ int GNUNET_OS_process_status (GNUNET_OS_Process *proc, | |||
311 | * @param proc pointer to process structure of the process to wait for | 262 | * @param proc pointer to process structure of the process to wait for |
312 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 263 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
313 | */ | 264 | */ |
314 | int GNUNET_OS_process_wait (GNUNET_OS_Process *proc); | 265 | int GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); |
315 | 266 | ||
316 | 267 | ||
317 | #if 0 /* keep Emacsens' auto-indent happy */ | 268 | #if 0 /* keep Emacsens' auto-indent happy */ |
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 3fee527b8..a00e59976 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -301,7 +301,7 @@ struct GNUNET_TESTING_Daemon | |||
301 | /** | 301 | /** |
302 | * PID of the process that we started last. | 302 | * PID of the process that we started last. |
303 | */ | 303 | */ |
304 | GNUNET_OS_Process *proc; | 304 | struct GNUNET_OS_Process *proc; |
305 | 305 | ||
306 | /** | 306 | /** |
307 | * In which phase are we during the start of | 307 | * In which phase are we during the start of |
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c index eea2eb973..2c3d54109 100755 --- a/src/peerinfo/perf_peerinfo_api.c +++ b/src/peerinfo/perf_peerinfo_api.c | |||
@@ -166,7 +166,7 @@ check () | |||
166 | NULL | 166 | NULL |
167 | }; | 167 | }; |
168 | #if START_SERVICE | 168 | #if START_SERVICE |
169 | GNUNET_OS_Process *proc; | 169 | struct GNUNET_OS_Process *proc; |
170 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 170 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
171 | GNUNET_GETOPT_OPTION_END | 171 | GNUNET_GETOPT_OPTION_END |
172 | }; | 172 | }; |
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index b2e95d767..eae448bbf 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c | |||
@@ -165,7 +165,7 @@ static int | |||
165 | check () | 165 | check () |
166 | { | 166 | { |
167 | int ok = 3; | 167 | int ok = 3; |
168 | GNUNET_OS_Process *proc; | 168 | struct GNUNET_OS_Process *proc; |
169 | char *const argv[] = { "test-peerinfo-api", | 169 | char *const argv[] = { "test-peerinfo-api", |
170 | "-c", | 170 | "-c", |
171 | "test_peerinfo_api_data.conf", | 171 | "test_peerinfo_api_data.conf", |
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c index 6a45e3b10..cce90146c 100644 --- a/src/statistics/test_statistics_api.c +++ b/src/statistics/test_statistics_api.c | |||
@@ -157,7 +157,7 @@ check () | |||
157 | GNUNET_GETOPT_OPTION_END | 157 | GNUNET_GETOPT_OPTION_END |
158 | }; | 158 | }; |
159 | #if START_SERVICE | 159 | #if START_SERVICE |
160 | GNUNET_OS_Process *proc; | 160 | struct GNUNET_OS_Process *proc; |
161 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 161 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", |
162 | "gnunet-service-statistics", | 162 | "gnunet-service-statistics", |
163 | #if DEBUG_STATISTICS | 163 | #if DEBUG_STATISTICS |
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c index b4e7ae7ab..7eaa9d27b 100644 --- a/src/statistics/test_statistics_api_loop.c +++ b/src/statistics/test_statistics_api_loop.c | |||
@@ -96,7 +96,7 @@ check () | |||
96 | GNUNET_GETOPT_OPTION_END | 96 | GNUNET_GETOPT_OPTION_END |
97 | }; | 97 | }; |
98 | #if START_SERVICE | 98 | #if START_SERVICE |
99 | GNUNET_OS_Process *proc; | 99 | struct GNUNET_OS_Process *proc; |
100 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 100 | proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", |
101 | "gnunet-service-statistics", | 101 | "gnunet-service-statistics", |
102 | #if DEBUG_STATISTICS | 102 | #if DEBUG_STATISTICS |
diff --git a/src/testing/test_testing_topology.c b/src/testing/test_testing_topology.c index ed1f2d591..7ca58faf1 100644 --- a/src/testing/test_testing_topology.c +++ b/src/testing/test_testing_topology.c | |||
@@ -179,7 +179,7 @@ static void gather_log_data () | |||
179 | { | 179 | { |
180 | char *peer_number; | 180 | char *peer_number; |
181 | char *connect_number; | 181 | char *connect_number; |
182 | GNUNET_OS_Process *mem_process; | 182 | struct GNUNET_OS_Process *mem_process; |
183 | GNUNET_asprintf(&peer_number, "%llu", num_peers); | 183 | GNUNET_asprintf(&peer_number, "%llu", num_peers); |
184 | GNUNET_asprintf(&connect_number, "%llu", expected_connections); | 184 | GNUNET_asprintf(&connect_number, "%llu", expected_connections); |
185 | mem_process = GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", | 185 | mem_process = GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 4b34a21de..7322fc44a 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -1937,7 +1937,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
1937 | FILE *temp_friend_handle; | 1937 | FILE *temp_friend_handle; |
1938 | unsigned int pg_iter; | 1938 | unsigned int pg_iter; |
1939 | char *temp_service_path; | 1939 | char *temp_service_path; |
1940 | GNUNET_OS_Process **procarr; | 1940 | struct GNUNET_OS_Process **procarr; |
1941 | char *arg; | 1941 | char *arg; |
1942 | char * mytemp; | 1942 | char * mytemp; |
1943 | enum GNUNET_OS_ProcessStatusType type; | 1943 | enum GNUNET_OS_ProcessStatusType type; |
@@ -1946,7 +1946,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
1946 | int ret; | 1946 | int ret; |
1947 | int max_wait = 10; | 1947 | int max_wait = 10; |
1948 | 1948 | ||
1949 | procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total); | 1949 | procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total); |
1950 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) | 1950 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) |
1951 | { | 1951 | { |
1952 | mytemp = GNUNET_DISK_mktemp("friends"); | 1952 | mytemp = GNUNET_DISK_mktemp("friends"); |
@@ -2064,7 +2064,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char | |||
2064 | static struct BlacklistContext blacklist_ctx; | 2064 | static struct BlacklistContext blacklist_ctx; |
2065 | unsigned int pg_iter; | 2065 | unsigned int pg_iter; |
2066 | char *temp_service_path; | 2066 | char *temp_service_path; |
2067 | GNUNET_OS_Process **procarr; | 2067 | struct GNUNET_OS_Process **procarr; |
2068 | char *arg; | 2068 | char *arg; |
2069 | char *mytemp; | 2069 | char *mytemp; |
2070 | enum GNUNET_OS_ProcessStatusType type; | 2070 | enum GNUNET_OS_ProcessStatusType type; |
@@ -2077,7 +2077,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, const char | |||
2077 | char *pos; | 2077 | char *pos; |
2078 | char *temp_transports; | 2078 | char *temp_transports; |
2079 | 2079 | ||
2080 | procarr = GNUNET_malloc(sizeof(GNUNET_OS_Process *) * pg->total); | 2080 | procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total); |
2081 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) | 2081 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) |
2082 | { | 2082 | { |
2083 | mytemp = GNUNET_DISK_mktemp("blacklist"); | 2083 | mytemp = GNUNET_DISK_mktemp("blacklist"); |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index d39787900..1073b24b7 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -345,7 +345,7 @@ struct Plugin | |||
345 | /** | 345 | /** |
346 | * The process id of the server process (if behind NAT) | 346 | * The process id of the server process (if behind NAT) |
347 | */ | 347 | */ |
348 | GNUNET_OS_Process *server_proc; | 348 | struct GNUNET_OS_Process *server_proc; |
349 | 349 | ||
350 | /** | 350 | /** |
351 | * List of open TCP sessions. | 351 | * List of open TCP sessions. |
@@ -958,7 +958,7 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen) | |||
958 | char inet4[INET_ADDRSTRLEN]; | 958 | char inet4[INET_ADDRSTRLEN]; |
959 | char *address_as_string; | 959 | char *address_as_string; |
960 | char *port_as_string; | 960 | char *port_as_string; |
961 | GNUNET_OS_Process *proc; | 961 | struct GNUNET_OS_Process *proc; |
962 | const struct sockaddr *sa = (const struct sockaddr *)addr; | 962 | const struct sockaddr *sa = (const struct sockaddr *)addr; |
963 | 963 | ||
964 | #if DEBUG_TCP_NAT | 964 | #if DEBUG_TCP_NAT |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 0f53719fe..4bd8c36d3 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -471,7 +471,7 @@ struct Plugin | |||
471 | /** | 471 | /** |
472 | * The process id of the server process (if behind NAT) | 472 | * The process id of the server process (if behind NAT) |
473 | */ | 473 | */ |
474 | GNUNET_OS_Process *server_proc; | 474 | struct GNUNET_OS_Process *server_proc; |
475 | 475 | ||
476 | }; | 476 | }; |
477 | 477 | ||
@@ -702,7 +702,7 @@ run_gnunet_nat_client (struct Plugin *plugin, const char *addr, size_t addrlen) | |||
702 | char addr_buf[INET_ADDRSTRLEN]; | 702 | char addr_buf[INET_ADDRSTRLEN]; |
703 | char *address_as_string; | 703 | char *address_as_string; |
704 | char *port_as_string; | 704 | char *port_as_string; |
705 | GNUNET_OS_Process *proc; | 705 | struct GNUNET_OS_Process *proc; |
706 | const struct IPv4UdpAddress *t4; | 706 | const struct IPv4UdpAddress *t4; |
707 | 707 | ||
708 | GNUNET_assert(addrlen == sizeof(struct IPv4UdpAddress)); | 708 | GNUNET_assert(addrlen == sizeof(struct IPv4UdpAddress)); |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index e53e4f3b4..0f95f48c7 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -135,7 +135,7 @@ struct Plugin | |||
135 | /** | 135 | /** |
136 | * The process id of the server process (if behind NAT) | 136 | * The process id of the server process (if behind NAT) |
137 | */ | 137 | */ |
138 | GNUNET_OS_Process *server_proc; | 138 | struct GNUNET_OS_Process *server_proc; |
139 | 139 | ||
140 | /** | 140 | /** |
141 | * The interface of the wlan card given to us by the user. | 141 | * The interface of the wlan card given to us by the user. |
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 39319f8d7..77279897d 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c | |||
@@ -65,7 +65,7 @@ struct PeerContext | |||
65 | struct GNUNET_TRANSPORT_Handle *th; | 65 | struct GNUNET_TRANSPORT_Handle *th; |
66 | struct GNUNET_PeerIdentity id; | 66 | struct GNUNET_PeerIdentity id; |
67 | #if START_ARM | 67 | #if START_ARM |
68 | GNUNET_OS_Process *arm_proc; | 68 | struct GNUNET_OS_Process *arm_proc; |
69 | #endif | 69 | #endif |
70 | }; | 70 | }; |
71 | 71 | ||
diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 7a45ea0f0..cee1da25b 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c | |||
@@ -60,7 +60,7 @@ struct PeerContext | |||
60 | struct GNUNET_TRANSPORT_Handle *th; | 60 | struct GNUNET_TRANSPORT_Handle *th; |
61 | struct GNUNET_PeerIdentity id; | 61 | struct GNUNET_PeerIdentity id; |
62 | #if START_ARM | 62 | #if START_ARM |
63 | GNUNET_OS_Process *arm_proc; | 63 | struct GNUNET_OS_Process *arm_proc; |
64 | #endif | 64 | #endif |
65 | }; | 65 | }; |
66 | 66 | ||
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index d9e88fe49..a8633e089 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c | |||
@@ -62,7 +62,7 @@ struct PeerContext | |||
62 | struct GNUNET_TRANSPORT_Handle *th; | 62 | struct GNUNET_TRANSPORT_Handle *th; |
63 | struct GNUNET_PeerIdentity id; | 63 | struct GNUNET_PeerIdentity id; |
64 | #if START_ARM | 64 | #if START_ARM |
65 | GNUNET_OS_Process *arm_proc; | 65 | struct GNUNET_OS_Process *arm_proc; |
66 | #endif | 66 | #endif |
67 | }; | 67 | }; |
68 | 68 | ||
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 75435a5e6..622817492 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -188,7 +188,7 @@ GNUNET_CRYPTO_random_disable_entropy_gathering () | |||
188 | * Process ID of the "find" process that we use for | 188 | * Process ID of the "find" process that we use for |
189 | * entropy gathering. | 189 | * entropy gathering. |
190 | */ | 190 | */ |
191 | static GNUNET_OS_Process *genproc; | 191 | static struct GNUNET_OS_Process *genproc; |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Function called by libgcrypt whenever we are | 194 | * Function called by libgcrypt whenever we are |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index b9e5f010b..5f78e2179 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_os_lib.h" | 29 | #include "gnunet_os_lib.h" |
30 | #include "disk.h" | 30 | #include "disk.h" |
31 | 31 | ||
32 | struct _GNUNET_OS_Process | 32 | struct GNUNET_OS_Process |
33 | { | 33 | { |
34 | pid_t pid; | 34 | pid_t pid; |
35 | #if WINDOWS | 35 | #if WINDOWS |
@@ -37,18 +37,19 @@ struct _GNUNET_OS_Process | |||
37 | #endif | 37 | #endif |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static GNUNET_OS_Process current_process; | 40 | static struct GNUNET_OS_Process current_process; |
41 | |||
41 | 42 | ||
42 | GNUNET_OS_Process * | ||
43 | GNUNET_OS_process_alloc () | ||
44 | { | ||
45 | GNUNET_OS_Process *ret = GNUNET_malloc (sizeof (GNUNET_OS_Process)); | ||
46 | ret->pid = 0; | ||
47 | #if WINDOWS | 43 | #if WINDOWS |
48 | ret->handle = NULL; | 44 | void |
49 | #endif | 45 | GNUNET_OS_process_set_handle(struct GNUNET_OS_Process *proc, HANDLE handle) |
50 | return ret; | 46 | { |
47 | if (proc->handle != NULL) | ||
48 | CloseHandle (proc->handle); | ||
49 | proc->handle = handle; | ||
51 | } | 50 | } |
51 | #endif | ||
52 | |||
52 | 53 | ||
53 | /** | 54 | /** |
54 | * Get process structure for current process | 55 | * Get process structure for current process |
@@ -58,7 +59,7 @@ GNUNET_OS_process_alloc () | |||
58 | * | 59 | * |
59 | * @return pointer to the process sturcutre for this process | 60 | * @return pointer to the process sturcutre for this process |
60 | */ | 61 | */ |
61 | GNUNET_OS_Process * | 62 | struct GNUNET_OS_Process * |
62 | GNUNET_OS_process_current () | 63 | GNUNET_OS_process_current () |
63 | { | 64 | { |
64 | #if WINDOWS | 65 | #if WINDOWS |
@@ -71,7 +72,7 @@ GNUNET_OS_process_current () | |||
71 | } | 72 | } |
72 | 73 | ||
73 | int | 74 | int |
74 | GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig) | 75 | GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) |
75 | { | 76 | { |
76 | #if WINDOWS | 77 | #if WINDOWS |
77 | if (sig == SIGKILL || sig == SIGTERM) | 78 | if (sig == SIGKILL || sig == SIGTERM) |
@@ -79,7 +80,10 @@ GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig) | |||
79 | HANDLE h = GNUNET_OS_process_get_handle (proc); | 80 | HANDLE h = GNUNET_OS_process_get_handle (proc); |
80 | if (NULL == h) | 81 | if (NULL == h) |
81 | { | 82 | { |
82 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", GNUNET_OS_process_get_pid (proc), h); | 83 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
84 | _("Invalid process information {%d, %08X}\n"), | ||
85 | proc->pid, | ||
86 | h); | ||
83 | return -1; | 87 | return -1; |
84 | } | 88 | } |
85 | if (!TerminateProcess (h, 0)) | 89 | if (!TerminateProcess (h, 0)) |
@@ -93,40 +97,13 @@ GNUNET_OS_process_kill (GNUNET_OS_Process *proc, int sig) | |||
93 | errno = EINVAL; | 97 | errno = EINVAL; |
94 | return -1; | 98 | return -1; |
95 | #else | 99 | #else |
96 | return kill (GNUNET_OS_process_get_pid (proc), sig); | 100 | return kill (proc->pid, sig); |
97 | #endif | 101 | #endif |
98 | } | 102 | } |
99 | 103 | ||
100 | pid_t | ||
101 | GNUNET_OS_process_get_pid (GNUNET_OS_Process *proc) | ||
102 | { | ||
103 | return proc->pid; | ||
104 | } | ||
105 | |||
106 | void | ||
107 | GNUNET_OS_process_set_pid (GNUNET_OS_Process *proc, pid_t pid) | ||
108 | { | ||
109 | proc->pid = pid; | ||
110 | } | ||
111 | |||
112 | #if WINDOWS | ||
113 | HANDLE | ||
114 | GNUNET_OS_process_get_handle (GNUNET_OS_Process *proc) | ||
115 | { | ||
116 | return proc->handle; | ||
117 | } | ||
118 | |||
119 | void | ||
120 | GNUNET_OS_process_set_handle(GNUNET_OS_Process *proc, HANDLE handle) | ||
121 | { | ||
122 | if (proc->handle != NULL) | ||
123 | CloseHandle (proc->handle); | ||
124 | proc->handle = handle; | ||
125 | } | ||
126 | #endif | ||
127 | 104 | ||
128 | void | 105 | void |
129 | GNUNET_OS_process_close (GNUNET_OS_Process *proc) | 106 | GNUNET_OS_process_close (struct GNUNET_OS_Process *proc) |
130 | { | 107 | { |
131 | #if WINDOWS | 108 | #if WINDOWS |
132 | if (proc->handle != NULL) | 109 | if (proc->handle != NULL) |
@@ -147,7 +124,7 @@ extern GNUNET_SIGNAL_Handler w32_sigchld_handler; | |||
147 | static DWORD WINAPI | 124 | static DWORD WINAPI |
148 | ChildWaitThread (void *arg) | 125 | ChildWaitThread (void *arg) |
149 | { | 126 | { |
150 | GNUNET_OS_Process *proc = (GNUNET_OS_Process *) arg; | 127 | struct GNUNET_OS_Process *proc = (struct GNUNET_OS_Process *) arg; |
151 | WaitForSingleObject (proc->handle, INFINITE); | 128 | WaitForSingleObject (proc->handle, INFINITE); |
152 | 129 | ||
153 | if (w32_sigchld_handler) | 130 | if (w32_sigchld_handler) |
@@ -165,11 +142,10 @@ ChildWaitThread (void *arg) | |||
165 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 142 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
166 | */ | 143 | */ |
167 | int | 144 | int |
168 | GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | 145 | GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, |
169 | enum GNUNET_SCHEDULER_Priority prio) | 146 | enum GNUNET_SCHEDULER_Priority prio) |
170 | { | 147 | { |
171 | int rprio; | 148 | int rprio; |
172 | pid_t pid; | ||
173 | 149 | ||
174 | GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT); | 150 | GNUNET_assert (prio < GNUNET_SCHEDULER_PRIORITY_COUNT); |
175 | if (prio == GNUNET_SCHEDULER_PRIORITY_KEEP) | 151 | if (prio == GNUNET_SCHEDULER_PRIORITY_KEEP) |
@@ -223,16 +199,17 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | |||
223 | return GNUNET_SYSERR; | 199 | return GNUNET_SYSERR; |
224 | } | 200 | } |
225 | 201 | ||
226 | pid = GNUNET_OS_process_get_pid (proc); | ||
227 | |||
228 | /* Set process priority */ | 202 | /* Set process priority */ |
229 | #ifdef MINGW | 203 | #ifdef MINGW |
230 | { | 204 | { |
231 | HANDLE h = GNUNET_OS_process_get_handle (proc); | 205 | HANDLE h = proc->handle; |
232 | GNUNET_assert (h != NULL); | 206 | GNUNET_assert (h != NULL); |
233 | SetPriorityClass (h, rprio); | 207 | SetPriorityClass (h, rprio); |
234 | } | 208 | } |
235 | #elif LINUX | 209 | #elif LINUX |
210 | pid_t pid; | ||
211 | |||
212 | pid = proc->pid; | ||
236 | if ( (0 == pid) || | 213 | if ( (0 == pid) || |
237 | (pid == getpid () ) ) | 214 | (pid == getpid () ) ) |
238 | { | 215 | { |
@@ -251,7 +228,6 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | |||
251 | else | 228 | else |
252 | { | 229 | { |
253 | if (0 != setpriority (PRIO_PROCESS, pid, rprio)) | 230 | if (0 != setpriority (PRIO_PROCESS, pid, rprio)) |
254 | |||
255 | { | 231 | { |
256 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING | | 232 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING | |
257 | GNUNET_ERROR_TYPE_BULK, "setpriority"); | 233 | GNUNET_ERROR_TYPE_BULK, "setpriority"); |
@@ -274,7 +250,7 @@ GNUNET_OS_set_process_priority (GNUNET_OS_Process *proc, | |||
274 | * @param ... NULL-terminated list of arguments to the process | 250 | * @param ... NULL-terminated list of arguments to the process |
275 | * @return pointer to process structure of the new process, NULL on error | 251 | * @return pointer to process structure of the new process, NULL on error |
276 | */ | 252 | */ |
277 | GNUNET_OS_Process * | 253 | struct GNUNET_OS_Process * |
278 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 254 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, |
279 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 255 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
280 | const char *filename, ...) | 256 | const char *filename, ...) |
@@ -283,7 +259,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
283 | 259 | ||
284 | #ifndef MINGW | 260 | #ifndef MINGW |
285 | pid_t ret; | 261 | pid_t ret; |
286 | GNUNET_OS_Process *gnunet_proc = NULL; | 262 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
287 | char **argv; | 263 | char **argv; |
288 | int argc; | 264 | int argc; |
289 | int fd_stdout_write; | 265 | int fd_stdout_write; |
@@ -342,8 +318,8 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
342 | GNUNET_DISK_pipe_close_end(pipe_stdin, GNUNET_DISK_PIPE_END_READ); | 318 | GNUNET_DISK_pipe_close_end(pipe_stdin, GNUNET_DISK_PIPE_END_READ); |
343 | sleep (1); | 319 | sleep (1); |
344 | #endif | 320 | #endif |
345 | gnunet_proc = GNUNET_OS_process_alloc (); | 321 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
346 | GNUNET_OS_process_set_pid (gnunet_proc, ret); | 322 | gnunet_proc->pid = ret; |
347 | } | 323 | } |
348 | GNUNET_free (argv); | 324 | GNUNET_free (argv); |
349 | return gnunet_proc; | 325 | return gnunet_proc; |
@@ -375,7 +351,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
375 | int findresult; | 351 | int findresult; |
376 | STARTUPINFO start; | 352 | STARTUPINFO start; |
377 | PROCESS_INFORMATION proc; | 353 | PROCESS_INFORMATION proc; |
378 | GNUNET_OS_Process *gnunet_proc = NULL; | 354 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
379 | 355 | ||
380 | HANDLE stdin_handle; | 356 | HANDLE stdin_handle; |
381 | HANDLE stdout_handle; | 357 | HANDLE stdout_handle; |
@@ -429,9 +405,9 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
429 | return NULL; | 405 | return NULL; |
430 | } | 406 | } |
431 | 407 | ||
432 | gnunet_proc = GNUNET_OS_process_alloc (); | 408 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
433 | GNUNET_OS_process_set_pid (gnunet_proc, proc.dwProcessId); | 409 | gnunet_proc->pid = proc.dwProcessId; |
434 | GNUNET_OS_process_set_handle (gnunet_proc, proc.hProcess); | 410 | gnunet_proc->handle = proc.hProcess; |
435 | 411 | ||
436 | CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL); | 412 | CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL); |
437 | 413 | ||
@@ -455,7 +431,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
455 | * @param argv NULL-terminated list of arguments to the process | 431 | * @param argv NULL-terminated list of arguments to the process |
456 | * @return process ID of the new process, -1 on error | 432 | * @return process ID of the new process, -1 on error |
457 | */ | 433 | */ |
458 | GNUNET_OS_Process * | 434 | struct GNUNET_OS_Process * |
459 | GNUNET_OS_start_process_v (const int *lsocks, | 435 | GNUNET_OS_start_process_v (const int *lsocks, |
460 | const char *filename, char *const argv[]) | 436 | const char *filename, char *const argv[]) |
461 | { | 437 | { |
@@ -463,7 +439,7 @@ GNUNET_OS_start_process_v (const int *lsocks, | |||
463 | pid_t ret; | 439 | pid_t ret; |
464 | char lpid[16]; | 440 | char lpid[16]; |
465 | char fds[16]; | 441 | char fds[16]; |
466 | GNUNET_OS_Process *gnunet_proc = NULL; | 442 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
467 | int i; | 443 | int i; |
468 | int j; | 444 | int j; |
469 | int k; | 445 | int k; |
@@ -505,8 +481,8 @@ GNUNET_OS_start_process_v (const int *lsocks, | |||
505 | be plenty in practice */ | 481 | be plenty in practice */ |
506 | sleep (1); | 482 | sleep (1); |
507 | #endif | 483 | #endif |
508 | gnunet_proc = GNUNET_OS_process_alloc (); | 484 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
509 | GNUNET_OS_process_set_pid (gnunet_proc, ret); | 485 | gnunet_proc->pid = ret; |
510 | } | 486 | } |
511 | GNUNET_array_grow (lscp, ls, 0); | 487 | GNUNET_array_grow (lscp, ls, 0); |
512 | return gnunet_proc; | 488 | return gnunet_proc; |
@@ -566,7 +542,7 @@ GNUNET_OS_start_process_v (const int *lsocks, | |||
566 | int argcount = 0; | 542 | int argcount = 0; |
567 | char *non_const_filename = NULL; | 543 | char *non_const_filename = NULL; |
568 | int filenamelen = 0; | 544 | int filenamelen = 0; |
569 | GNUNET_OS_Process *gnunet_proc = NULL; | 545 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
570 | 546 | ||
571 | GNUNET_assert (lsocks == NULL); | 547 | GNUNET_assert (lsocks == NULL); |
572 | /* Count the number of arguments */ | 548 | /* Count the number of arguments */ |
@@ -634,9 +610,9 @@ GNUNET_OS_start_process_v (const int *lsocks, | |||
634 | return NULL; | 610 | return NULL; |
635 | } | 611 | } |
636 | 612 | ||
637 | gnunet_proc = GNUNET_OS_process_alloc (); | 613 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
638 | GNUNET_OS_process_set_pid (gnunet_proc, proc.dwProcessId); | 614 | gnunet_proc->pid = proc.dwProcessId; |
639 | GNUNET_OS_process_set_handle (gnunet_proc, proc.hProcess); | 615 | gnunet_proc->handle = proc.hProcess; |
640 | 616 | ||
641 | CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL); | 617 | CreateThread (NULL, 64000, ChildWaitThread, (void *) gnunet_proc, 0, NULL); |
642 | 618 | ||
@@ -659,7 +635,8 @@ GNUNET_OS_start_process_v (const int *lsocks, | |||
659 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise | 635 | * @return GNUNET_OK on success, GNUNET_NO if the process is still running, GNUNET_SYSERR otherwise |
660 | */ | 636 | */ |
661 | int | 637 | int |
662 | GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusType *type, | 638 | GNUNET_OS_process_status (struct GNUNET_OS_Process *proc, |
639 | enum GNUNET_OS_ProcessStatusType *type, | ||
663 | unsigned long *code) | 640 | unsigned long *code) |
664 | { | 641 | { |
665 | #ifndef MINGW | 642 | #ifndef MINGW |
@@ -667,7 +644,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT | |||
667 | int ret; | 644 | int ret; |
668 | 645 | ||
669 | GNUNET_assert (0 != proc); | 646 | GNUNET_assert (0 != proc); |
670 | ret = waitpid (GNUNET_OS_process_get_pid (proc), &status, WNOHANG); | 647 | ret = waitpid (proc->pid, &status, WNOHANG); |
671 | if (ret < 0) | 648 | if (ret < 0) |
672 | { | 649 | { |
673 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 650 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
@@ -679,7 +656,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT | |||
679 | *code = 0; | 656 | *code = 0; |
680 | return GNUNET_NO; | 657 | return GNUNET_NO; |
681 | } | 658 | } |
682 | if (GNUNET_OS_process_get_pid (proc) != ret) | 659 | if (proc->pid != ret) |
683 | { | 660 | { |
684 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 661 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
685 | return GNUNET_SYSERR; | 662 | return GNUNET_SYSERR; |
@@ -716,7 +693,7 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT | |||
716 | DWORD c, error_code, ret; | 693 | DWORD c, error_code, ret; |
717 | 694 | ||
718 | h = GNUNET_OS_process_get_handle (proc); | 695 | h = GNUNET_OS_process_get_handle (proc); |
719 | ret = GNUNET_OS_process_get_pid (proc); | 696 | ret = proc->pid; |
720 | if (h == NULL || ret == 0) | 697 | if (h == NULL || ret == 0) |
721 | { | 698 | { |
722 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", ret, h); | 699 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", ret, h); |
@@ -753,22 +730,25 @@ GNUNET_OS_process_status (GNUNET_OS_Process *proc, enum GNUNET_OS_ProcessStatusT | |||
753 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 730 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
754 | */ | 731 | */ |
755 | int | 732 | int |
756 | GNUNET_OS_process_wait (GNUNET_OS_Process *proc) | 733 | GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc) |
757 | { | 734 | { |
758 | pid_t pid = GNUNET_OS_process_get_pid (proc); | 735 | |
759 | #ifndef MINGW | 736 | #ifndef MINGW |
737 | pid_t pid = proc->pid; | ||
760 | if (pid != waitpid (pid, NULL, 0)) | 738 | if (pid != waitpid (pid, NULL, 0)) |
761 | return GNUNET_SYSERR; | 739 | return GNUNET_SYSERR; |
762 | |||
763 | return GNUNET_OK; | 740 | return GNUNET_OK; |
764 | #else | 741 | #else |
765 | HANDLE h; | 742 | HANDLE h; |
766 | int ret; | 743 | int ret; |
767 | 744 | ||
768 | h = GNUNET_OS_process_get_handle (proc); | 745 | h = proc->handle; |
769 | if (NULL == h) | 746 | if (NULL == h) |
770 | { | 747 | { |
771 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Invalid process information {%d, %08X}\n", pid, h); | 748 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
749 | "Invalid process information {%d, %08X}\n", | ||
750 | proc->pid, | ||
751 | h); | ||
772 | return GNUNET_SYSERR; | 752 | return GNUNET_SYSERR; |
773 | } | 753 | } |
774 | if (h == NULL) | 754 | if (h == NULL) |
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index bd2eb2b09..bce1c7151 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c | |||
@@ -38,7 +38,7 @@ | |||
38 | static char *test_phrase = "HELLO WORLD"; | 38 | static char *test_phrase = "HELLO WORLD"; |
39 | static int ok; | 39 | static int ok; |
40 | 40 | ||
41 | static GNUNET_OS_Process *proc; | 41 | static struct GNUNET_OS_Process *proc; |
42 | /* Pipe to write to started processes stdin (on write end) */ | 42 | /* Pipe to write to started processes stdin (on write end) */ |
43 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; | 43 | static struct GNUNET_DISK_PipeHandle *hello_pipe_stdin; |
44 | /* Pipe to read from started processes stdout (on read end) */ | 44 | /* Pipe to read from started processes stdout (on read end) */ |
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index 7321ed587..734420e84 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -360,7 +360,7 @@ check() | |||
360 | int ok = 1 + 2 + 4 + 8; | 360 | int ok = 1 + 2 + 4 + 8; |
361 | char *fn; | 361 | char *fn; |
362 | char *pfx; | 362 | char *pfx; |
363 | GNUNET_OS_Process *proc; | 363 | struct GNUNET_OS_Process *proc; |
364 | char * const argv[] = | 364 | char * const argv[] = |
365 | { "test-resolver-api", "-c", "test_resolver_api_data.conf", | 365 | { "test-resolver-api", "-c", "test_resolver_api_data.conf", |
366 | #if VERBOSE | 366 | #if VERBOSE |
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index a6f78d707..7edd3c52f 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -94,7 +94,7 @@ static unsigned char restart_hijack; | |||
94 | /** | 94 | /** |
95 | * The process id of the helper | 95 | * The process id of the helper |
96 | */ | 96 | */ |
97 | static GNUNET_OS_Process *helper_proc; | 97 | static struct GNUNET_OS_Process *helper_proc; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * a list of outgoing dns-query-packets | 100 | * a list of outgoing dns-query-packets |