blob: 9885fe37bc52c7e30cd601ae413d50185a8ffda1 [file] [log] [blame]
Elliott Hughes31c5a282014-01-07 14:58:58 -08001diff -r -u -d /home/enh/Downloads/strace-4.6/defs.h ./defs.h
2--- /home/enh/Downloads/strace-4.6/defs.h 2011-03-15 10:19:09.000000000 -0700
3+++ ./defs.h 2014-01-03 15:29:29.552592456 -0800
Elliott Hughese10a1e22013-03-21 18:08:32 -07004@@ -33,10 +33,6 @@
5 #include "config.h"
6 #endif
7
8-#ifdef MIPS
9-#include <sgidefs.h>
10-#endif
11-
12 #ifdef linux
13 #include <features.h>
14 #endif
Elliott Hughes31c5a282014-01-07 14:58:58 -080015@@ -319,13 +315,19 @@
16 # define PTRACE_GETSIGINFO 0x4202
17 # endif
18 # if !HAVE_DECL_PTRACE_O_TRACEFORK
19+# ifndef PTRACE_O_TRACEFORK
20 # define PTRACE_O_TRACEFORK 0x00000002
21+# endif
22 # endif
23 # if !HAVE_DECL_PTRACE_O_TRACEVFORK
24+# ifndef PTRACE_O_TRACEVFORK
25 # define PTRACE_O_TRACEVFORK 0x00000004
26+# endif
27 # endif
28 # if !HAVE_DECL_PTRACE_O_TRACECLONE
29+# ifndef PTRACE_O_TRACECLONE
30 # define PTRACE_O_TRACECLONE 0x00000008
31+# endif
32 # endif
33
34 # if !HAVE_DECL_PTRACE_EVENT_FORK
35diff -r -u -d /home/enh/Downloads/strace-4.6/file.c ./file.c
36--- /home/enh/Downloads/strace-4.6/file.c 2011-03-03 18:08:02.000000000 -0800
37+++ ./file.c 2014-01-03 15:29:29.552592456 -0800
38@@ -45,6 +45,21 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -080039 # define kernel_dirent dirent
40 #endif
41
42+#ifdef HAVE_ANDROID_OS
43+#include <linux/fadvise.h>
44+
45+// ANDROID: From linux/dirent.h
46+
47+struct dirent64 {
48+ __u64 d_ino;
49+ __s64 d_off;
50+ unsigned short d_reclen;
51+ unsigned char d_type;
52+ char d_name[256];
53+};
54+
Jeff Brownf76f96e2012-03-02 16:23:23 -080055+#endif /* HAVE_ANDROID_OS */
56+
57 #ifdef LINUX
58 # ifdef LINUXSPARC
59 struct stat {
Elliott Hughes31c5a282014-01-07 14:58:58 -080060diff -r -u -d /home/enh/Downloads/strace-4.6/ioctl.c ./ioctl.c
61--- /home/enh/Downloads/strace-4.6/ioctl.c 2011-01-15 12:15:31.000000000 -0800
62+++ ./ioctl.c 2014-01-03 15:29:29.552592456 -0800
Jeff Brownf76f96e2012-03-02 16:23:23 -080063@@ -155,9 +155,11 @@
64 case 0x03:
65 case 0x12:
66 return block_ioctl(tcp, code, arg);
67+#ifndef HAVE_ANDROID_OS
68 case 0x22:
69 return scsi_ioctl(tcp, code, arg);
70 #endif
71+#endif
72 default:
73 break;
74 }
Elliott Hughes31c5a282014-01-07 14:58:58 -080075diff -r -u -d /home/enh/Downloads/strace-4.6/ipc.c ./ipc.c
76--- /home/enh/Downloads/strace-4.6/ipc.c 2010-03-31 15:22:01.000000000 -0700
77+++ ./ipc.c 2014-01-03 15:29:29.552592456 -0800
Jeff Brownf76f96e2012-03-02 16:23:23 -080078@@ -40,9 +40,15 @@
79
80 #include <fcntl.h>
81 #include <sys/ipc.h>
82+#ifdef HAVE_ANDROID_OS
83+#include <linux/sem.h>
84+#include <linux/msg.h>
85+#include <linux/shm.h>
86+#else
87 #include <sys/sem.h>
88 #include <sys/msg.h>
89 #include <sys/shm.h>
90+#endif
91
92 #ifndef MSG_STAT
93 #define MSG_STAT 11
Elliott Hughes31c5a282014-01-07 14:58:58 -080094diff -r -u -d /home/enh/Downloads/strace-4.6/process.c ./process.c
95--- /home/enh/Downloads/strace-4.6/process.c 2011-03-14 14:58:59.000000000 -0700
96+++ ./process.c 2014-01-03 15:29:29.552592456 -0800
97@@ -114,6 +114,10 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -080098 #define GETGROUPS32_T __kernel_gid32_t
99 #endif /* LINUX */
100
101+#ifdef HAVE_ANDROID_OS
102+#define __sched_priority sched_priority
103+#endif
104+
105 #if defined(LINUX) && defined(IA64)
106 # include <asm/ptrace_offsets.h>
107 # include <asm/rse.h>
Elliott Hughes31c5a282014-01-07 14:58:58 -0800108diff -r -u -d /home/enh/Downloads/strace-4.6/signal.c ./signal.c
109--- /home/enh/Downloads/strace-4.6/signal.c 2011-03-10 15:14:47.000000000 -0800
110+++ ./signal.c 2014-01-07 14:53:10.703113250 -0800
111@@ -40,6 +40,12 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -0800112 #include <sys/user.h>
Jeff Brownf76f96e2012-03-02 16:23:23 -0800113 #include <fcntl.h>
114
115+#ifdef HAVE_ANDROID_OS
116+//FIXME use "sigprocmask" or something
117+#define sigmask(sig) (1UL << ((sig) - 1))
118+#define sigcontext_struct sigcontext
119+#endif
120+
121 #ifdef SVR4
122 #include <sys/ucontext.h>
123 #endif /* SVR4 */
Elliott Hughes31c5a282014-01-07 14:58:58 -0800124@@ -455,7 +461,7 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -0800125
126 #endif /* LINUX */
127
128-#if __GLIBC_MINOR__ < 1
129+#if __GLIBC_MINOR__ < 1 && !defined(HAVE_ANDROID_OS)
130 /* Type for data associated with a signal. */
131 typedef union sigval
132 {
Elliott Hughes31c5a282014-01-07 14:58:58 -0800133@@ -1091,7 +1097,12 @@
134
135 #ifdef HAVE_SIGACTION
136
137-#ifdef LINUX
138+/* For MIPS, struct sigaction is common between kernel and userland */
139+#if defined(LINUX) && !defined(MIPS)
140+#define USE_OLD_SIGACTION
141+#endif
142+
143+#ifdef USE_OLD_SIGACTION
144 struct old_sigaction {
145 __sighandler_t __sa_handler;
146 unsigned long sa_mask;
147@@ -1099,7 +1110,7 @@
148 void (*sa_restorer)(void);
149 };
150 #define SA_HANDLER __sa_handler
151-#endif /* LINUX */
152+#endif /* USE_OLD_SIGACTION */
153
154 #ifndef SA_HANDLER
155 #define SA_HANDLER sa_handler
156@@ -1110,7 +1121,7 @@
157 struct tcb *tcp;
158 {
159 long addr;
160-#ifdef LINUX
161+#ifdef USE_OLD_SIGACTION
162 sigset_t sigset;
163 struct old_sigaction sa;
164 #else
165@@ -1159,28 +1170,24 @@
166 kill(tcp->pid, SIGSTOP);
167 }
168 #endif /* !USE_PROCFS */
169- tprintf("{%#lx, ", (long) sa.SA_HANDLER);
170-#ifndef LINUX
171- printsigmask (&sa.sa_mask, 0);
172+ tprintf("{%p, ", sa.SA_HANDLER);
173+ }
174+#ifndef USE_OLD_SIGACTION
175+ printsigmask (&sa.sa_mask, 0);
176 #else
177- long_to_sigset(sa.sa_mask, &sigset);
178- printsigmask(&sigset, 0);
179+ long_to_sigset(sa.sa_mask, &sigset);
180+ printsigmask(&sigset, 0);
181 #endif
182- tprintf(", ");
183- printflags(sigact_flags, sa.sa_flags, "SA_???");
184-#ifdef SA_RESTORER
185- if (sa.sa_flags & SA_RESTORER)
186- tprintf(", %p", sa.sa_restorer);
187+ tprintf(", ");
188+ printflags(sigact_flags, sa.sa_flags, "SA_???");
189+#if defined(SA_RESTORER) && !defined(MIPS)
190+ if (sa.sa_flags & SA_RESTORER)
191+ tprintf(", %p", sa.sa_restorer);
192 #endif
193- tprintf("}");
194- }
195+ tprintf("}");
196 }
197 if (entering(tcp))
198 tprintf(", ");
199-#ifdef LINUX
200- else
201- tprintf(", %#lx", (unsigned long) sa.sa_restorer);
202-#endif
203 return 0;
204 }
205
206@@ -1492,6 +1499,7 @@
Elliott Hughese10a1e22013-03-21 18:08:32 -0700207 tcp->u_arg[0] = 0;
208 sp = regs.regs[29];
209 if (umove(tcp, sp, &si) < 0)
210+ return 0;
211 tcp->u_arg[0] = 1;
212 tcp->u_arg[1] = si.si_mask;
213 } else {
Elliott Hughes31c5a282014-01-07 14:58:58 -0800214@@ -1934,9 +1942,13 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -0800215
Elliott Hughes31c5a282014-01-07 14:58:58 -0800216
217 /* Structure describing the action to be taken when a signal arrives. */
218+#ifdef MIPS
219+#define new_sigaction sigaction
220+#define new_sigaction2 sigaction
221+#else
222 struct new_sigaction
223 {
224- __sighandler_t __sa_handler;
225+ __sighandler_t SA_HANDLER;
226 unsigned long sa_flags;
227 void (*sa_restorer) (void);
228 /* Kernel treats sa_mask as an array of longs. */
229@@ -1945,12 +1957,12 @@
230 /* Same for i386-on-x86_64 and similar cases */
231 struct new_sigaction32
232 {
233- uint32_t __sa_handler;
234+ uint32_t SA_HANDLER;
235 uint32_t sa_flags;
236 uint32_t sa_restorer;
237 uint32_t sa_mask[2 * (NSIG / sizeof(long) ? NSIG / sizeof(long) : 1)];
238 };
239-
240+#endif
241
242 int
243 sys_rt_sigaction(struct tcb *tcp)
244@@ -1983,9 +1995,11 @@
245 r = umove(tcp, addr, &sa32);
246 if (r >= 0) {
247 memset(&sa, 0, sizeof(sa));
248- sa.__sa_handler = (void*)(unsigned long)sa32.__sa_handler;
249+ sa.SA_HANDLER = (void*)(unsigned long)sa32.SA_HANDLER;
250 sa.sa_flags = sa32.sa_flags;
251+#ifndef MIPS
252 sa.sa_restorer = (void*)(unsigned long)sa32.sa_restorer;
253+#endif
254 /* Kernel treats sa_mask as an array of longs.
255 * For 32-bit process, "long" is uint32_t, thus, for example,
256 * 32th bit in sa_mask will end up as bit 0 in sa_mask[1].
257@@ -2013,14 +2027,14 @@
258 * be manipulated by strace. In order to prevent the
259 * compiler from generating code to manipulate
260 * SA_HANDLER we cast the function pointers to long. */
261- if ((long)sa.__sa_handler == (long)SIG_ERR)
262+ if ((long)sa.SA_HANDLER == (long)SIG_ERR)
263 tprintf("{SIG_ERR, ");
264- else if ((long)sa.__sa_handler == (long)SIG_DFL)
265+ else if ((long)sa.SA_HANDLER == (long)SIG_DFL)
266 tprintf("{SIG_DFL, ");
267- else if ((long)sa.__sa_handler == (long)SIG_IGN)
268+ else if ((long)sa.SA_HANDLER == (long)SIG_IGN)
269 tprintf("{SIG_IGN, ");
270 else
271- tprintf("{%#lx, ", (long) sa.__sa_handler);
272+ tprintf("{%#lx, ", (long) sa.SA_HANDLER);
273 /* Questionable code below.
274 * Kernel won't handle sys_rt_sigaction
275 * with wrong sigset size (just returns EINVAL)
276@@ -2039,7 +2053,7 @@
277 printsigmask(&sigset, 1);
278 tprintf(", ");
279 printflags(sigact_flags, sa.sa_flags, "SA_???");
280-#ifdef SA_RESTORER
281+#if defined(SA_RESTORER) && !defined(MIPS)
282 if (sa.sa_flags & SA_RESTORER)
283 tprintf(", %p", sa.sa_restorer);
284 #endif
285diff -r -u -d /home/enh/Downloads/strace-4.6/syscall.c ./syscall.c
286--- /home/enh/Downloads/strace-4.6/syscall.c 2011-02-18 16:02:27.000000000 -0800
287+++ ./syscall.c 2014-01-07 14:53:32.312851042 -0800
288@@ -2600,6 +2600,7 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -0800289 }
290
291 switch (known_scno(tcp)) {
292+#ifndef __ARM_EABI__
293 #ifdef SYS_socket_subcall
294 case SYS_socketcall:
295 decode_subcall(tcp, SYS_socket_subcall,
Elliott Hughes31c5a282014-01-07 14:58:58 -0800296@@ -2612,6 +2613,7 @@
Jeff Brownf76f96e2012-03-02 16:23:23 -0800297 SYS_ipc_nsubcalls, shift_style);
298 break;
299 #endif
300+#endif
301 #ifdef SVR4
302 #ifdef SYS_pgrpsys_subcall
303 case SYS_pgrpsys:
Elliott Hughes31c5a282014-01-07 14:58:58 -0800304diff -r -u -d /home/enh/Downloads/strace-4.6/system.c ./system.c
305--- /home/enh/Downloads/strace-4.6/system.c 2011-02-22 02:22:13.000000000 -0800
306+++ ./system.c 2014-01-03 15:29:29.552592456 -0800
Jeff Brownf76f96e2012-03-02 16:23:23 -0800307@@ -32,6 +32,11 @@
308
309 #include "defs.h"
310
311+#ifdef HAVE_ANDROID_OS
312+#undef __unused
313+#include <linux/socket.h>
314+#endif
315+
316 #ifdef LINUX
317 #define _LINUX_SOCKET_H
318 #define _LINUX_FS_H
Elliott Hughese10a1e22013-03-21 18:08:32 -0700319@@ -83,7 +88,7 @@
320 #include <linux/utsname.h>
321 #endif
322
323-#ifdef HAVE_ASM_SYSMIPS_H
324+#ifdef MIPS
325 #include <asm/sysmips.h>
326 #endif
327
Elliott Hughes31c5a282014-01-07 14:58:58 -0800328diff -r -u -d /home/enh/Downloads/strace-4.6/time.c ./time.c
329--- /home/enh/Downloads/strace-4.6/time.c 2011-03-03 18:08:02.000000000 -0800
330+++ ./time.c 2014-01-03 15:29:29.552592456 -0800
Jeff Brownf76f96e2012-03-02 16:23:23 -0800331@@ -33,7 +33,11 @@
332
333 #ifdef LINUX
334 #include <linux/version.h>
335+#ifdef HAVE_ANDROID_OS
336+#include <linux/timex.h>
337+#else
338 #include <sys/timex.h>
339+#endif
340 #include <linux/ioctl.h>
341 #include <linux/rtc.h>
342