Mark __libc_resp with attribute_tls_model_ie for consistency with __resp
[glibc/nacl-glibc.git] / misc / ptrace.c
blob1825d571439c4e44fbb47543bf6ccc136a4319b8
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, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #include <errno.h>
20 #include <sys/ptrace.h>
21 #include <sys/types.h>
22 #include <stdarg.h>
24 /* Perform process tracing functions. REQUEST is one of the values
25 in <sys/ptrace.h>, and determines the action to be taken.
26 For all requests except PTRACE_TRACEME, PID specifies the process to be
27 traced.
29 PID and the other arguments described above for the various requests should
30 appear (those that are used for the particular request) as:
31 pid_t PID, void *ADDR, int DATA, void *ADDR2
32 after PID. */
33 int
34 ptrace (request)
35 enum __ptrace_request request;
37 pid_t pid;
38 void *addr;
39 void *addr2;
40 int data;
41 va_list ap;
43 switch (request)
45 case PTRACE_TRACEME:
46 case PTRACE_CONT:
47 case PTRACE_KILL:
48 case PTRACE_SINGLESTEP:
49 case PTRACE_ATTACH:
50 case PTRACE_DETACH:
51 break;
53 case PTRACE_PEEKTEXT:
54 case PTRACE_PEEKDATA:
55 case PTRACE_PEEKUSER:
56 case PTRACE_GETREGS:
57 case PTRACE_SETREGS:
58 #ifdef PTRACE_GETFPREGS
59 case PTRACE_GETFPGEGS:
60 #endif
61 case PTRACE_SETFPREGS:
62 case PTRACE_GETFPAREGS:
63 case PTRACE_SETFPAREGS:
64 va_start(ap, request);
65 pid = va_arg(ap, pid_t);
66 addr = va_arg(ap, void *);
67 va_end(ap);
68 break;
70 case PTRACE_POKETEXT:
71 case PTRACE_POKEDATA:
72 case PTRACE_POKEUSER:
73 va_start(ap, request);
74 pid = va_arg(ap, pid_t);
75 addr = va_arg(ap, void *);
76 data = va_arg(ap, int);
77 va_end(ap);
78 break;
80 case PTRACE_READDATA:
81 case PTRACE_WRITEDATA:
82 case PTRACE_READTEXT:
83 case PTRACE_WRITETEXT:
84 va_start(ap, request);
85 pid = va_arg(ap, pid_t);
86 addr = va_arg(ap, void *);
87 data = va_arg(ap, int);
88 addr2 = va_arg(ap, void *);
89 va_end(ap);
90 break;
92 default:
93 __set_errno (EINVAL);
94 return -1;
97 __set_errno (ENOSYS);
98 return -1;
102 stub_warning (ptrace)
103 #include <stub-tag.h>