From 18081f99fe01927b7a7f9ac8204a074c643e5c74 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 10 Apr 2015 21:47:39 +0200 Subject: [PATCH] fix musl compatibility Signed-off-by: Felix Fietkau --- bindresvport.c | 1 + clnt_tcp.c | 2 +- clnt_udp.c | 2 +- clnt_unix.c | 2 +- create_xid.c | 5 ++--- pmap_rmt.c | 2 +- rcmd.c | 22 +++++++++++++++------- rpc/compat.h | 2 +- rpc/netdb.h | 5 +++++ rpc/types.h | 16 ---------------- rpc_commondata.c | 2 +- rtime.c | 5 ++++- sa_len.c | 6 +++--- svc.c | 2 +- svc_run.c | 2 +- svc_tcp.c | 2 +- svc_unix.c | 2 +- xdr_float.c | 2 +- 18 files changed, 41 insertions(+), 41 deletions(-) diff --git a/bindresvport.c b/bindresvport.c index fc077af..3252f14 100644 --- a/bindresvport.c +++ b/bindresvport.c @@ -39,6 +39,7 @@ #include #include #include +#include /* diff --git a/clnt_tcp.c b/clnt_tcp.c index d01fc80..17d6953 100644 --- a/clnt_tcp.c +++ b/clnt_tcp.c @@ -58,7 +58,7 @@ static char sccsid[] = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro"; #include #include #include -#include +#include #include #include #ifdef USE_IN_LIBIO diff --git a/clnt_udp.c b/clnt_udp.c index fe8b7f8..aa57ad0 100644 --- a/clnt_udp.c +++ b/clnt_udp.c @@ -45,7 +45,7 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; #include #include #include -#include +#include #include #include #include diff --git a/clnt_unix.c b/clnt_unix.c index c7756f7..038169a 100644 --- a/clnt_unix.c +++ b/clnt_unix.c @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include #ifdef USE_IN_LIBIO diff --git a/create_xid.c b/create_xid.c index 1ba5f55..35d26d1 100644 --- a/create_xid.c +++ b/create_xid.c @@ -31,7 +31,6 @@ __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_MUTEX_INITIALIZER); static smallint is_initialized; -static struct drand48_data __rpc_lrand48_data; u_long _create_xid (void) attribute_hidden; u_long _create_xid (void) @@ -45,11 +44,11 @@ u_long _create_xid (void) struct timeval now; gettimeofday (&now, (struct timezone *) 0); - srand48_r (now.tv_sec ^ now.tv_usec, &__rpc_lrand48_data); + srand48 (now.tv_sec ^ now.tv_usec); is_initialized = 1; } - lrand48_r (&__rpc_lrand48_data, &res); + res = lrand48(); __UCLIBC_MUTEX_UNLOCK(mylock); diff --git a/pmap_rmt.c b/pmap_rmt.c index f9dd6e7..d046bd7 100644 --- a/pmap_rmt.c +++ b/pmap_rmt.c @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro"; #include #include #include -#include +#include #include #include #include diff --git a/rcmd.c b/rcmd.c index 7712f87..df20973 100644 --- a/rcmd.c +++ b/rcmd.c @@ -62,9 +62,10 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #define __UCLIBC_HIDE_DEPRECATED__ #include #include -#include +#include #include #include +#include #include #include @@ -86,6 +87,11 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #endif #include +#ifndef _PATH_HEQUIV +#define _PATH_HEQUIV "/etc/hosts.equiv" +#endif + +int rresvport(int *alport); /* some forward declarations */ static int __ivaliduser2(FILE *hostf, u_int32_t raddr, @@ -106,7 +112,7 @@ int rcmd(char **ahost, u_short rport, const char *locuser, const char *remuser, struct hostent *hp; struct sockaddr_in sin, from; struct pollfd pfd[2]; - int32_t oldmask; + sigset_t sig, osig; pid_t pid; int s, lport, timo; char c; @@ -145,7 +151,9 @@ int rcmd(char **ahost, u_short rport, const char *locuser, const char *remuser, pfd[1].events = POLLIN; *ahost = hp->h_name; - oldmask = sigblock(sigmask(SIGURG)); /* __sigblock */ + sigemptyset(&sig); + sigaddset(&sig, SIGURG); + sigprocmask(SIG_BLOCK, &sig, &osig); for (timo = 1, lport = IPPORT_RESERVED - 1;;) { s = rresvport(&lport); if (s < 0) { @@ -154,7 +162,7 @@ int rcmd(char **ahost, u_short rport, const char *locuser, const char *remuser, "rcmd: socket: All ports in use\n"); else (void)fprintf(stderr, "rcmd: socket: %m\n"); - sigsetmask(oldmask); /* sigsetmask */ + sigprocmask(SIG_SETMASK, &osig, NULL); return -1; } fcntl(s, F_SETOWN, pid); @@ -189,7 +197,7 @@ int rcmd(char **ahost, u_short rport, const char *locuser, const char *remuser, continue; } (void)fprintf(stderr, "%s: %m\n", hp->h_name); - sigsetmask(oldmask); /* __sigsetmask */ + sigprocmask(SIG_SETMASK, &osig, NULL); return -1; } lport--; @@ -256,14 +264,14 @@ int rcmd(char **ahost, u_short rport, const char *locuser, const char *remuser, } goto bad2; } - sigsetmask(oldmask); + sigprocmask(SIG_SETMASK, &osig, NULL); return s; bad2: if (lport) (void)close(*fd2p); bad: (void)close(s); - sigsetmask(oldmask); + sigprocmask(SIG_SETMASK, &osig, NULL); return -1; } diff --git a/rpc/compat.h b/rpc/compat.h index de8b497..b49fe77 100644 --- a/rpc/compat.h +++ b/rpc/compat.h @@ -11,7 +11,7 @@ #define __UCLIBC_HAS_THREADS__ #endif -#include +#include #include #ifdef __UCLIBC__ diff --git a/rpc/netdb.h b/rpc/netdb.h index 92f264a..110fd49 100644 --- a/rpc/netdb.h +++ b/rpc/netdb.h @@ -37,12 +37,17 @@ #define _RPC_NETDB_H 1 #include +#include #define __need_size_t #include #include "types.h" +#ifndef NETDB_INTERNAL +#define NETDB_INTERNAL -1 +#endif + __BEGIN_DECLS struct rpcent diff --git a/rpc/types.h b/rpc/types.h index cf3c9e3..85fc033 100644 --- a/rpc/types.h +++ b/rpc/types.h @@ -79,22 +79,6 @@ typedef unsigned long rpcport_t; #include #endif -#ifndef __u_char_defined -typedef __u_char u_char; -typedef __u_short u_short; -typedef __u_int u_int; -typedef __u_long u_long; -typedef __quad_t quad_t; -typedef __u_quad_t u_quad_t; -typedef __fsid_t fsid_t; -# define __u_char_defined -#endif -#ifndef __daddr_t_defined -typedef __daddr_t daddr_t; -typedef __caddr_t caddr_t; -# define __daddr_t_defined -#endif - #include #include diff --git a/rpc_commondata.c b/rpc_commondata.c index 187d915..ba11128 100644 --- a/rpc_commondata.c +++ b/rpc_commondata.c @@ -27,7 +27,7 @@ * Mountain View, California 94043 */ #include -#include +#include #include #undef svc_fdset diff --git a/rtime.c b/rtime.c index f9f1d9e..461effa 100644 --- a/rtime.c +++ b/rtime.c @@ -51,13 +51,16 @@ static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 S #include #include #include -#include +#include #include #include #include #include #include +#ifndef IPPORT_TIMESERVER +#define IPPORT_TIMESERVER 37 +#endif #define NYEARS (u_long)(1970 - 1900) #define TOFFSET (u_long)(60*60*24*(365*NYEARS + (NYEARS/4))) diff --git a/sa_len.c b/sa_len.c index 3b37eba..751bc01 100644 --- a/sa_len.c +++ b/sa_len.c @@ -20,9 +20,9 @@ #include #include #include -#include #include #if 0 +#include #include #include #include @@ -49,13 +49,13 @@ int __libc_sa_len (sa_family_t af) return sizeof (struct sockaddr_rose); case AF_PACKET: return sizeof (struct sockaddr_ll); + case AF_IPX: + return sizeof (struct sockaddr_ipx); #endif case AF_INET: return sizeof (struct sockaddr_in); case AF_INET6: return sizeof (struct sockaddr_in6); - case AF_IPX: - return sizeof (struct sockaddr_ipx); case AF_LOCAL: return sizeof (struct sockaddr_un); } diff --git a/svc.c b/svc.c index 0f5300c..26824e3 100644 --- a/svc.c +++ b/svc.c @@ -44,7 +44,7 @@ #include "rpc_private.h" #include #include -#include +#include /* used by svc_[max_]pollfd */ /* used by svc_fdset */ diff --git a/svc_run.c b/svc_run.c index 1442cba..5207dc1 100644 --- a/svc_run.c +++ b/svc_run.c @@ -36,7 +36,7 @@ #include #include -#include +#include #include /* used by svc_[max_]pollfd */ diff --git a/svc_tcp.c b/svc_tcp.c index 363f203..75ada0f 100644 --- a/svc_tcp.c +++ b/svc_tcp.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro"; #include #include #include -#include +#include #include #include diff --git a/svc_unix.c b/svc_unix.c index 6185977..c0b88a8 100644 --- a/svc_unix.c +++ b/svc_unix.c @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include diff --git a/xdr_float.c b/xdr_float.c index fd3863f..8d9ca41 100644 --- a/xdr_float.c +++ b/xdr_float.c @@ -55,7 +55,7 @@ static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro"; * This routine works on Suns (Sky / 68000's) and Vaxen. */ -#define LSW (__FLOAT_WORD_ORDER == __BIG_ENDIAN) +#define LSW (__BYTE_ORDER == __BIG_ENDIAN) #ifdef vax -- 2.11.0