This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.12-137-g2f3e3dc


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  2f3e3dc75f36367b71873eb6dda62effa5f9cd6d (commit)
      from  f3dcc2f9a52e46ecf1e7df18863e1ffea62ba37d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2f3e3dc75f36367b71873eb6dda62effa5f9cd6d

commit 2f3e3dc75f36367b71873eb6dda62effa5f9cd6d
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Wed Sep 1 04:12:55 2010 -0700

    Remove duplicate version of pmap_getport from NIS code.

diff --git a/ChangeLog b/ChangeLog
index 834be75..4fdec2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* sunrpc/pm_getport.c (__libc_rpc_getport): New function.  This is
+	mainly the body of pmap_getport.  Add parameters to specify timeouts.
+	(pmap_getport): Use __libc_rpc_getport.
+	* sunrpc/Versions: Export __libc_rpc_getport with GLIBC_PRIVATE.
+	* include/rpc/pmap_clnt.h: Declare __libc_rpc_getport.
+	* nis/nis_findserv.c: Remove pmap_getport copy. Use __libc_rpc_getport.
+
 2010-08-31  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* sysdeps/unix/sysv/linux/powerpc/powerpc32/syscalls.list: Add
diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h
index 9a22082..b9a7063 100644
--- a/include/rpc/pmap_clnt.h
+++ b/include/rpc/pmap_clnt.h
@@ -8,5 +8,10 @@ libc_hidden_proto (pmap_unset)
 /* Defined in pm_getport.c.  */
 extern int __get_socket (struct sockaddr_in *saddr)
      attribute_hidden internal_function;
+extern u_short __libc_rpc_getport (struct sockaddr_in *address, u_long program,
+				   u_long version, u_int protocol,
+				   time_t timeout_sec, time_t tottimeout_sec)
+     internal_function;
+libc_hidden_proto (__libc_rpc_getport)
 
 #endif
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index 472a2bf..b1a9aa7 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 2000, 2001, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -47,15 +47,6 @@ struct cu_data
   };
 
 
-/* The following is the original routine from sunrpc/pm_getport.c.
-   The only change is the much shorter timeout. */
-/*
- * pmap_getport.c
- * Client interface to pmap rpc service.
- *
- * Copyright (C) 1984, Sun Microsystems, Inc.
- */
-
 /*
  * Find the mapped port for program,version.
  * Calls the pmap service remotely to do the lookup.
@@ -65,39 +56,7 @@ u_short
 __pmap_getnisport (struct sockaddr_in *address, u_long program,
 		   u_long version, u_int protocol)
 {
-  const struct timeval timeout = {1, 0};
-  const struct timeval tottimeout = {1, 0};
-  u_short port = 0;
-  int socket = -1;
-  CLIENT *client;
-  struct pmap parms;
-
-  address->sin_port = htons (PMAPPORT);
-  client = clntudp_bufcreate (address, PMAPPROG, PMAPVERS, timeout, &socket,
-			      RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
-  if (client != (CLIENT *) NULL)
-    {
-      parms.pm_prog = program;
-      parms.pm_vers = version;
-      parms.pm_prot = protocol;
-      parms.pm_port = 0;	/* not needed or used */
-      if (CLNT_CALL (client, PMAPPROC_GETPORT, (xdrproc_t) xdr_pmap,
-		     (caddr_t) & parms, (xdrproc_t) xdr_u_short,
-		     (caddr_t) & port, tottimeout) != RPC_SUCCESS)
-	{
-	  rpc_createerr.cf_stat = RPC_PMAPFAILURE;
-	  clnt_geterr (client, &rpc_createerr.cf_error);
-	}
-      else
-	{
-	  if (port == 0)
-	    rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
-	}
-      CLNT_DESTROY (client);
-    }
-  /* (void)close(socket); CLNT_DESTROY already closed it */
-  address->sin_port = 0;
-  return port;
+  return __libc_rpc_getport (address, program, version, protocol, 1, 1);
 }
 
 /* This is now the public function, which should find the fastest server */
diff --git a/sunrpc/Versions b/sunrpc/Versions
index d2d8e81..a11dd8d 100644
--- a/sunrpc/Versions
+++ b/sunrpc/Versions
@@ -117,6 +117,6 @@ libc {
     xdr_quad_t; xdr_u_quad_t;
   }
   GLIBC_PRIVATE {
-    __libc_clntudp_bufcreate;
+    __libc_clntudp_bufcreate; __libc_rpc_getport;
   }
 }
diff --git a/sunrpc/pm_getport.c b/sunrpc/pm_getport.c
index 66340c0..da34776 100644
--- a/sunrpc/pm_getport.c
+++ b/sunrpc/pm_getport.c
@@ -39,11 +39,6 @@
 #include <rpc/pmap_clnt.h>
 #include <sys/socket.h>
 
-static const struct timeval timeout =
-{5, 0};
-static const struct timeval tottimeout =
-{60, 0};
-
 /*
  * Create a socket that is locally bound to a non-reserve port. For
  * any failures, -1 is returned which will cause the RPC code to
@@ -81,16 +76,24 @@ __get_socket (struct sockaddr_in *saddr)
 
 /*
  * Find the mapped port for program,version.
+ * Internal version with additional parameters.
  * Calls the pmap service remotely to do the lookup.
  * Returns 0 if no map exists.
  */
 u_short
-pmap_getport (address, program, version, protocol)
+internal_function
+__libc_rpc_getport (address, program, version, protocol, timeout_sec,
+		    tottimeout_sec)
      struct sockaddr_in *address;
      u_long program;
      u_long version;
      u_int protocol;
+     time_t timeout_sec;
+     time_t tottimeout_sec;
 {
+  const struct timeval timeout = {timeout_sec, 0};
+  const struct timeval tottimeout = {tottimeout_sec, 0};
+
   u_short port = 0;
   int socket = -1;
   CLIENT *client;
@@ -137,4 +140,21 @@ pmap_getport (address, program, version, protocol)
   address->sin_port = 0;
   return port;
 }
+libc_hidden_def (__libc_rpc_getport)
+
+
+/*
+ * Find the mapped port for program,version.
+ * Calls the pmap service remotely to do the lookup.
+ * Returns 0 if no map exists.
+ */
+u_short
+pmap_getport (address, program, version, protocol)
+     struct sockaddr_in *address;
+     u_long program;
+     u_long version;
+     u_int protocol;
+{
+  return __libc_rpc_getport (address, program, version, protocol, 5, 60);
+}
 libc_hidden_def (pmap_getport)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog               |    9 +++++++++
 include/rpc/pmap_clnt.h |    5 +++++
 nis/nis_findserv.c      |   45 ++-------------------------------------------
 sunrpc/Versions         |    2 +-
 sunrpc/pm_getport.c     |   32 ++++++++++++++++++++++++++------
 5 files changed, 43 insertions(+), 50 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]