diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
| commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
| tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/kernel/tt/ptproxy/wait.c | |
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.c | 86 |
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 000000000000..12f6319d8d76 --- /dev/null +++ b/arch/um/kernel/tt/ptproxy/wait.c | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | /********************************************************************** | ||
| 2 | wait.c | ||
| 3 | |||
| 4 | Copyright (C) 1999 Lars Brinkhoff. See the file COPYING for licensing | ||
| 5 | terms and conditions. | ||
| 6 | |||
| 7 | **********************************************************************/ | ||
| 8 | |||
| 9 | #include <errno.h> | ||
| 10 | #include <signal.h> | ||
| 11 | #include <sys/wait.h> | ||
| 12 | |||
| 13 | #include "ptproxy.h" | ||
| 14 | #include "sysdep.h" | ||
| 15 | #include "wait.h" | ||
| 16 | #include "user_util.h" | ||
| 17 | #include "ptrace_user.h" | ||
| 18 | #include "sysdep/ptrace.h" | ||
| 19 | #include "sysdep/sigcontext.h" | ||
| 20 | |||
| 21 | int proxy_wait_return(struct debugger *debugger, pid_t unused) | ||
| 22 | { | ||
| 23 | debugger->waiting = 0; | ||
| 24 | |||
| 25 | if(debugger->debugee->died || (debugger->wait_options & __WCLONE)){ | ||
| 26 | debugger_cancelled_return(debugger, -ECHILD); | ||
| 27 | return(0); | ||
| 28 | } | ||
| 29 | |||
| 30 | if(debugger->debugee->zombie && debugger->debugee->event) | ||
| 31 | debugger->debugee->died = 1; | ||
| 32 | |||
| 33 | if(debugger->debugee->event){ | ||
| 34 | debugger->debugee->event = 0; | ||
| 35 | ptrace(PTRACE_POKEDATA, debugger->pid, | ||
| 36 | debugger->wait_status_ptr, | ||
| 37 | debugger->debugee->wait_status); | ||
| 38 | /* if (wait4) | ||
| 39 | ptrace (PTRACE_POKEDATA, pid, rusage_ptr, ...); */ | ||
| 40 | debugger_cancelled_return(debugger, debugger->debugee->pid); | ||
| 41 | return(0); | ||
| 42 | } | ||
| 43 | |||
| 44 | /* pause will return -EINTR, which happens to be right for wait */ | ||
| 45 | debugger_normal_return(debugger, -1); | ||
| 46 | return(0); | ||
| 47 | } | ||
| 48 | |||
| 49 | int parent_wait_return(struct debugger *debugger, pid_t unused) | ||
| 50 | { | ||
| 51 | return(debugger_normal_return(debugger, -1)); | ||
| 52 | } | ||
| 53 | |||
| 54 | int real_wait_return(struct debugger *debugger) | ||
| 55 | { | ||
| 56 | unsigned long ip; | ||
| 57 | int pid; | ||
| 58 | |||
| 59 | pid = debugger->pid; | ||
| 60 | |||
| 61 | ip = ptrace(PTRACE_PEEKUSR, pid, PT_IP_OFFSET, 0); | ||
| 62 | IP_RESTART_SYSCALL(ip); | ||
| 63 | |||
| 64 | if(ptrace(PTRACE_POKEUSR, pid, PT_IP_OFFSET, ip) < 0) | ||
| 65 | tracer_panic("real_wait_return : Failed to restart system " | ||
| 66 | "call, errno = %d\n", errno); | ||
| 67 | |||
| 68 | if((ptrace(PTRACE_SYSCALL, debugger->pid, 0, SIGCHLD) < 0) || | ||
| 69 | (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) || | ||
| 70 | (ptrace(PTRACE_SYSCALL, debugger->pid, 0, 0) < 0) || | ||
| 71 | debugger_normal_return(debugger, -1)) | ||
| 72 | tracer_panic("real_wait_return : gdb failed to wait, " | ||
| 73 | "errno = %d\n", errno); | ||
| 74 | return(0); | ||
| 75 | } | ||
| 76 | |||
| 77 | /* | ||
| 78 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
| 79 | * Emacs will notice this stuff at the end of the file and automatically | ||
| 80 | * adjust the settings for this buffer only. This must remain at the end | ||
| 81 | * of the file. | ||
| 82 | * --------------------------------------------------------------------------- | ||
| 83 | * Local variables: | ||
| 84 | * c-file-style: "linux" | ||
| 85 | * End: | ||
| 86 | */ | ||
