diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-07-14 17:11:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-07-14 17:11:56 +0000 |
commit | c0da3f7e247cad794e427ad862024dd97461d5e7 (patch) | |
tree | 642ee6a1e588d53410030773c2811df40f63b8b6 /src/util | |
parent | cedcec295b9d28200f013662d67011c1bff180ff (diff) | |
download | gnunet-c0da3f7e247cad794e427ad862024dd97461d5e7.tar.gz gnunet-c0da3f7e247cad794e427ad862024dd97461d5e7.zip |
MAntis 1616, 0001-Temporary-fix-for-process_kill.patch
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/os_priority.c | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 4d2f98b00..acb121971 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -146,46 +146,26 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) | |||
146 | else | 146 | else |
147 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 147 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
148 | "Failed to write into control pipe , errno is %d\n", errno); | 148 | "Failed to write into control pipe , errno is %d\n", errno); |
149 | #if WINDOWS | ||
150 | res = 0; | ||
151 | TerminateProcess (proc->handle, 0); | ||
152 | #else | ||
149 | res = PLIBC_KILL (proc->pid, sig); | 153 | res = PLIBC_KILL (proc->pid, sig); |
154 | #endif | ||
150 | } | 155 | } |
151 | else | 156 | else |
152 | { | 157 | { |
153 | struct GNUNET_NETWORK_FDSet *rfds; | 158 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
154 | struct GNUNET_NETWORK_FDSet *efds; | 159 | "Wrote control code into control pipe, now waiting\n"); |
155 | 160 | WaitForSingleObject (proc->handle, 5000); | |
156 | rfds = GNUNET_NETWORK_fdset_create (); | 161 | #if WINDOWS |
157 | efds = GNUNET_NETWORK_fdset_create (); | 162 | TerminateProcess (proc->handle, 0); |
158 | 163 | #else | |
159 | GNUNET_NETWORK_fdset_handle_set (rfds, proc->control_pipe); | 164 | PLIBC_KILL (proc->pid, sig); |
160 | GNUNET_NETWORK_fdset_handle_set (efds, proc->control_pipe); | 165 | #endif |
161 | 166 | res = 0; | |
162 | read_next: | 167 | } |
163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 168 | return res; |
164 | "Wrote control code into control pipe, now waiting\n"); | ||
165 | |||
166 | ret = GNUNET_NETWORK_socket_select (rfds, NULL, efds, | ||
167 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_unit (), | ||
168 | 5000)); | ||
169 | |||
170 | if (ret < 1 || GNUNET_NETWORK_fdset_handle_isset (efds, | ||
171 | proc->control_pipe)) | ||
172 | { | ||
173 | /* Just to be sure */ | ||
174 | PLIBC_KILL (proc->pid, sig); | ||
175 | res = 0; | ||
176 | } | ||
177 | else | ||
178 | { | ||
179 | if (GNUNET_DISK_file_read (proc->control_pipe, &ret, | ||
180 | sizeof(ret)) != GNUNET_OK) | ||
181 | res = PLIBC_KILL (proc->pid, sig); | ||
182 | |||
183 | /* Child signaled shutdown is in progress */ | ||
184 | goto read_next; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | return res; | ||
189 | #else | 169 | #else |
190 | return kill (proc->pid, sig); | 170 | return kill (proc->pid, sig); |
191 | #endif | 171 | #endif |