diff options
author | Ulrich Drepper <drepper@redhat.com> | 2001-03-20 18:35:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2001-03-20 18:35:13 +0000 |
commit | f1e4a4a403f740c153acfc0cd96ecc5aa542e341 (patch) | |
tree | 55d564a6eba26109ea12055a24b7846c1a100fa4 /sunrpc/clnt_perr.c | |
parent | 373e6a512c30b2e34ac4a6f5b154edf45f400b35 (diff) | |
download | glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.gz glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.tar.bz2 glibc-f1e4a4a403f740c153acfc0cd96ecc5aa542e341.zip |
Update.
* sunrpc/Makefile (routines): Add rpc_thread.
(CPPFLAGS): Add -D_RPC_THREAD_SAFE.
* sunrpc/rpc_thread.c: New file.
* sunrpc/Versions [libc] (GLIBC_2.2.3): Export __rpc_thread_destroy.
* sunrpc/auth_none.c: Don't use global variables. Access state in
thread-local storage.
* 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/svc.c: Likewise.
* sunrpc/svc_raw.c: Likewise.
* sunrpc/svc_simple.c: Likewise.
* sunrpc/svcauth_des.c: Likewise.
* hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add
_HURD_THREADVAR_RPC_VARS.
* sysdeps/generic/bits/libc-tsd.h: Mention _LIBC_TSD_KEY_RPC_VARS.
* include/rpc/rpc.h: Define data structures for internal thread-local
"global" variables.
Based on patches by Eric Norum <eric.norum@usask.ca>.
Diffstat (limited to 'sunrpc/clnt_perr.c')
-rw-r--r-- | sunrpc/clnt_perr.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sunrpc/clnt_perr.c b/sunrpc/clnt_perr.c index 6c33c32d2f..24b15c04c6 100644 --- a/sunrpc/clnt_perr.c +++ b/sunrpc/clnt_perr.c @@ -40,9 +40,7 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; #include <stdio.h> #include <string.h> #include <libintl.h> -#include <rpc/types.h> -#include <rpc/auth.h> -#include <rpc/clnt.h> +#include <rpc/rpc.h> #ifdef USE_IN_LIBIO # include <libio/iolibio.h> @@ -51,7 +49,16 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro"; static char *auth_errmsg (enum auth_stat stat) internal_function; +#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 ((char *)RPC_THREAD_VARIABLE(clnt_perr_buf_s)) +#else static char *buf; +#endif static char * _buf (void) @@ -67,7 +74,7 @@ _buf (void) char * clnt_sperror (CLIENT * rpch, const char *msg) { - char buf[1024]; + char chrbuf[1024]; struct rpc_err e; char *err; char *str = _buf (); @@ -103,7 +110,7 @@ clnt_sperror (CLIENT * rpch, const char *msg) case RPC_CANTSEND: case RPC_CANTRECV: len = sprintf (str, "; errno = %s", __strerror_r (e.re_errno, - buf, sizeof buf)); + chrbuf, sizeof chrbuf)); str += len; break; @@ -281,7 +288,7 @@ clnt_perrno (enum clnt_stat num) char * clnt_spcreateerror (const char *msg) { - char buf[1024]; + char chrbuf[1024]; char *str = _buf (); char *cp; int len; @@ -301,7 +308,7 @@ clnt_spcreateerror (const char *msg) case RPC_SYSTEMERROR: cp = stpcpy (stpcpy (cp, " - "), __strerror_r (rpc_createerr.cf_error.re_errno, - buf, sizeof buf)); + chrbuf, sizeof chrbuf)); break; default: break; |