aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/kernel/main.c')
-rw-r--r--arch/um/kernel/main.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/arch/um/kernel/main.c b/arch/um/kernel/main.c
index a17c49703f9b..e59f58152678 100644
--- a/arch/um/kernel/main.c
+++ b/arch/um/kernel/main.c
@@ -24,8 +24,6 @@
24#include "mode.h" 24#include "mode.h"
25#include "choose-mode.h" 25#include "choose-mode.h"
26#include "uml-config.h" 26#include "uml-config.h"
27#include "irq_user.h"
28#include "time_user.h"
29#include "os.h" 27#include "os.h"
30 28
31/* Set in set_stklim, which is called from main and __wrap_malloc. 29/* Set in set_stklim, which is called from main and __wrap_malloc.
@@ -71,7 +69,7 @@ static __init void do_uml_initcalls(void)
71 69
72static void last_ditch_exit(int sig) 70static void last_ditch_exit(int sig)
73{ 71{
74 CHOOSE_MODE(kmalloc_ok = 0, (void) 0); 72 kmalloc_ok = 0;
75 signal(SIGINT, SIG_DFL); 73 signal(SIGINT, SIG_DFL);
76 signal(SIGTERM, SIG_DFL); 74 signal(SIGTERM, SIG_DFL);
77 signal(SIGHUP, SIG_DFL); 75 signal(SIGHUP, SIG_DFL);
@@ -87,7 +85,7 @@ int main(int argc, char **argv, char **envp)
87{ 85{
88 char **new_argv; 86 char **new_argv;
89 sigset_t mask; 87 sigset_t mask;
90 int ret, i; 88 int ret, i, err;
91 89
92 /* Enable all signals except SIGIO - in some environments, we can 90 /* Enable all signals except SIGIO - in some environments, we can
93 * enter with some signals blocked 91 * enter with some signals blocked
@@ -160,27 +158,29 @@ int main(int argc, char **argv, char **envp)
160 */ 158 */
161 change_sig(SIGPROF, 0); 159 change_sig(SIGPROF, 0);
162 160
163 /* Reboot */ 161 /* This signal stuff used to be in the reboot case. However,
164 if(ret){ 162 * sometimes a SIGVTALRM can come in when we're halting (reproducably
165 int err; 163 * when writing out gcov information, presumably because that takes
164 * some time) and cause a segfault.
165 */
166 166
167 printf("\n"); 167 /* stop timers and set SIG*ALRM to be ignored */
168 disable_timer();
168 169
169 /* stop timers and set SIG*ALRM to be ignored */ 170 /* disable SIGIO for the fds and set SIGIO to be ignored */
170 disable_timer(); 171 err = deactivate_all_fds();
172 if(err)
173 printf("deactivate_all_fds failed, errno = %d\n", -err);
171 174
172 /* disable SIGIO for the fds and set SIGIO to be ignored */ 175 /* Let any pending signals fire now. This ensures
173 err = deactivate_all_fds(); 176 * that they won't be delivered after the exec, when
174 if(err) 177 * they are definitely not expected.
175 printf("deactivate_all_fds failed, errno = %d\n", 178 */
176 -err); 179 unblock_signals();
177
178 /* Let any pending signals fire now. This ensures
179 * that they won't be delivered after the exec, when
180 * they are definitely not expected.
181 */
182 unblock_signals();
183 180
181 /* Reboot */
182 if(ret){
183 printf("\n");
184 execvp(new_argv[0], new_argv); 184 execvp(new_argv[0], new_argv);
185 perror("Failed to exec kernel"); 185 perror("Failed to exec kernel");
186 ret = 1; 186 ret = 1;