summaryrefslogtreecommitdiffstats
path: root/arch/um/kernel/tt/ptproxy/wait.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/tt/ptproxy/wait.c
downloadop-kernel-dev-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.zip
op-kernel-dev-1da177e4c3f41524e886b7f1b8a0c1fc7321cac2.tar.gz
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/kernel/tt/ptproxy/wait.c')
-rw-r--r--arch/um/kernel/tt/ptproxy/wait.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/arch/um/kernel/tt/ptproxy/wait.c b/arch/um/kernel/tt/ptproxy/wait.c
new file mode 100644
index 0000000..12f6319
--- /dev/null
+++ b/arch/um/kernel/tt/ptproxy/wait.c
@@ -0,0 +1,86 @@
+/**********************************************************************
+wait.c
+
+Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing
+terms and conditions.
+
+**********************************************************************/
+
+#include <errno.h>
+#include <signal.h>
+#include <sys/wait.h>
+
+#include "ptproxy.h"
+#include "sysdep.h"
+#include "wait.h"
+#include "user_util.h"
+#include "ptrace_user.h"
+#include "sysdep/ptrace.h"
+#include "sysdep/sigcontext.h"
+
+int proxy_wait_return(struct debugger *debugger, pid_t unused)
+{
+ debugger->waiting = 0;
+
+ if(debugger->debugee->died || (debugger->wait_options & __WCLONE)){
+ debugger_cancelled_return(debugger, -ECHILD);
+ return(0);
+ }
+
+ if(debugger->debugee->zombie && debugger->debugee->event)
+ debugger->debugee->died = 1;
+
+ if(debugger->debugee->event){
+ debugger->debugee->event = 0;
+ ptrace(PTRACE_POKEDATA, debugger->pid,
+ debugger->wait_status_ptr,
+ debugger->debugee->wait_status);
+ /* if (wait4)
+ ptrace (PTRACE_POKEDATA, pid, rusage_ptr, ...); */
+ debugger_cancelled_return(debugger, debugger->debugee->pid);
+ return(0);
+ }
+
+ /* pause will return -EINTR, which happens to be right for wait */
+ debugger_normal_return(debugger, -1);
+ return(0);
+}
+
+int parent_wait_return(struct debugger *debugger, pid_t unused)
+{
+ return(debugger_normal_return(debugger, -1));
+}
+
+int real_wait_return(struct debugger *debugger)
+{
+ unsigned long ip;
+ int pid;
+
+ pid = debugger->pid;
+
+ ip = ptrace(PTRACE_PEEKUSR, pid, PT_IP_OFFSET, 0);
+ IP_RESTART_SYSCALL(ip);
+
+ if(ptrace(PTRACE_POKEUSR, pid, PT_IP_OFFSET, ip) < 0)
+ tracer_panic("real_wait_return : Failed to restart system "
+ "call, errno = %d\n", errno);
+
+ if((ptrace(PTRACE_SYSCALL, debugger->pid, 0, SIGCHLD) < 0) ||
+ (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) ||
+ (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) ||
+ debugger_normal_return(debugger, -1))
+ tracer_panic("real_wait_return : gdb failed to wait, "
+ "errno = %d\n", errno);
+ return(0);
+}
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
OpenPOWER on IntegriCloud