diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-05-09 09:45:53 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-05-09 09:45:53 +0000 |
commit | efad1d6733cd7e75a4e6c846ad7c031a0167b8be (patch) | |
tree | 93c8d652b78ae04b5b4a5c8e1e8abe398d4dd8c7 /src/include/gnunet_helper_lib.h | |
parent | d96c9d244148f2ee984c206b71987ba6df0ec820 (diff) | |
download | gnunet-efad1d6733cd7e75a4e6c846ad7c031a0167b8be.tar.gz gnunet-efad1d6733cd7e75a4e6c846ad7c031a0167b8be.zip |
- complement HELPER API with functions to kill and wait on the helper process
- To shutdown quickly, have testbed first kill all sub-controller's helper
processes first and wait later instead of kill & wait per each processes.
Diffstat (limited to 'src/include/gnunet_helper_lib.h')
-rw-r--r-- | src/include/gnunet_helper_lib.h | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h index 191d97b80..06d65b360 100644 --- a/src/include/gnunet_helper_lib.h +++ b/src/include/gnunet_helper_lib.h | |||
@@ -20,7 +20,8 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_helper_lib.h | 22 | * @file include/gnunet_helper_lib.h |
23 | * @brief API for dealing with (SUID) helper processes that communicate via GNUNET_MessageHeaders on stdin/stdout | 23 | * @brief API for dealing with (SUID) helper processes that communicate via |
24 | * GNUNET_MessageHeaders on stdin/stdout | ||
24 | * @author Philipp Toelke | 25 | * @author Philipp Toelke |
25 | * @author Christian Grothoff | 26 | * @author Christian Grothoff |
26 | */ | 27 | */ |
@@ -72,22 +73,49 @@ GNUNET_HELPER_start (int with_control_pipe, | |||
72 | 73 | ||
73 | 74 | ||
74 | /** | 75 | /** |
75 | * Kills the helper, closes the pipe and frees the handle | 76 | * Sends termination signal to the helper process. The helper process is not |
77 | * reaped; call GNUNET_HELPER_wait() for reaping the dead helper process. | ||
76 | * | 78 | * |
77 | * @param h handle to helper to stop | 79 | * @param h the helper handle |
80 | * @param soft_kill if GNUNET_YES, signals termination by closing the helper's | ||
81 | * stdin; GNUNET_NO to signal termination by sending SIGTERM to helper | ||
82 | * @return GNUNET_OK on success; GNUNET_SYSERR on error | ||
83 | */ | ||
84 | int | ||
85 | GNUNET_HELPER_kill (struct GNUNET_HELPER_Handle *h, int soft_kill); | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Reap the helper process. This call is blocking(!). The helper process | ||
90 | * should either be sent a termination signal before or should be dead before | ||
91 | * calling this function | ||
92 | * | ||
93 | * @param h the helper handle | ||
94 | * @return GNUNET_OK on success; GNUNET_SYSERR on error | ||
95 | */ | ||
96 | int | ||
97 | GNUNET_HELPER_wait (struct GNUNET_HELPER_Handle *h); | ||
98 | |||
99 | |||
100 | /** | ||
101 | * Free's the resources occupied by the helper handle | ||
102 | * | ||
103 | * @param h the helper handle to free | ||
78 | */ | 104 | */ |
79 | void | 105 | void |
80 | GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h); | 106 | GNUNET_HELPER_destroy (struct GNUNET_HELPER_Handle *h); |
81 | 107 | ||
82 | 108 | ||
83 | /** | 109 | /** |
84 | * Kills the helper by closing its stdin (the helper is expected to catch the | 110 | * Kills the helper, closes the pipe, frees the handle and calls wait() on the |
85 | * resulting SIGPIPE and shutdown), closes the pipe and frees the handle | 111 | * helper process |
86 | * | 112 | * |
87 | * @param h handle to helper to stop | 113 | * @param h handle to helper to stop |
114 | * @param soft_kill if GNUNET_YES, signals termination by closing the helper's | ||
115 | * stdin; GNUNET_NO to signal termination by sending SIGTERM to helper | ||
88 | */ | 116 | */ |
89 | void | 117 | void |
90 | GNUNET_HELPER_soft_stop (struct GNUNET_HELPER_Handle *h); | 118 | GNUNET_HELPER_stop (struct GNUNET_HELPER_Handle *h, int soft_kill); |
91 | 119 | ||
92 | 120 | ||
93 | /** | 121 | /** |