[uClibc-cvs] svn commit: trunk/uClibc: extra/Configs libc/inet/rpc

vapier at uclibc.org vapier at uclibc.org
Thu Aug 18 01:18:24 UTC 2005


Author: vapier
Date: 2005-08-17 19:18:24 -0600 (Wed, 17 Aug 2005)
New Revision: 11200

Log:
add support for getrpcbynumber_r/getrpcbyname_r/getrpcent_r and a config option to enable REENTRANT RPC

Modified:
   trunk/uClibc/extra/Configs/Config.in
   trunk/uClibc/libc/inet/rpc/rcmd.c


Changeset:
Modified: trunk/uClibc/extra/Configs/Config.in
===================================================================
--- trunk/uClibc/extra/Configs/Config.in	2005-08-18 01:16:25 UTC (rev 11199)
+++ trunk/uClibc/extra/Configs/Config.in	2005-08-18 01:18:24 UTC (rev 11200)
@@ -552,6 +552,15 @@
 	  nfs mounts to work.  If you find you need the rest of the RPC stuff,
 	  then enable this option.  Most people can safely answer N.
 
+config UCLIBC_HAS_REENTRANT_RPC
+	bool "Reentrant RPC support"
+	depends on UCLIBC_HAS_RPC
+	default y if !HAVE_SHARED
+	help
+	  Most packages utilize the normal (non-reentrant) RPC functions, but 
+	  some (like exportfs from nfs-utils) need these reentrant versions.  
+	  Most people can safely answer N.
+
 endmenu
 
 

Modified: trunk/uClibc/libc/inet/rpc/rcmd.c
===================================================================
--- trunk/uClibc/libc/inet/rpc/rcmd.c	2005-08-18 01:16:25 UTC (rev 11199)
+++ trunk/uClibc/libc/inet/rpc/rcmd.c	2005-08-18 01:18:24 UTC (rev 11200)
@@ -57,12 +57,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#ifdef __UCLIBC_HAS_THREADS__
-#undef __UCLIBC_HAS_THREADS__
-#warning FIXME I am not reentrant yet...
-#endif
 
-
 /* some forward declarations */
 static int __ivaliduser2(FILE *hostf, u_int32_t raddr,
 			 const char *luser, const char *ruser, const char *rhost);
@@ -76,13 +71,13 @@
      const char *locuser, *remuser, *cmd;
      int *fd2p;
 {
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	int herr;
-        struct hostent hostbuf;
+	struct hostent hostbuf;
 	size_t hstbuflen;
 	char *tmphstbuf;
 #endif
-        struct hostent *hp;
+	struct hostent *hp;
 	struct sockaddr_in sin, from;
 	struct pollfd pfd[2];
 	int32_t oldmask;
@@ -92,7 +87,7 @@
 
 	pid = getpid();
 
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	hstbuflen = 1024;
 #ifdef __ARCH_HAS_MMU__
 	tmphstbuf = alloca (hstbuflen);
@@ -299,14 +294,14 @@
         struct hostent *hp;
 	u_int32_t addr;
 	char **ap;
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	size_t buflen;
 	char *buffer;
 	int herr;
 	struct hostent hostbuf;
 #endif
 
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	buflen = 1024;
 #ifdef __ARCH_HAS_MMU__
 	buffer = alloca (buflen);
@@ -432,7 +427,7 @@
 		size_t dirlen;
 		uid_t uid;
 
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 		size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
 		struct passwd pwdbuf;
 #ifdef __ARCH_HAS_MMU__
@@ -515,7 +510,7 @@
 	int negate=1;    /* Multiply return with this to get -1 instead of 1 */
 	char **pp;
 
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	int save_errno;
 	size_t buflen;
 	char *buffer;
@@ -545,7 +540,7 @@
 		return negate * (! (raddr ^ laddr));
 
 	/* Better be a hostname. */
-#ifdef __UCLIBC_HAS_THREADS__
+#ifdef __UCLIBC_HAS_REENTRANT_RPC__
 	buflen = 1024;
 	buffer = malloc(buflen);
 	save_errno = errno;
@@ -559,7 +554,7 @@
 	__set_errno (save_errno);
 #else
 	hp = gethostbyname(lhost);
-#endif /* __UCLIBC_HAS_THREADS__ */
+#endif /* __UCLIBC_HAS_REENTRANT_RPC__ */
 
 	if (hp == NULL)
 		return 0;




More information about the uClibc-cvs mailing list