This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / arch / um / os-Linux / process.c
index ce1b5f1..f1b178c 100644 (file)
 #include <sys/wait.h>
 #include "os.h"
 #include "user.h"
-#include "user_util.h"
 
 #define ARBITRARY_ADDR -1
 #define FAILURE_PID    -1
 
-#define STAT_PATH_LEN sizeof("/proc/#######/stat\0")
-#define COMM_SCANF "%*[^)])"
-
 unsigned long os_process_pc(int pid)
 {
-       char proc_stat[STAT_PATH_LEN], buf[256];
+       char proc_stat[sizeof("/proc/#####/stat\0")], buf[256];
        unsigned long pc;
        int fd, err;
 
@@ -42,9 +38,9 @@ unsigned long os_process_pc(int pid)
        }
        os_close_file(fd);
        pc = ARBITRARY_ADDR;
-       if(sscanf(buf, "%*d " COMM_SCANF " %*c %*d %*d %*d %*d %*d %*d %*d "
+       if(sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*d %*d %*d "
                  "%*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d %*d "
-                 "%*d %*d %*d %*d %*d %lu", &pc) != 1){
+                 "%*d %*d %*d %*d %ld", &pc) != 1){
                printk("os_process_pc - couldn't find pc in '%s'\n", buf);
        }
        return(pc);
@@ -52,7 +48,7 @@ unsigned long os_process_pc(int pid)
 
 int os_process_parent(int pid)
 {
-       char stat[STAT_PATH_LEN];
+       char stat[sizeof("/proc/nnnnn/stat\0")];
        char data[256];
        int parent, n, fd;
 
@@ -74,7 +70,8 @@ int os_process_parent(int pid)
        }
 
        parent = FAILURE_PID;
-       n = sscanf(data, "%*d " COMM_SCANF " %*c %d", &parent);
+       /* XXX This will break if there is a space in the command */
+       n = sscanf(data, "%*d %*s %*c %d", &parent);
        if(n != 1) 
                printk("Failed to scan '%s'\n", data);
 
@@ -90,13 +87,14 @@ void os_kill_process(int pid, int reap_child)
 {
        kill(pid, SIGKILL);
        if(reap_child)
-               CATCH_EINTR(waitpid(pid, NULL, 0));
+               waitpid(pid, NULL, 0);
                
 }
 
 void os_usr1_process(int pid)
 {
-       kill(pid, SIGUSR1);
+       syscall(__NR_tkill, pid, SIGUSR1); 
+       /* kill(pid, SIGUSR1); */
 }
 
 int os_getpid(void)