Hurd: fix mode type for openat
[glibc.git] / misc / ptrace.c
bloba70f1952bc0b38870376f5a3991f35e2545fb9c8
1 /* Copyright (C) 1991, 92, 93, 95, 96, 97 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
18 #include <errno.h>
19 #include <sys/ptrace.h>
20 #include <sys/types.h>
21 #include <stdarg.h>
23 /* Perform process tracing functions. REQUEST is one of the values
24 in <sys/ptrace.h>, and determines the action to be taken.
25 For all requests except PTRACE_TRACEME, PID specifies the process to be
26 traced.
28 PID and the other arguments described above for the various requests should
29 appear (those that are used for the particular request) as:
30 pid_t PID, void *ADDR, int DATA, void *ADDR2
31 after PID. */
32 int
33 ptrace (request)
34 enum __ptrace_request request;
36 pid_t pid;
37 void *addr;
38 void *addr2;
39 int data;
40 va_list ap;
42 switch (request)
44 case PTRACE_TRACEME:
45 case PTRACE_CONT:
46 case PTRACE_KILL:
47 case PTRACE_SINGLESTEP:
48 case PTRACE_ATTACH:
49 case PTRACE_DETACH:
50 break;
52 case PTRACE_PEEKTEXT:
53 case PTRACE_PEEKDATA:
54 case PTRACE_PEEKUSER:
55 case PTRACE_GETREGS:
56 case PTRACE_SETREGS:
57 #ifdef PTRACE_GETFPREGS
58 case PTRACE_GETFPGEGS:
59 #endif
60 case PTRACE_SETFPREGS:
61 case PTRACE_GETFPAREGS:
62 case PTRACE_SETFPAREGS:
63 va_start(ap, request);
64 pid = va_arg(ap, pid_t);
65 addr = va_arg(ap, void *);
66 va_end(ap);
67 break;
69 case PTRACE_POKETEXT:
70 case PTRACE_POKEDATA:
71 case PTRACE_POKEUSER:
72 va_start(ap, request);
73 pid = va_arg(ap, pid_t);
74 addr = va_arg(ap, void *);
75 data = va_arg(ap, int);
76 va_end(ap);
77 break;
79 case PTRACE_READDATA:
80 case PTRACE_WRITEDATA:
81 case PTRACE_READTEXT:
82 case PTRACE_WRITETEXT:
83 va_start(ap, request);
84 pid = va_arg(ap, pid_t);
85 addr = va_arg(ap, void *);
86 data = va_arg(ap, int);
87 addr2 = va_arg(ap, void *);
88 va_end(ap);
89 break;
91 default:
92 __set_errno (EINVAL);
93 return -1;
96 __set_errno (ENOSYS);
97 return -1;
101 stub_warning (ptrace)
102 #include <stub-tag.h>