]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/um/os-Linux/start_up.c
[PATCH] uml: fix style violations
[mv-sheeva.git] / arch / um / os-Linux / start_up.c
index 5031485040090bfc07ba71eca0a41564c0cc8b03..735d035a7f33f06408c2462a01cc572ab3511608 100644 (file)
@@ -14,7 +14,6 @@
 #include <sched.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <setjmp.h>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
@@ -55,7 +54,7 @@ static int ptrace_child(void *arg)
                perror("ptrace");
                os_kill_process(pid, 0);
        }
-       os_stop_process(pid);
+       kill(pid, SIGSTOP);
 
        /*This syscall will be intercepted by the parent. Don't call more than
         * once, please.*/
@@ -96,7 +95,7 @@ static int start_ptraced_child(void **stack_out)
                      status);
 
        *stack_out = stack;
-       return(pid);
+       return pid;
 }
 
 /* When testing for SYSEMU support, if it is one of the broken versions, we
@@ -134,6 +133,7 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
        return ret;
 }
 
+/* Changed only during early boot */
 int ptrace_faultinfo = 1;
 int ptrace_ldt = 1;
 int proc_mm = 1;
@@ -161,6 +161,7 @@ __uml_setup("mode=skas0", mode_skas0_cmd_param,
                "    specify mode=tt. Note that this was recently added - on \n"
                "    older kernels you must use simply \"skas0\".\n\n");
 
+/* Changed only during early boot */
 static int force_sysemu_disabled = 0;
 
 static int __init nosysemu_cmd_param(char *str, int* add)
@@ -181,7 +182,7 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
 static void __init check_sysemu(void)
 {
        void *stack;
-       int pid, n, status, count=0;
+       int pid, n, status, count=0;
 
        printf("Checking syscall emulation patch for ptrace...");
        sysemu_supported = 0;
@@ -416,8 +417,8 @@ static inline void check_skas3_ptrace_ldt(void)
 static inline void check_skas3_proc_mm(void)
 {
        printf("  - /proc/mm...");
-       if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
-               proc_mm = 0;
+       if (access("/proc/mm", W_OK) < 0) {
+               proc_mm = 0;
                printf("not found\n");
        }
        else {
@@ -444,16 +445,16 @@ int can_do_skas(void)
 #else
 int can_do_skas(void)
 {
-       return(0);
+       return 0;
 }
 #endif
 
 int __init parse_iomem(char *str, int *add)
 {
        struct iomem_region *new;
-       struct uml_stat buf;
+       struct stat64 buf;
        char *file, *driver;
-       int fd, err, size;
+       int fd, size;
 
        driver = str;
        file = strchr(str,',');
@@ -463,15 +464,14 @@ int __init parse_iomem(char *str, int *add)
        }
        *file = '\0';
        file++;
-       fd = os_open_file(file, of_rdwr(OPENFLAGS()), 0);
+       fd = open(file, O_RDWR, 0);
        if(fd < 0){
                os_print_error(fd, "parse_iomem - Couldn't open io file");
                goto out;
        }
 
-       err = os_stat_fd(fd, &buf);
-       if(err < 0){
-               os_print_error(err, "parse_iomem - cannot stat_fd file");
+       if(fstat64(fd, &buf) < 0){
+               perror("parse_iomem - cannot stat_fd file");
                goto out_close;
        }
 
@@ -481,7 +481,7 @@ int __init parse_iomem(char *str, int *add)
                goto out_close;
        }
 
-       size = (buf.ust_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1);
+       size = (buf.st_size + UM_KERN_PAGE_SIZE) & ~(UM_KERN_PAGE_SIZE - 1);
 
        *new = ((struct iomem_region) { .next           = iomem_regions,
                                        .driver         = driver,
@@ -492,11 +492,11 @@ int __init parse_iomem(char *str, int *add)
        iomem_regions = new;
        iomem_size += new->size + UM_KERN_PAGE_SIZE;
 
-       return(0);
+       return 0;
  out_close:
-       os_close_file(fd);
+       close(fd);
  out:
-       return(1);
+       return 1;
 }
 
 
@@ -527,6 +527,24 @@ static void openpty_cb(void *arg)
                info->err = -errno;
 }
 
+static int async_pty(int master, int slave)
+{
+       int flags;
+
+       flags = fcntl(master, F_GETFL);
+       if(flags < 0)
+               return -errno;
+
+       if((fcntl(master, F_SETFL, flags | O_NONBLOCK | O_ASYNC) < 0) ||
+          (fcntl(master, F_SETOWN, os_getpid()) < 0))
+               return -errno;
+
+       if((fcntl(slave, F_SETFL, flags | O_NONBLOCK) < 0))
+               return -errno;
+
+       return(0);
+}
+
 static void __init check_one_sigio(void (*proc)(int, int))
 {
        struct sigaction old, new;
@@ -552,7 +570,7 @@ static void __init check_one_sigio(void (*proc)(int, int))
        if (err < 0)
                panic("check_sigio : __raw failed, errno = %d\n", -err);
 
-       err = os_sigio_async(master, slave);
+       err = async_pty(master, slave);
        if(err < 0)
                panic("tty_fds : sigio_async failed, err = %d\n", -err);