]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/um/os-Linux/start_up.c
x86: add proper header for reboot_force
[linux-2.6-omap-h63xx.git] / arch / um / os-Linux / start_up.c
index 7b81f6c08a5eddda2aaab95ac4df4f5fd729f88a..997d01944f91d5c84e4778c59b1ac429c814b4bb 100644 (file)
 #include "registers.h"
 #include "skas_ptrace.h"
 
-static int ptrace_child(void)
+static void ptrace_child(void)
 {
        int ret;
        /* Calling os_getpid because some libcs cached getpid incorrectly */
        int pid = os_getpid(), ppid = getppid();
        int sc_result;
 
-       change_sig(SIGWINCH, 0);
-       if (ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {
+       if (change_sig(SIGWINCH, 0) < 0 ||
+           ptrace(PTRACE_TRACEME, 0, 0, 0) < 0) {
                perror("ptrace");
                kill(pid, SIGKILL);
        }
@@ -60,10 +60,11 @@ static int ptrace_child(void)
                 * the UML code itself.
                 */
                ret = 2;
-       _exit(ret);
+
+       exit(ret);
 }
 
-static void fatal_perror(char *str)
+static void fatal_perror(const char *str)
 {
        perror(str);
        exit(1);
@@ -74,9 +75,8 @@ static void fatal(char *fmt, ...)
        va_list list;
 
        va_start(list, fmt);
-       vprintf(fmt, list);
+       vfprintf(stderr, fmt, list);
        va_end(list);
-       fflush(stdout);
 
        exit(1);
 }
@@ -86,9 +86,8 @@ static void non_fatal(char *fmt, ...)
        va_list list;
 
        va_start(list, fmt);
-       vprintf(fmt, list);
+       vfprintf(stderr, fmt, list);
        va_end(list);
-       fflush(stdout);
 }
 
 static int start_ptraced_child(void)
@@ -341,6 +340,8 @@ static void __init check_coredump_limit(void)
 
 void __init os_early_checks(void)
 {
+       int pid;
+
        /* Print out the core dump limits early */
        check_coredump_limit();
 
@@ -350,6 +351,11 @@ void __init os_early_checks(void)
         * kernel is running.
         */
        check_tmpexec();
+
+       pid = start_ptraced_child();
+       if (init_registers(pid))
+               fatal("Failed to initialize default registers");
+       stop_ptraced_child(pid, 1, 1);
 }
 
 static int __init noprocmm_cmd_param(char *str, int* add)
@@ -411,7 +417,6 @@ static inline void check_skas3_ptrace_faultinfo(void)
                        non_fatal("found\n");
        }
 
-       init_registers(pid);
        stop_ptraced_child(pid, 1, 1);
 }
 
@@ -466,7 +471,7 @@ static inline void check_skas3_proc_mm(void)
        else non_fatal("found\n");
 }
 
-int can_do_skas(void)
+void can_do_skas(void)
 {
        non_fatal("Checking for the skas3 patch in the host:\n");
 
@@ -476,8 +481,6 @@ int can_do_skas(void)
 
        if (!proc_mm || !ptrace_faultinfo || !ptrace_ldt)
                skas_needs_stub = 1;
-
-       return 1;
 }
 
 int __init parse_iomem(char *str, int *add)
@@ -490,7 +493,7 @@ int __init parse_iomem(char *str, int *add)
        driver = str;
        file = strchr(str,',');
        if (file == NULL) {
-               printf("parse_iomem : failed to parse iomem\n");
+               fprintf(stderr, "parse_iomem : failed to parse iomem\n");
                goto out;
        }
        *file = '\0';