sunrpc: Remove always-defined _RPC_THREAD_SAFE_ macro

Header and C source file changes were generated using:

unifdef -m -D_RPC_THREAD_SAFE_ include/rpc/rpc.h sunrpc/*.c
This commit is contained in:
Florian Weimer 2018-06-26 15:27:03 +02:00
parent 29055464a0
commit 935d920e76
14 changed files with 19 additions and 69 deletions

View File

@ -1,3 +1,22 @@
2018-06-26 Florian Weimer <fweimer@redhat.com>
Remove always-defined _RPC_THREAD_SAFE_ macro.
* sunrpc/Makefile (sunrpc-CPPFLAGS, CPPFLAGS, BUILD_CPPFLAGS):
Do not define _RPC_THREAD_SAFE_.
* include/rpc/rpc.h: Remove _RPC_THREAD_SAFE_ preprocessor
conditional.
* sunrpc/clnt_perr.c: Likewise.
* sunrpc/clnt_raw.c: Likewise.
* sunrpc/clnt_simp.c: Likewise.
* sunrpc/key_call.c: Likewise.
* sunrpc/rpc_common.c: Likewise.
* sunrpc/rpc_main.c: Likewise.
* sunrpc/rpc_thread.c: Likewise.
* sunrpc/svc.c: Likewise.
* sunrpc/svc_raw.c: Likewise.
* sunrpc/svc_simple.c: Likewise.
* sumrpc/svcauth_des.c: Likewise.
2018-06-26 Florian Weimer <fweimer@redhat.com> 2018-06-26 Florian Weimer <fweimer@redhat.com>
* libio/Makefile (tests-internal): Add tst-vtables, * libio/Makefile (tests-internal): Add tst-vtables,

View File

@ -13,7 +13,6 @@ extern unsigned long _create_xid (void);
* Group all global and static variables into a single spot. * Group all global and static variables into a single spot.
* This area is allocated on a per-thread basis * This area is allocated on a per-thread basis
*/ */
#ifdef _RPC_THREAD_SAFE_
struct rpc_thread_variables { struct rpc_thread_variables {
fd_set svc_fdset_s; /* Global, rpc_common.c */ fd_set svc_fdset_s; /* Global, rpc_common.c */
struct rpc_createerr rpc_createerr_s; /* Global, rpc_common.c */ struct rpc_createerr rpc_createerr_s; /* Global, rpc_common.c */
@ -63,7 +62,5 @@ libc_hidden_proto (__rpc_thread_createerr)
int __libc_rpc_gethostbyname (const char *host, struct sockaddr_in *addr) int __libc_rpc_gethostbyname (const char *host, struct sockaddr_in *addr)
attribute_hidden; attribute_hidden;
#endif /* _RPC_THREAD_SAFE_ */
# endif /* !_ISOMAC */ # endif /* !_ISOMAC */
#endif #endif

View File

@ -156,10 +156,6 @@ CFLAGS-pmap_rmt.c += -fexceptions
CFLAGS-clnt_perr.c += -fexceptions CFLAGS-clnt_perr.c += -fexceptions
CFLAGS-openchild.c += -fexceptions CFLAGS-openchild.c += -fexceptions
sunrpc-CPPFLAGS = -D_RPC_THREAD_SAFE_
CPPFLAGS += $(sunrpc-CPPFLAGS)
BUILD_CPPFLAGS += $(sunrpc-CPPFLAGS)
$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so $(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
$(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so

View File

@ -40,16 +40,12 @@
static char *auth_errmsg (enum auth_stat stat); static char *auth_errmsg (enum auth_stat stat);
#ifdef _RPC_THREAD_SAFE_
/* /*
* Making buf a preprocessor macro requires renaming the local * Making buf a preprocessor macro requires renaming the local
* buf variable in a few functions. Overriding a global variable * buf variable in a few functions. Overriding a global variable
* with a local variable of the same name is a bad idea, anyway. * with a local variable of the same name is a bad idea, anyway.
*/ */
#define buf RPC_THREAD_VARIABLE(clnt_perr_buf_s) #define buf RPC_THREAD_VARIABLE(clnt_perr_buf_s)
#else
static char *buf;
#endif
/* /*
* Print reply error info * Print reply error info

View File

@ -59,11 +59,7 @@ struct clntraw_private_s
} mashl_callmsg; } mashl_callmsg;
u_int mcnt; u_int mcnt;
}; };
#ifdef _RPC_THREAD_SAFE_
#define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s) #define clntraw_private RPC_THREAD_VARIABLE(clntraw_private_s)
#else
static struct clntraw_private_s *clntraw_private;
#endif
static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, caddr_t, static enum clnt_stat clntraw_call (CLIENT *, u_long, xdrproc_t, caddr_t,
xdrproc_t, caddr_t, struct timeval); xdrproc_t, caddr_t, struct timeval);

View File

@ -49,11 +49,7 @@ struct callrpc_private_s
u_long oldprognum, oldversnum, valid; u_long oldprognum, oldversnum, valid;
char *oldhost; char *oldhost;
}; };
#ifdef _RPC_THREAD_SAFE_
#define callrpc_private RPC_THREAD_VARIABLE(callrpc_private_s) #define callrpc_private RPC_THREAD_VARIABLE(callrpc_private_s)
#else
static struct callrpc_private_s *callrpc_private;
#endif
int int
callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum, callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
@ -123,7 +119,6 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
} }
libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0) libc_hidden_nolink_sunrpc (callrpc, GLIBC_2_0)
#ifdef _RPC_THREAD_SAFE_
void void
__rpc_thread_clnt_cleanup (void) __rpc_thread_clnt_cleanup (void)
{ {
@ -135,4 +130,3 @@ __rpc_thread_clnt_cleanup (void)
free (rcp); free (rcp);
} }
} }
#endif /* _RPC_THREAD_SAFE_ */

View File

@ -378,11 +378,7 @@ struct key_call_private {
pid_t pid; /* process-id at moment of creation */ pid_t pid; /* process-id at moment of creation */
uid_t uid; /* user-id at last authorization */ uid_t uid; /* user-id at last authorization */
}; };
#ifdef _RPC_THREAD_SAFE_
#define key_call_private_main RPC_THREAD_VARIABLE(key_call_private_s) #define key_call_private_main RPC_THREAD_VARIABLE(key_call_private_s)
#else
static struct key_call_private *key_call_private_main;
#endif
__libc_lock_define_initialized (static, keycall_lock) __libc_lock_define_initialized (static, keycall_lock)
/* /*
@ -555,7 +551,6 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
#endif #endif
} }
#ifdef _RPC_THREAD_SAFE_
void void
__rpc_thread_key_cleanup (void) __rpc_thread_key_cleanup (void)
{ {
@ -570,4 +565,3 @@ __rpc_thread_key_cleanup (void)
free (kcp); free (kcp);
} }
} }
#endif /* _RPC_THREAD_SAFE_ */

View File

@ -30,12 +30,10 @@
#include <rpc/rpc.h> #include <rpc/rpc.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#ifdef _RPC_THREAD_SAFE_
#undef svc_fdset #undef svc_fdset
#undef rpc_createerr #undef rpc_createerr
#undef svc_pollfd #undef svc_pollfd
#undef svc_max_pollfd #undef svc_max_pollfd
#endif /* _RPC_THREAD_SAFE_ */
/* /*
* This file should only contain common data (global data) that is exported * This file should only contain common data (global data) that is exported

View File

@ -1341,15 +1341,6 @@ parseargs (int argc, const char *argv[], struct commandline *cmd)
cmd->Scflag = flag['C']; cmd->Scflag = flag['C'];
cmd->makefileflag = flag['M']; cmd->makefileflag = flag['M'];
#ifndef _RPC_THREAD_SAFE_
if (mtflag || newstyle)
{
/* glibc doesn't support these flags. */
f_print (stderr,
_("This implementation doesn't support newstyle or MT-safe code!\n"));
return (0);
}
#endif
if (tirpcflag) if (tirpcflag)
{ {
pmflag = inetdflag ? 0 : 1; /* pmflag or inetdflag is always TRUE */ pmflag = inetdflag ? 0 : 1; /* pmflag or inetdflag is always TRUE */

View File

@ -6,7 +6,6 @@
#include <libc-tsd.h> #include <libc-tsd.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#ifdef _RPC_THREAD_SAFE_
/* Variable used in non-threaded applications or for the first thread. */ /* Variable used in non-threaded applications or for the first thread. */
static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem;
@ -136,5 +135,3 @@ libc_hidden_def (__rpc_thread_svc_max_pollfd)
#else #else
libc_hidden_nolink_sunrpc (__rpc_thread_svc_max_pollfd, GLIBC_2_2_3) libc_hidden_nolink_sunrpc (__rpc_thread_svc_max_pollfd, GLIBC_2_2_3)
#endif #endif
#endif /* _RPC_THREAD_SAFE_ */

View File

@ -61,11 +61,7 @@
#include <time.h> #include <time.h>
#include <shlib-compat.h> #include <shlib-compat.h>
#ifdef _RPC_THREAD_SAFE_
#define xports RPC_THREAD_VARIABLE(svc_xports_s) #define xports RPC_THREAD_VARIABLE(svc_xports_s)
#else
static SVCXPRT **xports;
#endif
#define NULL_SVC ((struct svc_callout *)0) #define NULL_SVC ((struct svc_callout *)0)
#define RQCRED_SIZE 400 /* this size is excessive */ #define RQCRED_SIZE 400 /* this size is excessive */
@ -81,11 +77,7 @@ struct svc_callout {
void (*sc_dispatch) (struct svc_req *, SVCXPRT *); void (*sc_dispatch) (struct svc_req *, SVCXPRT *);
bool_t sc_mapped; bool_t sc_mapped;
}; };
#ifdef _RPC_THREAD_SAFE_
#define svc_head RPC_THREAD_VARIABLE(svc_head_s) #define svc_head RPC_THREAD_VARIABLE(svc_head_s)
#else
static struct svc_callout *svc_head;
#endif
/* *************** SVCXPRT related stuff **************** */ /* *************** SVCXPRT related stuff **************** */
@ -568,7 +560,6 @@ __svc_accept_failed (void)
} }
} }
#ifdef _RPC_THREAD_SAFE_
void void
__rpc_thread_svc_cleanup (void) __rpc_thread_svc_cleanup (void)
@ -578,5 +569,3 @@ __rpc_thread_svc_cleanup (void)
while ((svcp = svc_head) != NULL) while ((svcp = svc_head) != NULL)
svc_unregister (svcp->sc_prog, svcp->sc_vers); svc_unregister (svcp->sc_prog, svcp->sc_vers);
} }
#endif /* _RPC_THREAD_SAFE_ */

