/*.aps
/*.plg
/Release
-/Debug
\ No newline at end of file
+/Debug
+/*.dep
+/*.mak
\ No newline at end of file
# this is different from the project version
# http://sources.redhat.com/autobook/autobook/autobook_91.html
-liboncrpc_la_LDFLAGS = -version-info 1:0:0
+liboncrpc_la_LDFLAGS = -version-info 2:0:0
EXTRA_DIST = \
.cvsignore \
#include <rpc/auth_unix.h>
#else
#include <rpc/types.h>
+#include <rpc/rpc.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
#include <rpc/auth_unix.h>
#include <rpc/auth.h>
#include <rpc/clnt.h>
+// eventually we might be able to support autoconf via cygwin...
+#if defined (_MSC_VER) || defined(__BORLANDC__)
+# include "config_win32.h"
+#else
+# include "config.h"
+#endif
+
#ifndef WIN32
+#if !HAVE_DECL_SYS_ERRLIST
extern char *sys_errlist[];
+extern int sys_nerr;
+#endif
#ifdef NEED_SPRINTF
extern char *sprintf();
#endif
clnt_spcreateerror(s)
char *s;
{
- extern int sys_nerr;
-#ifndef WIN32
- extern char *sys_errlist[];
-#endif
char *str = _buf();
if (str == 0)
#include <sys/socket.h>
#endif
+// eventually we might be able to support autoconf via cygwin...
+#if defined (_MSC_VER) || defined(__BORLANDC__)
+# include "config_win32.h"
+#else
+# include "config.h"
+#endif
+
+#ifndef HAVE_STRUCT_RPCENT
+/* routines for parsing /etc/rpc */
+#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */
+#endif
+
/*
* Internet version.
*/
static int init = 0;
+CRITICAL_SECTION __thr_mutex;
+
int rpc_nt_init(void)
{
if (init++)
return WSACleanup();
}
+BOOL WINAPI DllMain(
+ HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved
+)
+{
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ __thr_key = TlsAlloc();
+ InitializeCriticalSection(&__thr_mutex);
+ break;
+
+ case DLL_PROCESS_DETACH:
+ TlsFree(__thr_key);
+ DeleteCriticalSection(&__thr_mutex);
+ break;
+
+ case DLL_THREAD_DETACH: {
+ LPVOID ptr=TlsGetValue(__thr_key);
+ if (ptr)
+ free(ptr);
+ }
+ break;
+ }
+ return TRUE;
+}
+
VOID
nt_rpc_report(LPTSTR lpszMsg)
{
_clnt_pcreateerror=clnt_pcreateerror
_clnt_perrno=clnt_perrno
_clnt_perror=clnt_perror
-_clnt_spcreateerror=clnt_spcreateerror
+_onc_clnt_spcreateerror=onc_clnt_spcreateerror
_clnt_sperrno=clnt_sperrno
_clnt_sperror=clnt_sperror
_clntraw_create=clntraw_create
-_clnttcp_create=clnttcp_create
+_onc_clnttcp_create=onc_clnttcp_create
_clntudp_bufcreate=clntudp_bufcreate
_clntudp_create=clntudp_create
_get_myaddress=get_myaddress
_rpc_nt_exit=rpc_nt_exit
_rpc_nt_init=rpc_nt_init
_svc_getreq=svc_getreq
-_svc_getreqset=svc_getreqset
-_svc_register=svc_register
+_onc_svc_getreqset=onc_svc_getreqset
+_onc_svc_register=onc_svc_register
_svc_run=svc_run
_svc_sendreply=svc_sendreply
_svc_unregister=svc_unregister
_svctcp_create=svctcp_create
_svcudp_bufcreate=svcudp_bufcreate
_svcudp_create=svcudp_create
+_svcfd_create=svcfd_create
_xdr_array=xdr_array
_xdr_authunix_parms=xdr_authunix_parms
_xdr_bool=xdr_bool
_xdrstdio_create=xdrstdio_create
_xprt_register=xprt_register
_xprt_unregister=xprt_unregister
-_svc_fdset=svc_fdset
-_rpc_createerr=rpc_createerr
-__null_auth=_null_auth
-
+__thr_svc_fdset=_thr_svc_fdset
+__thr_rpc_createerr=_thr_rpc_createerr
+__thr_null_auth=_thr_null_auth
xdrstdio_create
xprt_register
xprt_unregister
-onc_svc_fdset DATA
-rpc_createerr DATA
-_null_auth DATA
+DllMain
+_thr_svc_fdset
+_thr_rpc_createerr
+_thr_null_auth
# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ONCRPC_EXPORTS" /YX /FD /c\r
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ONCRPCDLL" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I ".." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ONCRPCDLL" /YX /FD /c\r
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
# ADD BASE RSC /l 0x409 /d "NDEBUG"\r
# PROP Intermediate_Dir "Debug"\r
# PROP Ignore_Export_Lib 0\r
# PROP Target_Dir ""\r
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ONCRPC_EXPORTS" /YX /FD /GZ /c\r
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ONCRPCDLL" /FR /YX /FD /GZ /c\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ONCRPC_EXPORTS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ONCRPCDLL" /FR /YX /FD /GZ /c\r
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
# ADD BASE RSC /l 0x409 /d "_DEBUG"\r
#endif // APSTUDIO_INVOKED
-#endif // English (U.S.) resources
+
+#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
1 VERSIONINFO
- FILEVERSION 1,14,3,1
- PRODUCTVERSION 1,14,3,1
+ FILEVERSION 2,0,0,0
+ PRODUCTVERSION 2,0,0,0
FILEFLAGSMASK 0x0L
#ifdef _DEBUG
FILEFLAGS 0x1L
VALUE "OriginalFilename", "ONCRPC.DLL\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "ONC/RPC Library/Win32\0"
- VALUE "ProductVersion", "1.14.3\0"
+ VALUE "ProductVersion", "2.0\0"
VALUE "SpecialBuild", "\0"
END
END
END
END
+#endif // !_MAC
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
LIBRARY oncrpc
EXPORTS
-authnone_create=_authnone_create
-authunix_create=_authunix_create
-authunix_create_default=_authunix_create_default
-bcopy=_bcopy
-bzero=_bzero
-bcmp=_bcmp
-clnt_create=_clnt_create
-clnt_broadcast=_clnt_broadcast
-clnt_pcreateerror=_clnt_pcreateerror
-clnt_perrno=_clnt_perrno
-clnt_perror=_clnt_perror
-clnt_spcreateerror=_clnt_spcreateerror
-clnt_sperrno=_clnt_sperrno
-clnt_sperror=_clnt_sperror
-clntraw_create=_clntraw_create
-clnttcp_create=_clnttcp_create
-clntudp_bufcreate=_clntudp_bufcreate
-clntudp_create=_clntudp_create
-get_myaddress=_get_myaddress
-getrpcbyname=_getrpcbyname
-getrpcbynumber=_getrpcbynumber
-pmap_getmaps=_pmap_getmaps
-pmap_getport=_pmap_getport
-pmap_set=_pmap_set
-pmap_unset=_pmap_unset
-rpc_nt_exit=_rpc_nt_exit
-rpc_nt_init=_rpc_nt_init
-svc_getreq=_svc_getreq
-svc_getreqset=_svc_getreqset
-svc_register=_svc_register
-svc_run=_svc_run
-svc_sendreply=_svc_sendreply
-svc_unregister=_svc_unregister
-svcerr_auth=_svcerr_auth
-svcerr_decode=_svcerr_decode
-svcerr_noproc=_svcerr_noproc
-svcerr_noprog=_svcerr_noprog
-svcerr_progvers=_svcerr_progvers
-svcerr_systemerr=_svcerr_systemerr
-svcerr_weakauth=_svcerr_weakauth
-svcraw_create=_svcraw_create
-svctcp_create=_svctcp_create
-svcudp_bufcreate=_svcudp_bufcreate
-svcudp_create=_svcudp_create
-xdr_array=_xdr_array
-xdr_authunix_parms=_xdr_authunix_parms
-xdr_bool=_xdr_bool
-xdr_bytes=_xdr_bytes
-xdr_callhdr=_xdr_callhdr
-xdr_callmsg=_xdr_callmsg
-xdr_char=_xdr_char
-xdr_des_block=_xdr_des_block
-xdr_double=_xdr_double
-xdr_enum=_xdr_enum
-xdr_float=_xdr_float
-xdr_free=_xdr_free
-xdr_int=_xdr_int
-xdr_long=_xdr_long
-xdr_netobj=_xdr_netobj
-xdr_opaque=_xdr_opaque
-xdr_opaque_auth=_xdr_opaque_auth
-xdr_pmap=_xdr_pmap
-xdr_pmaplist=_xdr_pmaplist
-xdr_pointer=_xdr_pointer
-xdr_reference=_xdr_reference
-xdr_replymsg=_xdr_replymsg
-xdr_short=_xdr_short
-xdr_string=_xdr_string
-xdr_u_char=_xdr_u_char
-xdr_u_int=_xdr_u_int
-xdr_u_long=_xdr_u_long
-xdr_u_short=_xdr_u_short
-xdr_union=_xdr_union
-xdr_vector=_xdr_vector
-xdr_void=_xdr_void
-xdr_wrapstring=_xdr_wrapstring
-xdrmem_create=_xdrmem_create
-xdrrec_create=_xdrrec_create
-xdrrec_endofrecord=_xdrrec_endofrecord
-xdrrec_eof=_xdrrec_eof
-xdrrec_skiprecord=_xdrrec_skiprecord
-xdrstdio_create=_xdrstdio_create
-xprt_register=_xprt_register
-xprt_unregister=_xprt_unregister
-svc_fdset=_svc_fdset
-rpc_createerr=_rpc_createerr
-_null_auth=__null_auth
-
+_authnone_create=authnone_create
+_authunix_create=authunix_create
+_authunix_create_default=authunix_create_default
+_bcopy=bcopy
+_bzero=bzero
+_bcmp=bcmp
+_clnt_create=clnt_create
+_clnt_broadcast=clnt_broadcast
+_clnt_pcreateerror=clnt_pcreateerror
+_clnt_perrno=clnt_perrno
+_clnt_perror=clnt_perror
+_onc_clnt_spcreateerror=onc_clnt_spcreateerror
+_clnt_sperrno=clnt_sperrno
+_clnt_sperror=clnt_sperror
+_clntraw_create=clntraw_create
+_onc_clnttcp_create=onc_clnttcp_create
+_clntudp_bufcreate=clntudp_bufcreate
+_clntudp_create=clntudp_create
+_get_myaddress=get_myaddress
+_getrpcbyname=getrpcbyname
+_getrpcbynumber=getrpcbynumber
+_pmap_getmaps=pmap_getmaps
+_pmap_getport=pmap_getport
+_pmap_set=pmap_set
+_pmap_unset=pmap_unset
+_rpc_nt_exit=rpc_nt_exit
+_rpc_nt_init=rpc_nt_init
+_svc_getreq=svc_getreq
+_onc_svc_getreqset=onc_svc_getreqset
+_onc_svc_register=onc_svc_register
+_svc_run=svc_run
+_svc_sendreply=svc_sendreply
+_svc_unregister=svc_unregister
+_svcerr_auth=svcerr_auth
+_svcerr_decode=svcerr_decode
+_svcerr_noproc=svcerr_noproc
+_svcerr_noprog=svcerr_noprog
+_svcerr_progvers=svcerr_progvers
+_svcerr_systemerr=svcerr_systemerr
+_svcerr_weakauth=svcerr_weakauth
+_svcraw_create=svcraw_create
+_svctcp_create=svctcp_create
+_svcudp_bufcreate=svcudp_bufcreate
+_svcudp_create=svcudp_create
+_svcfd_create=svcfd_create
+_xdr_array=xdr_array
+_xdr_authunix_parms=xdr_authunix_parms
+_xdr_bool=xdr_bool
+_xdr_bytes=xdr_bytes
+_xdr_callhdr=xdr_callhdr
+_xdr_callmsg=xdr_callmsg
+_xdr_char=xdr_char
+_xdr_des_block=xdr_des_block
+_xdr_double=xdr_double
+_xdr_enum=xdr_enum
+_xdr_float=xdr_float
+_xdr_free=xdr_free
+_xdr_int=xdr_int
+_xdr_long=xdr_long
+_xdr_netobj=xdr_netobj
+_xdr_opaque=xdr_opaque
+_xdr_opaque_auth=xdr_opaque_auth
+_xdr_pmap=xdr_pmap
+_xdr_pmaplist=xdr_pmaplist
+_xdr_pointer=xdr_pointer
+_xdr_reference=xdr_reference
+_xdr_replymsg=xdr_replymsg
+_xdr_short=xdr_short
+_xdr_string=xdr_string
+_xdr_u_char=xdr_u_char
+_xdr_u_int=xdr_u_int
+_xdr_u_long=xdr_u_long
+_xdr_u_short=xdr_u_short
+_xdr_union=xdr_union
+_xdr_vector=xdr_vector
+_xdr_void=xdr_void
+_xdr_wrapstring=xdr_wrapstring
+_xdrmem_create=xdrmem_create
+_xdrrec_create=xdrrec_create
+_xdrrec_endofrecord=xdrrec_endofrecord
+_xdrrec_eof=xdrrec_eof
+_xdrrec_skiprecord=xdrrec_skiprecord
+_xdrstdio_create=xdrstdio_create
+_xprt_register=xprt_register
+_xprt_unregister=xprt_unregister
+__thr_svc_fdset=_thr_svc_fdset
+__thr_rpc_createerr=_thr_rpc_createerr
+__thr_null_auth=_thr_null_auth
#define auth_destroy(auth) \
((*((auth)->ah_ops->ah_destroy))(auth))
+/*
#ifdef WIN32
#ifdef ONCRPCDLL
extern struct opaque_auth _null_auth;
#else
extern struct opaque_auth _null_auth;
#endif
-
+*/
+#define _null_auth (*_thr_null_auth())
/*
* These are the various implementations of client side authenticators.
/*
* If a creation fails, the following allows the user to figure out why.
*/
-struct rpc_createerr {
+struct rpc_createerr_t {
enum clnt_stat cf_stat;
struct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */
};
+/*
#ifdef WIN32
#ifdef ONCRPCDLL
extern struct rpc_createerr rpc_createerr;
#else
extern struct rpc_createerr rpc_createerr;
#endif
-
+*/
+#define rpc_createerr (*_thr_rpc_createerr())
/*
* Copy error message to buffer.
#define clnttcp_create onc_clnttcp_create
#define clnt_spcreateerror onc_clnt_spcreateerror
-
-#define svcfd_create onc_svcfd_create
#define svc_register onc_svc_register
#define svc_getreqset onc_svc_getreqset
+#define svcfd_create onc_svcfd_create
#ifndef FD_SETSIZE
# define FD_SETSIZE 1024
#endif
+
#ifdef WIN32
#include <stdlib.h>
#include <rpc/svc.h> /* service manager and multiplexer */
#include <rpc/svc_auth.h> /* service side authenticator */
-/*
- * COMMENT OUT THE NEXT INCLUDE IF RUNNING ON SUN OS OR ON A VERSION
- * OF UNIX BASED ON NFSSRC. These systems will already have the structures
- * defined by <rpc/netdb.h> included in <netdb.h>.
- */
-/* routines for parsing /etc/rpc */
-#include <rpc/netdb.h> /* structures and routines to parse /etc/rpc */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Oct 2004: Additions by Scott Cantor to support POSIX and Win32 threads. */
+#ifdef WIN32
+extern DWORD __thr_key;
+extern CRITICAL_SECTION __thr_mutex;
+#else
+extern pthread_mutex_t __thr_mutex;
+#endif
+
+extern struct opaque_auth* _thr_null_auth(void);
+extern struct rpc_createerr_t* _thr_rpc_createerr(void);
+extern fd_set* _thr_svc_fdset(void);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* ndef __RPC_HEADER__ */
* dynamic; must be inspected before each call to select
*/
#ifdef FD_SETSIZE
-#ifdef WIN32
-#ifdef ONCRPCDLL
-extern fd_set onc_svc_fdset;
-#else
-#ifdef __BORLANDC__
-extern __import fd_set onc_svc_fdset;
-#else
-_declspec(dllimport) fd_set onc_svc_fdset;
-#endif
-#endif
-#else
-extern fd_set onc_svc_fdset;
+#define svc_fdset (*_thr_svc_fdset())
+#ifndef WIN32
+#define svc_fds svc_fdset.fds_bits[0] /* compatibility */
#endif
-#define svc_fds onc_svc_fdset.fds_bits[0] /* compatibility */
#else
extern int svc_fds;
#endif /* def FD_SETSIZE */
* Mountain View, California 94043
*/
#include <rpc/rpc.h>
+#include <stdio.h>
/*
* This file should only contain common data (global data) that is exported
* by public interfaces
*/
-#if defined(WIN32) && defined(__BORLANDC__)
-__declspec(dllexport)
+
+/* modified by Scott Cantor to make global data per-thread */
+
+#ifndef WIN32
+#include <pthread.h>
+pthread_once_t __thr_onc_control = PTHREAD_ONCE_INIT; /* insures single execution */
+pthread_key_t __thr_key; /* pthread key */
+void _thr_onc_init(); /* creates pthread key */
+void _thr_onc_term(void*); /* key destructor function */
#endif
-struct opaque_auth _null_auth;
-#ifdef FD_SETSIZE
+
+/* these are only used in an out of memory situation... */
+static fd_set __g_svc_fdset;
+static struct opaque_auth __g_null_auth;
+static struct rpc_createerr_t __g_rpc_createerr_t;
+
+/* per-thread global variables encapsulated in one block, makes TLS mgmt easier */
+struct __thr_rpc_vars {
+ fd_set _svc_fdset;
+ struct opaque_auth __null_auth;
+ struct rpc_createerr_t _rpc_createerr_t;
+};
+
+#ifdef WIN32
+
+DWORD __thr_key;
+
+struct __thr_rpc_vars* _get_thr_rpc_vars()
+{
+ struct __thr_rpc_vars* ptr = TlsGetValue(__thr_key);
+
+ if (!ptr && (ptr=malloc(sizeof(struct __thr_rpc_vars)))) {
+ memset(ptr,0,sizeof(struct __thr_rpc_vars));
+ TlsSetValue(__thr_key, ptr);
+ }
+ else if (!ptr) {
+ nt_rpc_report("out of memory");
+ }
+ return ptr;
+}
+
+#else
+
+struct __thr_rpc_vars* _get_thr_rpc_vars()
+{
+ struct __thr_rpc_vars* ptr = NULL;
+
+ pthread_once(&__thr_onc_control, _thr_onc_init);
+ ptr = pthread_getspecific(__thr_key);
+ if (!ptr && (ptr=malloc(sizeof(struct __thr_rpc_vars)))) {
+ memset(ptr,0,sizeof(struct __thr_rpc_vars));
+ pthread_setspecific(__thr_key, ptr);
+ }
+ else if (!ptr) {
+ fprintf(stderr,"_get_thr_rpc_vars: out of memory");
+ }
+ return ptr;
+}
+
+void _thr_onc_init()
+{
+ pthread_key_create(&__thr_key, _thr_onc_term);
+}
+
+void _thr_onc_term(void* ptr)
+{
+ if (ptr)
+ free(ptr);
+}
+
+#endif
+
#if defined(WIN32) && defined(__BORLANDC__)
-__declspec(dllexport)
+#define ONC_EXPORT __declspec(dllexport)
+#else
+#define ONC_EXPORT
#endif
-fd_set onc_svc_fdset;
+
+ONC_EXPORT struct opaque_auth* _thr_null_auth(void)
+{
+ struct __thr_rpc_vars* ptr = _get_thr_rpc_vars();
+ return ptr ? &(ptr->__null_auth) : &__g_null_auth;
+}
+
+ONC_EXPORT struct rpc_createerr_t* _thr_rpc_createerr(void)
+{
+ struct __thr_rpc_vars* ptr = _get_thr_rpc_vars();
+ return ptr ? &(ptr->_rpc_createerr_t) : &__g_rpc_createerr_t;
+}
+
+#ifdef FD_SETSIZE
+
+ONC_EXPORT fd_set* _thr_svc_fdset(void)
+{
+ struct __thr_rpc_vars* ptr = _get_thr_rpc_vars();
+ return ptr ? &(ptr->_svc_fdset) : &__g_svc_fdset;
+}
+
#else
+
int svc_fds;
+
#endif /* def FD_SETSIZE */
-#if defined(WIN32) && defined(__BORLANDC__)
-__declspec(dllexport)
-#endif
-struct rpc_createerr rpc_createerr;
+
#include <sys/errno.h>
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
+#include <pthread.h>
+
+static pthread_mutex_t __thr_mutex = PTHREAD_MUTEX_INITIALIZER;
extern int errno;
#endif
SVCXPRT *xprt;
{
register int sock = xprt->xp_sock;
+#ifdef WIN32
+ EnterCriticalSection(&__thr_mutex);
+#else
+ pthread_mutex_lock(&__thr_mutex);
+#endif
#ifdef FD_SETSIZE
if (xports == NULL) {
}
- if (onc_svc_fdset.fd_count < FD_SETSIZE) {
+ if (svc_fdset.fd_count < FD_SETSIZE) {
xports[sock] = xprt;
- FD_SET(sock, &onc_svc_fdset);
+ FD_SET(sock, &svc_fdset);
} else {
char str[256];
#else
if (sock < FD_SETSIZE) {
xports[sock] = xprt;
- FD_SET(sock, &onc_svc_fdset);
+ FD_SET(sock, &svc_fdset);
}
#endif
#else
}
#endif /* def FD_SETSIZE */
+#ifdef WIN32
+ LeaveCriticalSection(&__thr_mutex);
+#else
+ pthread_mutex_unlock(&__thr_mutex);
+#endif
}
/*
SVCXPRT *xprt;
{
register int sock = xprt->xp_sock;
+#ifdef WIN32
+ EnterCriticalSection(&__thr_mutex);
+#else
+ pthread_mutex_lock(&__thr_mutex);
+#endif
#ifdef FD_SETSIZE
#ifdef WIN32
if ((xports[sock] == xprt)) {
xports[sock] = (SVCXPRT *)0;
- FD_CLR((unsigned)sock, &onc_svc_fdset);
+ FD_CLR((unsigned)sock, &svc_fdset);
#else
if ((sock < FD_SETSIZE) && (xports[sock] == xprt)) {
xports[sock] = (SVCXPRT *)0;
- FD_CLR(sock, &onc_svc_fdset);
+ FD_CLR(sock, &svc_fdset);
#endif
}
#else
svc_fds &= ~(1 << sock);
}
#endif /* def FD_SETSIZE */
+
+#ifdef WIN32
+ LeaveCriticalSection(&__thr_mutex);
+#else
+ pthread_mutex_unlock(&__thr_mutex);
+#endif
}
for ( i=0; i<readfds->fd_count; i++ ) {
sock = readfds->fd_array[i];
/* sock has input waiting */
- xprt = xports[sock];
+ EnterCriticalSection(&__thr_mutex);
+ xprt = xports[sock];
+ LeaveCriticalSection(&__thr_mutex);
#else
setsize = FD_SETSIZE;
maskp = (u_long *)readfds->fds_bits;
for (sock = 0; sock < setsize; sock += NFDBITS) {
for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
/* sock has input waiting */
- xprt = xports[sock + bit - 1];
+ pthread_mutex_lock(&__thr_mutex);
+ xprt = xports[sock + bit - 1];
+ pthread_mutex_unlock(&__thr_mutex);
#endif
#else
for (sock = 0; readfds_local != 0; sock++, readfds_local >>= 1) {
if ((readfds_local & 1) != 0) {
/* sock has input waiting */
- xprt = xports[sock];
+ pthread_mutex_lock(&__thr_mutex);
+ xprt = xports[sock];
+ pthread_mutex_unlock(&__thr_mutex);
#endif /* def FD_SETSIZE */
/* now receive msgs from xprtprt (support batch calls) */
do {
for (;;) {
#ifdef FD_SETSIZE
- readfds = onc_svc_fdset;
+ readfds = svc_fdset;
#else
readfds = svc_fds;
#endif /* def FD_SETSIZE */
* xdr.
*/
+// eventually we might be able to support autoconf via cygwin...
+#if defined (_MSC_VER) || defined(__BORLANDC__)
+# include "config_win32.h"
+#else
+# include "config.h"
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
#include <stdio.h>
#ifndef WIN32
void *malloc();
* This routine works on Suns (Sky / 68000's) and Vaxen.
*/
-#ifdef vax
+#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
+ defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \
+ defined(__arm__) || defined(__ppc__) || defined(__ia64__) || \
+ defined(__arm26__) || defined(__sparc64__) || defined(__amd64__) || \
+ defined(WIN32)
+#define IEEEFP
+#endif
+
+#if defined(__vax__)
/* What IEEE single precision floating point looks like on a Vax */
struct ieee_single {
register float *fp;
{
-#ifdef WIN32
-#ifdef _PPC_
-/*Motorola PowerPC is same endian for NT as Intel so...*/
-#define _X86_
-#endif
-
-#ifdef _ALPHA_
-/*also DEC ALPHA is same endian for NT as Intel so...*/
-#define _X86_
-#endif
-#endif
-
-#if !defined(mc68000) && !defined(sparc) && !defined(mips) && !defined(mmax) && !defined(_X86_)
+#ifndef IEEEFP
struct ieee_single is;
struct vax_single vs, *vsp;
struct sgl_limits *lim;
switch (xdrs->x_op) {
case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc) || defined(mips) || defined(mmax) || defined(_X86_)
- return (XDR_PUTLONG(xdrs, (long *)fp));
+#ifdef IEEEFP
+ return (XDR_PUTLONG(xdrs, (int32_t *)fp));
#else
vs = *((struct vax_single *)fp);
for (i = 0, lim = sgl_limits;
#endif
case XDR_DECODE:
-#if defined(mc68000) || defined(sparc) || defined(mips) || defined(mmax) || defined(_X86_)
- return (XDR_GETLONG(xdrs, (long *)fp));
+#ifdef IEEEFP
+ return (XDR_GETLONG(xdrs, (int32_t *)fp));
#else
vsp = (struct vax_single *)fp;
if (!XDR_GETLONG(xdrs, (long *)&is))
* This routine works on Suns (Sky / 68000's) and Vaxen.
*/
-#ifdef vax
+#if defined(__vax__)
/* What IEEE double precision floating point looks like on a Vax */
struct ieee_double {
unsigned int mantissa1 : 20;
register XDR *xdrs;
double *dp;
{
- register long *lp;
-#if !defined(mc68000) && !defined(sparc) && !defined(mips) && !defined(mmax) && !defined(_X86_)
- struct ieee_double id;
- struct vax_double vd;
- register struct dbl_limits *lim;
- int i;
+#ifdef IEEEFP
+ int32_t *i32p;
+ bool_t rv;
+#else
+ int32_t *lp;
+ struct ieee_double id;
+ struct vax_double vd;
+ struct dbl_limits *lim;
+ int i;
#endif
-
switch (xdrs->x_op) {
case XDR_ENCODE:
-#if defined(mc68000) || defined(sparc) || defined(mips) || defined(mmax) || defined(_X86_)
- lp = (long *)dp;
+#ifdef IEEEFP
+ i32p = (int32_t *)(void *)dp;
+#if BYTE_ORDER == BIG_ENDIAN
+ rv = XDR_PUTLONG(xdrs, i32p);
+ if (!rv)
+ return (rv);
+ rv = XDR_PUTLONG(xdrs, i32p+1);
+#else
+ rv = XDR_PUTLONG(xdrs, i32p+1);
+ if (!rv)
+ return (rv);
+ rv = XDR_PUTLONG(xdrs, i32p);
+#endif
+ return (rv);
#else
vd = *((struct vax_double *)dp);
for (i = 0, lim = dbl_limits;
shipit:
id.sign = vd.sign;
lp = (long *)&id;
-#endif
-#if defined(_X86_)
- return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp));
-#else
- return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp));
+ return (XDR_PUTINT32(xdrs, lp++) && XDR_PUTINT32(xdrs, lp));
#endif
case XDR_DECODE:
-#if defined(mc68000) || defined(sparc) || defined(mips) || defined(mmax) || defined(_X86_)
- lp = (long *)dp;
-#if defined(_X86_)
- return (XDR_GETLONG(xdrs, lp+1) && XDR_GETLONG(xdrs, lp));
+#ifdef IEEEFP
+ i32p = (int32_t *)(void *)dp;
+#if BYTE_ORDER == BIG_ENDIAN
+ rv = XDR_GETLONG(xdrs, i32p);
+ if (!rv)
+ return (rv);
+ rv = XDR_GETLONG(xdrs, i32p+1);
#else
- return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp));
+ rv = XDR_GETLONG(xdrs, i32p+1);
+ if (!rv)
+ return (rv);
+ rv = XDR_GETLONG(xdrs, i32p);
#endif
+ return (rv);
#else
lp = (long *)&id;
if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp))