modules: more wpan fixes
[openwrt/svn-archive/archive.git] / package / libs / librpc / patches / 110-musl_fixes.patch
1 --- a/rpc/types.h
2 +++ b/rpc/types.h
3 @@ -79,22 +79,6 @@ typedef unsigned long rpcport_t;
4 #include <sys/types.h>
5 #endif
6
7 -#ifndef __u_char_defined
8 -typedef __u_char u_char;
9 -typedef __u_short u_short;
10 -typedef __u_int u_int;
11 -typedef __u_long u_long;
12 -typedef __quad_t quad_t;
13 -typedef __u_quad_t u_quad_t;
14 -typedef __fsid_t fsid_t;
15 -# define __u_char_defined
16 -#endif
17 -#ifndef __daddr_t_defined
18 -typedef __daddr_t daddr_t;
19 -typedef __caddr_t caddr_t;
20 -# define __daddr_t_defined
21 -#endif
22 -
23 #include <sys/time.h>
24 #include <sys/param.h>
25
26 --- a/bindresvport.c
27 +++ b/bindresvport.c
28 @@ -39,6 +39,7 @@
29 #include <sys/types.h>
30 #include <sys/socket.h>
31 #include <netinet/in.h>
32 +#include <netdb.h>
33
34
35 /*
36 --- a/rpc/netdb.h
37 +++ b/rpc/netdb.h
38 @@ -37,12 +37,17 @@
39 #define _RPC_NETDB_H 1
40
41 #include <features.h>
42 +#include <netdb.h>
43
44 #define __need_size_t
45 #include <stddef.h>
46
47 #include "types.h"
48
49 +#ifndef NETDB_INTERNAL
50 +#define NETDB_INTERNAL -1
51 +#endif
52 +
53 __BEGIN_DECLS
54
55 struct rpcent
56 --- a/create_xid.c
57 +++ b/create_xid.c
58 @@ -31,7 +31,6 @@
59 __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER);
60
61 static smallint is_initialized;
62 -static struct drand48_data __rpc_lrand48_data;
63
64 u_long _create_xid (void) attribute_hidden;
65 u_long _create_xid (void)
66 @@ -45,11 +44,11 @@ u_long _create_xid (void)
67 struct timeval now;
68
69 gettimeofday (&now, (struct timezone *) 0);
70 - srand48_r (now.tv_sec ^ now.tv_usec, &__rpc_lrand48_data);
71 + srand48 (now.tv_sec ^ now.tv_usec);
72 is_initialized = 1;
73 }
74
75 - lrand48_r (&__rpc_lrand48_data, &res);
76 + res = lrand48();
77
78 __UCLIBC_MUTEX_UNLOCK(mylock);
79
80 --- a/clnt_tcp.c
81 +++ b/clnt_tcp.c
82 @@ -58,7 +58,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1
83 #include <stdio.h>
84 #include <unistd.h>
85 #include <rpc/rpc.h>
86 -#include <sys/poll.h>
87 +#include <poll.h>
88 #include <sys/socket.h>
89 #include <rpc/pmap_clnt.h>
90 #ifdef USE_IN_LIBIO
91 --- a/clnt_udp.c
92 +++ b/clnt_udp.c
93 @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1
94 #include <rpc/rpc.h>
95 #include <rpc/xdr.h>
96 #include <rpc/clnt.h>
97 -#include <sys/poll.h>
98 +#include <poll.h>
99 #include <sys/socket.h>
100 #include <sys/ioctl.h>
101 #include <netdb.h>
102 --- a/clnt_unix.c
103 +++ b/clnt_unix.c
104 @@ -55,7 +55,7 @@
105 #include <unistd.h>
106 #include <rpc/rpc.h>
107 #include <sys/uio.h>
108 -#include <sys/poll.h>
109 +#include <poll.h>
110 #include <sys/socket.h>
111 #include <rpc/pmap_clnt.h>
112 #ifdef USE_IN_LIBIO
113 --- a/pmap_rmt.c
114 +++ b/pmap_rmt.c
115 @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1
116 #include <rpc/pmap_prot.h>
117 #include <rpc/pmap_clnt.h>
118 #include <rpc/pmap_rmt.h>
119 -#include <sys/poll.h>
120 +#include <poll.h>
121 #include <sys/socket.h>
122 #include <stdio.h>
123 #include <errno.h>
124 --- a/rcmd.c
125 +++ b/rcmd.c
126 @@ -62,9 +62,10 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (
127 #define __UCLIBC_HIDE_DEPRECATED__
128 #include <features.h>
129 #include <sys/param.h>
130 -#include <sys/poll.h>
131 +#include <poll.h>
132 #include <sys/socket.h>
133 #include <sys/stat.h>
134 +#include <sys/types.h>
135
136 #include <netinet/in.h>
137 #include <arpa/inet.h>
138 @@ -86,6 +87,11 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (
139 #endif
140 #include <sys/uio.h>
141
142 +#ifndef _PATH_HEQUIV
143 +#define _PATH_HEQUIV "/etc/hosts.equiv"
144 +#endif
145 +
146 +int rresvport(int *alport);
147
148 /* some forward declarations */
149 static int __ivaliduser2(FILE *hostf, u_int32_t raddr,
150 @@ -106,7 +112,7 @@ int rcmd(char **ahost, u_short rport, co
151 struct hostent *hp;
152 struct sockaddr_in sin, from;
153 struct pollfd pfd[2];
154 - int32_t oldmask;
155 + sigset_t sig, osig;
156 pid_t pid;
157 int s, lport, timo;
158 char c;
159 @@ -145,7 +151,9 @@ int rcmd(char **ahost, u_short rport, co
160 pfd[1].events = POLLIN;
161
162 *ahost = hp->h_name;
163 - oldmask = sigblock(sigmask(SIGURG)); /* __sigblock */
164 + sigemptyset(&sig);
165 + sigaddset(&sig, SIGURG);
166 + sigprocmask(SIG_BLOCK, &sig, &osig);
167 for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
168 s = rresvport(&lport);
169 if (s < 0) {
170 @@ -154,7 +162,7 @@ int rcmd(char **ahost, u_short rport, co
171 "rcmd: socket: All ports in use\n");
172 else
173 (void)fprintf(stderr, "rcmd: socket: %m\n");
174 - sigsetmask(oldmask); /* sigsetmask */
175 + sigprocmask(SIG_SETMASK, &osig, NULL);
176 return -1;
177 }
178 fcntl(s, F_SETOWN, pid);
179 @@ -189,7 +197,7 @@ int rcmd(char **ahost, u_short rport, co
180 continue;
181 }
182 (void)fprintf(stderr, "%s: %m\n", hp->h_name);
183 - sigsetmask(oldmask); /* __sigsetmask */
184 + sigprocmask(SIG_SETMASK, &osig, NULL);
185 return -1;
186 }
187 lport--;
188 @@ -256,14 +264,14 @@ int rcmd(char **ahost, u_short rport, co
189 }
190 goto bad2;
191 }
192 - sigsetmask(oldmask);
193 + sigprocmask(SIG_SETMASK, &osig, NULL);
194 return s;
195 bad2:
196 if (lport)
197 (void)close(*fd2p);
198 bad:
199 (void)close(s);
200 - sigsetmask(oldmask);
201 + sigprocmask(SIG_SETMASK, &osig, NULL);
202 return -1;
203 }
204
205 --- a/rpc/compat.h
206 +++ b/rpc/compat.h
207 @@ -11,7 +11,7 @@
208 #define __UCLIBC_HAS_THREADS__
209 #endif
210
211 -#include <sys/poll.h>
212 +#include <poll.h>
213 #include <pthread.h>
214
215 #ifdef __UCLIBC__
216 --- a/rpc_commondata.c
217 +++ b/rpc_commondata.c
218 @@ -27,7 +27,7 @@
219 * Mountain View, California 94043
220 */
221 #include <rpc/rpc.h>
222 -#include <sys/poll.h>
223 +#include <poll.h>
224 #include <sys/select.h>
225
226 #undef svc_fdset
227 --- a/rtime.c
228 +++ b/rtime.c
229 @@ -51,13 +51,16 @@ static char sccsid[] = "@(#)rtime.c 2.2
230 #include <rpc/rpc.h>
231 #include <rpc/clnt.h>
232 #include <sys/types.h>
233 -#include <sys/poll.h>
234 +#include <poll.h>
235 #include <sys/socket.h>
236 #include <sys/time.h>
237 #include <rpc/auth_des.h>
238 #include <errno.h>
239 #include <netinet/in.h>
240
241 +#ifndef IPPORT_TIMESERVER
242 +#define IPPORT_TIMESERVER 37
243 +#endif
244
245 #define NYEARS (u_long)(1970 - 1900)
246 #define TOFFSET (u_long)(60*60*24*(365*NYEARS + (NYEARS/4)))
247 --- a/svc.c
248 +++ b/svc.c
249 @@ -44,7 +44,7 @@
250 #include "rpc_private.h"
251 #include <rpc/svc.h>
252 #include <rpc/pmap_clnt.h>
253 -#include <sys/poll.h>
254 +#include <poll.h>
255
256 /* used by svc_[max_]pollfd */
257 /* used by svc_fdset */
258 --- a/svc_run.c
259 +++ b/svc_run.c
260 @@ -36,7 +36,7 @@
261
262 #include <errno.h>
263 #include <unistd.h>
264 -#include <sys/poll.h>
265 +#include <poll.h>
266 #include <rpc/rpc.h>
267
268 /* used by svc_[max_]pollfd */
269 --- a/svc_tcp.c
270 +++ b/svc_tcp.c
271 @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.
272 #include <string.h>
273 #include <rpc/rpc.h>
274 #include <sys/socket.h>
275 -#include <sys/poll.h>
276 +#include <poll.h>
277 #include <errno.h>
278 #include <stdlib.h>
279
280 --- a/svc_unix.c
281 +++ b/svc_unix.c
282 @@ -47,7 +47,7 @@
283 #include <rpc/svc.h>
284 #include <sys/socket.h>
285 #include <sys/uio.h>
286 -#include <sys/poll.h>
287 +#include <poll.h>
288 #include <errno.h>
289 #include <stdlib.h>
290
291 --- a/sa_len.c
292 +++ b/sa_len.c
293 @@ -20,9 +20,9 @@
294 #include <features.h>
295 #include <sys/socket.h>
296 #include <netinet/in.h>
297 -#include <netipx/ipx.h>
298 #include <sys/un.h>
299 #if 0
300 +#include <netipx/ipx.h>
301 #include <netash/ash.h>
302 #include <netatalk/at.h>
303 #include <netax25/ax25.h>
304 @@ -49,13 +49,13 @@ int __libc_sa_len (sa_family_t af)
305 return sizeof (struct sockaddr_rose);
306 case AF_PACKET:
307 return sizeof (struct sockaddr_ll);
308 + case AF_IPX:
309 + return sizeof (struct sockaddr_ipx);
310 #endif
311 case AF_INET:
312 return sizeof (struct sockaddr_in);
313 case AF_INET6:
314 return sizeof (struct sockaddr_in6);
315 - case AF_IPX:
316 - return sizeof (struct sockaddr_ipx);
317 case AF_LOCAL:
318 return sizeof (struct sockaddr_un);
319 }
320 --- a/xdr_float.c
321 +++ b/xdr_float.c
322 @@ -55,7 +55,7 @@ static char sccsid[] = "@(#)xdr_float.c
323 * This routine works on Suns (Sky / 68000's) and Vaxen.
324 */
325
326 -#define LSW (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
327 +#define LSW (__BYTE_ORDER == __BIG_ENDIAN)
328
329 #ifdef vax
330