View File

@ -48,11 +48,7 @@ struct svcraw_private_s
XDR xdr_stream; XDR xdr_stream;
char verf_body[MAX_AUTH_BYTES]; char verf_body[MAX_AUTH_BYTES];
}; };
#ifdef _RPC_THREAD_SAFE_
#define svcraw_private RPC_THREAD_VARIABLE(svcraw_private_s) #define svcraw_private RPC_THREAD_VARIABLE(svcraw_private_s)
#else
static struct svcraw_private_s *svcraw_private;
#endif
static bool_t svcraw_recv (SVCXPRT *, struct rpc_msg *); static bool_t svcraw_recv (SVCXPRT *, struct rpc_msg *);
static enum xprt_stat svcraw_stat (SVCXPRT *); static enum xprt_stat svcraw_stat (SVCXPRT *);

View File

@ -53,19 +53,11 @@ struct proglst_
xdrproc_t p_inproc, p_outproc; xdrproc_t p_inproc, p_outproc;
struct proglst_ *p_nxt; struct proglst_ *p_nxt;
}; };
#ifdef _RPC_THREAD_SAFE_
#define proglst RPC_THREAD_VARIABLE(svcsimple_proglst_s) #define proglst RPC_THREAD_VARIABLE(svcsimple_proglst_s)
#else
static struct proglst_ *proglst;
#endif
static void universal (struct svc_req *rqstp, SVCXPRT *transp_s); static void universal (struct svc_req *rqstp, SVCXPRT *transp_s);
#ifdef _RPC_THREAD_SAFE_
#define transp RPC_THREAD_VARIABLE(svcsimple_transp_s) #define transp RPC_THREAD_VARIABLE(svcsimple_transp_s)
#else
static SVCXPRT *transp;
#endif
int int
__registerrpc (u_long prognum, u_long versnum, u_long procnum, __registerrpc (u_long prognum, u_long versnum, u_long procnum,

View File

@ -72,13 +72,8 @@ struct cache_entry
struct rpc_timeval laststamp; /* detect replays of creds */ struct rpc_timeval laststamp; /* detect replays of creds */
char *localcred; /* generic local credential */ char *localcred; /* generic local credential */
}; };
#ifdef _RPC_THREAD_SAFE_
#define authdes_cache RPC_THREAD_VARIABLE(authdes_cache_s) #define authdes_cache RPC_THREAD_VARIABLE(authdes_cache_s)
#define authdes_lru RPC_THREAD_VARIABLE(authdes_lru_s) #define authdes_lru RPC_THREAD_VARIABLE(authdes_lru_s)
#else
static struct cache_entry *authdes_cache;
static int *authdes_lru;
#endif
static void cache_init (void); /* initialize the cache */ static void cache_init (void); /* initialize the cache */
static short cache_spot (des_block *, char *, struct rpc_timeval *); static short cache_spot (des_block *, char *, struct rpc_timeval *);