From 935d920e763626dbcbbf655117285d1d270791a1 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 26 Jun 2018 15:27:03 +0200 Subject: 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 --- ChangeLog | 19 +++++++++++++++++++ include/rpc/rpc.h | 3 --- sunrpc/Makefile | 4 ---- sunrpc/clnt_perr.c | 4 ---- sunrpc/clnt_raw.c | 4 ---- sunrpc/clnt_simp.c | 6 ------ sunrpc/key_call.c | 6 ------ sunrpc/rpc_common.c | 2 -- sunrpc/rpc_main.c | 9 --------- sunrpc/rpc_thread.c | 3 --- sunrpc/svc.c | 11 ----------- sunrpc/svc_raw.c | 4 ---- sunrpc/svc_simple.c | 8 -------- sunrpc/svcauth_des.c | 5 ----- 14 files changed, 19 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 511128c6dd..5cd85668d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2018-06-26 Florian Weimer + + 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 * libio/Makefile (tests-internal): Add tst-vtables, diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h index 1fb925e85c..327d84319e 100644 --- a/include/rpc/rpc.h +++ b/include/rpc/rpc.h @@ -13,7 +13,6 @@ extern unsigned long _create_xid (void); * Group all global and static variables into a single spot. * This area is allocated on a per-thread basis */ -#ifdef _RPC_THREAD_SAFE_ struct rpc_thread_variables { fd_set svc_fdset_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) attribute_hidden; -#endif /* _RPC_THREAD_SAFE_ */ - # endif /* !_ISOMAC */ #endif diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 8f2a3c8213..0e2f8d7c9e 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -156,10 +156,6 @@ CFLAGS-pmap_rmt.c += -fexceptions CFLAGS-clnt_perr.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-xdrmem: $(common-objpfx)linkobj/libc.so $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c index cac1dd9913..dd5b10688e 100644 --- a/sunrpc/clnt_perr.c +++ b/sunrpc/clnt_perr.c @@ -40,16 +40,12 @@ static char *auth_errmsg (enum auth_stat stat); -#ifdef _RPC_THREAD_SAFE_ /* * Making buf a preprocessor macro requires renaming the local * buf variable in a few functions. Overriding a global variable * with a local variable of the same name is a bad idea, anyway. */ #define buf RPC_THREAD_VARIABLE(clnt_perr_buf_s) -#else -static char *buf; -#endif /* * Print reply error info diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c index d62a11a2ca..5b9bd48247 100644 --- a/sunrpc/clnt_raw.c +++ b/sunrpc/clnt_raw.c @@ -59,11 +59,7 @@ struct clntraw_private_s } mashl_callmsg; u_int mcnt; }; -#ifdef _RPC_THREAD_SAFE_ #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, xdrproc_t, caddr_t, struct timeval); diff --git a/sunrpc/clnt_simp.c b/sunrpc/clnt_simp.c index bdf6322fc4..fab61d2170 100644 --- a/sunrpc/clnt_simp.c +++ b/sunrpc/clnt_simp.c @@ -49,11 +49,7 @@ struct callrpc_private_s u_long oldprognum, oldversnum, valid; char *oldhost; }; -#ifdef _RPC_THREAD_SAFE_ #define callrpc_private RPC_THREAD_VARIABLE(callrpc_private_s) -#else -static struct callrpc_private_s *callrpc_private; -#endif int 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) -#ifdef _RPC_THREAD_SAFE_ void __rpc_thread_clnt_cleanup (void) { @@ -135,4 +130,3 @@ __rpc_thread_clnt_cleanup (void) free (rcp); } } -#endif /* _RPC_THREAD_SAFE_ */ diff --git a/sunrpc/key_call.c b/sunrpc/key_call.c index a599fd9a6b..9b8f9819c9 100644 --- a/sunrpc/key_call.c +++ b/sunrpc/key_call.c @@ -378,11 +378,7 @@ struct key_call_private { pid_t pid; /* process-id at moment of creation */ uid_t uid; /* user-id at last authorization */ }; -#ifdef _RPC_THREAD_SAFE_ #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) /* @@ -555,7 +551,6 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg, #endif } -#ifdef _RPC_THREAD_SAFE_ void __rpc_thread_key_cleanup (void) { @@ -570,4 +565,3 @@ __rpc_thread_key_cleanup (void) free (kcp); } } -#endif /* _RPC_THREAD_SAFE_ */ diff --git a/sunrpc/rpc_common.c b/sunrpc/rpc_common.c index 2d42827a87..2a5d0dc1c7 100644 --- a/sunrpc/rpc_common.c +++ b/sunrpc/rpc_common.c @@ -30,12 +30,10 @@ #include #include -#ifdef _RPC_THREAD_SAFE_ #undef svc_fdset #undef rpc_createerr #undef svc_pollfd #undef svc_max_pollfd -#endif /* _RPC_THREAD_SAFE_ */ /* * This file should only contain common data (global data) that is exported diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c index f94bc91546..c6607848cc 100644 --- a/sunrpc/rpc_main.c +++ b/sunrpc/rpc_main.c @@ -1341,15 +1341,6 @@ parseargs (int argc, const char *argv[], struct commandline *cmd) cmd->Scflag = flag['C']; 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) { pmflag = inetdflag ? 0 : 1; /* pmflag or inetdflag is always TRUE */ diff --git a/sunrpc/rpc_thread.c b/sunrpc/rpc_thread.c index ccbf9bb69b..068a49f92b 100644 --- a/sunrpc/rpc_thread.c +++ b/sunrpc/rpc_thread.c @@ -6,7 +6,6 @@ #include #include -#ifdef _RPC_THREAD_SAFE_ /* Variable used in non-threaded applications or for the first thread. */ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; @@ -136,5 +135,3 @@ libc_hidden_def (__rpc_thread_svc_max_pollfd) #else libc_hidden_nolink_sunrpc (__rpc_thread_svc_max_pollfd, GLIBC_2_2_3) #endif - -#endif /* _RPC_THREAD_SAFE_ */ diff --git a/sunrpc/svc.c b/sunrpc/svc.c index 87baf6ac68..90e84e2cd2 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -61,11 +61,7 @@ #include #include -#ifdef _RPC_THREAD_SAFE_ #define xports RPC_THREAD_VARIABLE(svc_xports_s) -#else -static SVCXPRT **xports; -#endif #define NULL_SVC ((struct svc_callout *)0) #define RQCRED_SIZE 400 /* this size is excessive */ @@ -81,11 +77,7 @@ struct svc_callout { void (*sc_dispatch) (struct svc_req *, SVCXPRT *); bool_t sc_mapped; }; -#ifdef _RPC_THREAD_SAFE_ #define svc_head RPC_THREAD_VARIABLE(svc_head_s) -#else -static struct svc_callout *svc_head; -#endif /* *************** SVCXPRT related stuff **************** */ @@ -568,7 +560,6 @@ __svc_accept_failed (void) } } -#ifdef _RPC_THREAD_SAFE_ void __rpc_thread_svc_cleanup (void) @@ -578,5 +569,3 @@ __rpc_thread_svc_cleanup (void) while ((svcp = svc_head) != NULL) svc_unregister (svcp->sc_prog, svcp->sc_vers); } - -#endif /* _RPC_THREAD_SAFE_ */ diff --git a/sunrpc/svc_raw.c b/sunrpc/svc_raw.c index 4787203613..f0176311d5 100644 --- a/sunrpc/svc_raw.c +++ b/sunrpc/svc_raw.c @@ -48,11 +48,7 @@ struct svcraw_private_s XDR xdr_stream; char verf_body[MAX_AUTH_BYTES]; }; -#ifdef _RPC_THREAD_SAFE_ #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 enum xprt_stat svcraw_stat (SVCXPRT *); diff --git a/sunrpc/svc_simple.c b/sunrpc/svc_simple.c index f12ed31441..2f2595c0ff 100644 --- a/sunrpc/svc_simple.c +++ b/sunrpc/svc_simple.c @@ -53,19 +53,11 @@ struct proglst_ xdrproc_t p_inproc, p_outproc; struct proglst_ *p_nxt; }; -#ifdef _RPC_THREAD_SAFE_ #define proglst RPC_THREAD_VARIABLE(svcsimple_proglst_s) -#else -static struct proglst_ *proglst; -#endif static void universal (struct svc_req *rqstp, SVCXPRT *transp_s); -#ifdef _RPC_THREAD_SAFE_ #define transp RPC_THREAD_VARIABLE(svcsimple_transp_s) -#else -static SVCXPRT *transp; -#endif int __registerrpc (u_long prognum, u_long versnum, u_long procnum, diff --git a/sunrpc/svcauth_des.c b/sunrpc/svcauth_des.c index 9ce4804239..c5a512d6f8 100644 --- a/sunrpc/svcauth_des.c +++ b/sunrpc/svcauth_des.c @@ -72,13 +72,8 @@ struct cache_entry struct rpc_timeval laststamp; /* detect replays of creds */ char *localcred; /* generic local credential */ }; -#ifdef _RPC_THREAD_SAFE_ #define authdes_cache RPC_THREAD_VARIABLE(authdes_cache_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 short cache_spot (des_block *, char *, struct rpc_timeval *); -- cgit v1.2.3