aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/psmisc/psmisc/0001-Use-UINTPTR_MAX-instead-of-__WORDSIZE.patch
blob: b57a006bc67111c7cf54f0e80bf37c9f97a42893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 5dc872bb2fba6421cb8e1ee578f7bd4aaed55f61 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 24 Mar 2016 15:46:14 +0000
Subject: [PATCH] Use UINTPTR_MAX instead of __WORDSIZE

Do not include sys/user.h since it conflicts with
pt_regs struct from kernel APIs in asm/ptrace.h

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending

 src/peekfd.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/peekfd.c b/src/peekfd.c
index cba2130..0d39878 100644
--- a/src/peekfd.c
+++ b/src/peekfd.c
@@ -30,8 +30,11 @@
 #include <asm/ptrace.h>
 #include <byteswap.h>
 #include <endian.h>
+#ifdef __GLIBC__
 #include <sys/user.h>
+#endif
 #include <stdlib.h>
+#include <stdint.h>
 #include <getopt.h>
 #include <ctype.h>
 
@@ -228,11 +231,11 @@ int main(int argc, char **argv)
 		if (WIFSTOPPED(status)) {
 #ifdef PPC
 			struct pt_regs regs;
-			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R0, 0);
-			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R3, 0);
-			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R4, 0);
-			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_R5, 0);
-			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, __WORDSIZE/8 * PT_ORIG_R3, 0);
+			regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R0, 0);
+			regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R3, 0);
+			regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R4, 0);
+			regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_R5, 0);
+			regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, UINTPTR_MAX/8 * PT_ORIG_R3, 0);
 #elif defined(ARM)
 			struct pt_regs regs;
 			ptrace(PTRACE_GETREGS, pid, 0, &regs);
-- 
1.9.1