diff options
Diffstat (limited to 'arch/um/os-Linux/sigio.c')
-rw-r--r-- | arch/um/os-Linux/sigio.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/arch/um/os-Linux/sigio.c b/arch/um/os-Linux/sigio.c index 8d4e0c6b8c92..2c23cb261188 100644 --- a/arch/um/os-Linux/sigio.c +++ b/arch/um/os-Linux/sigio.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * exitcall. | 26 | * exitcall. |
27 | */ | 27 | */ |
28 | static int write_sigio_pid = -1; | 28 | static int write_sigio_pid = -1; |
29 | static unsigned long write_sigio_stack; | ||
29 | 30 | ||
30 | /* These arrays are initialized before the sigio thread is started, and | 31 | /* These arrays are initialized before the sigio thread is started, and |
31 | * the descriptors closed after it is killed. So, it can't see them change. | 32 | * the descriptors closed after it is killed. So, it can't see them change. |
@@ -144,8 +145,10 @@ static void update_thread(void) | |||
144 | return; | 145 | return; |
145 | fail: | 146 | fail: |
146 | /* Critical section start */ | 147 | /* Critical section start */ |
147 | if(write_sigio_pid != -1) | 148 | if (write_sigio_pid != -1) { |
148 | os_kill_process(write_sigio_pid, 1); | 149 | os_kill_process(write_sigio_pid, 1); |
150 | free_stack(write_sigio_stack, 0); | ||
151 | } | ||
149 | write_sigio_pid = -1; | 152 | write_sigio_pid = -1; |
150 | close(sigio_private[0]); | 153 | close(sigio_private[0]); |
151 | close(sigio_private[1]); | 154 | close(sigio_private[1]); |
@@ -243,7 +246,6 @@ static struct pollfd *setup_initial_poll(int fd) | |||
243 | 246 | ||
244 | static void write_sigio_workaround(void) | 247 | static void write_sigio_workaround(void) |
245 | { | 248 | { |
246 | unsigned long stack; | ||
247 | struct pollfd *p; | 249 | struct pollfd *p; |
248 | int err; | 250 | int err; |
249 | int l_write_sigio_fds[2]; | 251 | int l_write_sigio_fds[2]; |
@@ -293,7 +295,8 @@ static void write_sigio_workaround(void) | |||
293 | memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private)); | 295 | memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private)); |
294 | 296 | ||
295 | write_sigio_pid = run_helper_thread(write_sigio_thread, NULL, | 297 | write_sigio_pid = run_helper_thread(write_sigio_thread, NULL, |
296 | CLONE_FILES | CLONE_VM, &stack, 0); | 298 | CLONE_FILES | CLONE_VM, |
299 | &write_sigio_stack); | ||
297 | 300 | ||
298 | if (write_sigio_pid < 0) | 301 | if (write_sigio_pid < 0) |
299 | goto out_clear; | 302 | goto out_clear; |
@@ -356,10 +359,12 @@ out: | |||
356 | 359 | ||
357 | static void sigio_cleanup(void) | 360 | static void sigio_cleanup(void) |
358 | { | 361 | { |
359 | if(write_sigio_pid != -1){ | 362 | if (write_sigio_pid == -1) |
360 | os_kill_process(write_sigio_pid, 1); | 363 | return; |
361 | write_sigio_pid = -1; | 364 | |
362 | } | 365 | os_kill_process(write_sigio_pid, 1); |
366 | free_stack(write_sigio_stack, 0); | ||
367 | write_sigio_pid = -1; | ||
363 | } | 368 | } |
364 | 369 | ||
365 | __uml_exitcall(sigio_cleanup); | 370 | __uml_exitcall(sigio_cleanup); |