strace: fix compile with musl
[openwrt/staging/mkresin.git] / package / devel / strace / patches / 100-musl_fix.patch
1 --- a/net.c
2 +++ b/net.c
3 @@ -50,11 +50,7 @@
4 #include <arpa/inet.h>
5 #include <net/if.h>
6 #include <asm/types.h>
7 -#if defined(__GLIBC__)
8 -# include <netipx/ipx.h>
9 -#else
10 -# include <linux/ipx.h>
11 -#endif
12 +#include <linux/ipx.h>
13
14 #if defined(__GLIBC__) && defined(HAVE_SIN6_SCOPE_ID_LINUX)
15 # if defined(HAVE_LINUX_IN6_H)
16 @@ -94,14 +90,6 @@
17 # define PF_UNSPEC AF_UNSPEC
18 #endif
19
20 -/* Under Linux these are enums so we can't test for them with ifdef. */
21 -#define IPPROTO_EGP IPPROTO_EGP
22 -#define IPPROTO_PUP IPPROTO_PUP
23 -#define IPPROTO_IDP IPPROTO_IDP
24 -#define IPPROTO_IGMP IPPROTO_IGMP
25 -#define IPPROTO_RAW IPPROTO_RAW
26 -#define IPPROTO_MAX IPPROTO_MAX
27 -
28 static const struct xlat domains[] = {
29 #ifdef PF_UNSPEC
30 { PF_UNSPEC, "PF_UNSPEC" },
31 @@ -493,24 +481,16 @@ static const struct xlat protocols[] = {
32 { IPPROTO_ICMP, "IPPROTO_ICMP" },
33 { IPPROTO_TCP, "IPPROTO_TCP" },
34 { IPPROTO_UDP, "IPPROTO_UDP" },
35 -#ifdef IPPROTO_IGMP
36 { IPPROTO_IGMP, "IPPROTO_IGMP" },
37 -#endif
38 #ifdef IPPROTO_GGP
39 { IPPROTO_GGP, "IPPROTO_GGP" },
40 #endif
41 #ifdef IPPROTO_IPIP
42 { IPPROTO_IPIP, "IPPROTO_IPIP" },
43 #endif
44 -#ifdef IPPROTO_EGP
45 { IPPROTO_EGP, "IPPROTO_EGP" },
46 -#endif
47 -#ifdef IPPROTO_PUP
48 { IPPROTO_PUP, "IPPROTO_PUP" },
49 -#endif
50 -#ifdef IPPROTO_IDP
51 { IPPROTO_IDP, "IPPROTO_IDP" },
52 -#endif
53 #ifdef IPPROTO_TP
54 { IPPROTO_TP, "IPPROTO_TP" },
55 #endif
56 @@ -571,12 +551,8 @@ static const struct xlat protocols[] = {
57 #ifdef IPPROTO_UDPLITE
58 { IPPROTO_UDPLITE, "IPPROTO_UDPLITE" },
59 #endif
60 -#ifdef IPPROTO_RAW
61 { IPPROTO_RAW, "IPPROTO_RAW" },
62 -#endif
63 -#ifdef IPPROTO_MAX
64 { IPPROTO_MAX, "IPPROTO_MAX" },
65 -#endif
66 { 0, NULL },
67 };
68 static const struct xlat msg_flags[] = {
69 --- a/process.c
70 +++ b/process.c
71 @@ -55,19 +55,6 @@
72 # endif
73 #endif
74
75 -#ifdef HAVE_LINUX_PTRACE_H
76 -# undef PTRACE_SYSCALL
77 -# ifdef HAVE_STRUCT_IA64_FPREG
78 -# define ia64_fpreg XXX_ia64_fpreg
79 -# endif
80 -# ifdef HAVE_STRUCT_PT_ALL_USER_REGS
81 -# define pt_all_user_regs XXX_pt_all_user_regs
82 -# endif
83 -# include <linux/ptrace.h>
84 -# undef ia64_fpreg
85 -# undef pt_all_user_regs
86 -#endif
87 -
88 #if defined(SPARC64)
89 # define r_pc r_tpc
90 # undef PTRACE_GETREGS
91 @@ -2857,7 +2844,7 @@ sys_sched_setscheduler(struct tcb *tcp)
92 if (umove(tcp, tcp->u_arg[2], &p) < 0)
93 tprintf(", %#lx", tcp->u_arg[2]);
94 else
95 - tprintf(", { %d }", p.__sched_priority);
96 + tprintf(", { %d }", p.sched_priority);
97 }
98 return 0;
99 }
100 @@ -2872,7 +2859,7 @@ sys_sched_getparam(struct tcb *tcp)
101 if (umove(tcp, tcp->u_arg[1], &p) < 0)
102 tprintf("%#lx", tcp->u_arg[1]);
103 else
104 - tprintf("{ %d }", p.__sched_priority);
105 + tprintf("{ %d }", p.sched_priority);
106 }
107 return 0;
108 }
109 @@ -2885,7 +2872,7 @@ sys_sched_setparam(struct tcb *tcp)
110 if (umove(tcp, tcp->u_arg[1], &p) < 0)
111 tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
112 else
113 - tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority);
114 + tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority);
115 }
116 return 0;
117 }
118 --- a/signal.c
119 +++ b/signal.c
120 @@ -35,6 +35,7 @@
121 #include <sys/user.h>
122 #include <fcntl.h>
123
124 +#include <asm/ptrace.h>
125 #ifdef HAVE_SYS_REG_H
126 # include <sys/reg.h>
127 # ifndef PTRACE_PEEKUSR
128 --- a/time.c
129 +++ b/time.c
130 @@ -774,7 +774,7 @@ printsigevent(struct tcb *tcp, long arg)
131 /* _pad[0] is the _tid field which might not be
132 present in the userlevel definition of the
133 struct. */
134 - tprintf("{%d}", sev._sigev_un._pad[0]);
135 + tprintf("{%d}", *(int *) &sev.sigev_notify_function);
136 else if (sev.sigev_notify == SIGEV_THREAD)
137 tprintf("{%p, %p}", sev.sigev_notify_function,
138 sev.sigev_notify_attributes);
139 --- a/defs.h
140 +++ b/defs.h
141 @@ -27,6 +27,7 @@
142 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
143 */
144
145 +#define _LARGEFILE64_SOURCE 1
146 #ifdef HAVE_CONFIG_H
147 # include "config.h"
148 #endif
149 @@ -222,7 +223,7 @@ extern long ptrace(int, int, char *, lon
150 # define PTRACE_EVENT_EXIT 6
151 #endif
152
153 -#if !defined(__GLIBC__)
154 +#if !defined(__GLIBC__) && !defined(PTRACE_PEEKUSER)
155 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
156 # define PTRACE_POKEUSER PTRACE_POKEUSR
157 #endif