aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/tt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/os-Linux/tt.c')
-rw-r--r--arch/um/os-Linux/tt.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
index cb2648b79d0f..919d19f11537 100644
--- a/arch/um/os-Linux/tt.c
+++ b/arch/um/os-Linux/tt.c
@@ -27,7 +27,6 @@
27#include "sysdep/sigcontext.h" 27#include "sysdep/sigcontext.h"
28#include "irq_user.h" 28#include "irq_user.h"
29#include "ptrace_user.h" 29#include "ptrace_user.h"
30#include "time_user.h"
31#include "init.h" 30#include "init.h"
32#include "os.h" 31#include "os.h"
33#include "uml-config.h" 32#include "uml-config.h"
@@ -63,6 +62,54 @@ void kill_child_dead(int pid)
63 } while(1); 62 } while(1);
64} 63}
65 64
65void stop(void)
66{
67 while(1) sleep(1000000);
68}
69
70int wait_for_stop(int pid, int sig, int cont_type, void *relay)
71{
72 sigset_t *relay_signals = relay;
73 int status, ret;
74
75 while(1){
76 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
77 if((ret < 0) ||
78 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
79 if(ret < 0){
80 printk("wait failed, errno = %d\n",
81 errno);
82 }
83 else if(WIFEXITED(status))
84 printk("process %d exited with status %d\n",
85 pid, WEXITSTATUS(status));
86 else if(WIFSIGNALED(status))
87 printk("process %d exited with signal %d\n",
88 pid, WTERMSIG(status));
89 else if((WSTOPSIG(status) == SIGVTALRM) ||
90 (WSTOPSIG(status) == SIGALRM) ||
91 (WSTOPSIG(status) == SIGIO) ||
92 (WSTOPSIG(status) == SIGPROF) ||
93 (WSTOPSIG(status) == SIGCHLD) ||
94 (WSTOPSIG(status) == SIGWINCH) ||
95 (WSTOPSIG(status) == SIGINT)){
96 ptrace(cont_type, pid, 0, WSTOPSIG(status));
97 continue;
98 }
99 else if((relay_signals != NULL) &&
100 sigismember(relay_signals, WSTOPSIG(status))){
101 ptrace(cont_type, pid, 0, WSTOPSIG(status));
102 continue;
103 }
104 else printk("process %d stopped with signal %d\n",
105 pid, WSTOPSIG(status));
106 panic("wait_for_stop failed to wait for %d to stop "
107 "with %d\n", pid, sig);
108 }
109 return(status);
110 }
111}
112
66/* 113/*
67 *------------------------- 114 *-------------------------
68 * only for tt mode (will be deleted in future...) 115 * only for tt mode (will be deleted in future...)