about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>1999-04-08 02:10:39 +0000
committerAndreas Schwab <schwab@suse.de>1999-04-08 02:10:39 +0000
commit50f301a819f48c6e64232f2cd22d8e77f59d0f29 (patch)
tree9a387001ce142a37230f98423cf5db120b6653d5
parent516d718a39eb540abca2915499b925962886ded9 (diff)
downloadglibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.tar.gz
glibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.tar.xz
glibc-50f301a819f48c6e64232f2cd22d8e77f59d0f29.zip
1999-04-01 Thorsten Kukuk <kukuk@suse.de>
	* sunrpc/Versions: Add new xdr functions to GLIBC_2.1.1
	* sunrpc/xdr.c: Add xdr_hyper, xdr_u_hyper, xdr_longlong_t and
	xdr_u_longlong_t. Based on patch from Dan Shechter
	<damageboy@isdn.net.il>.
	* sunrpc/xdr_intXX_t.c: Implement xdr_int64_t, xdr_uint64_t
	* sunrpc/rpc/xdr.h: Add prototypes for new xdr functions.

	* nis/nis_lookup.c (nis_lookup): Don't overwrite RPC error code.
-rw-r--r--ChangeLog11
-rw-r--r--FAQ.in4
-rw-r--r--nis/nis_lookup.c5
-rw-r--r--sunrpc/Versions4
-rw-r--r--sunrpc/rpc/xdr.h10
-rw-r--r--sunrpc/xdr.c106
-rw-r--r--sunrpc/xdr_intXX_t.c60
7 files changed, 169 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index c963092e73..9182567d04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+1999-04-01  Thorsten Kukuk  <kukuk@suse.de>
+
+	* sunrpc/Versions: Add new xdr functions to GLIBC_2.1.1
+	* sunrpc/xdr.c: Add xdr_hyper, xdr_u_hyper, xdr_longlong_t and
+	xdr_u_longlong_t. Based on patch from Dan Shechter
+	<damageboy@isdn.net.il>.
+	* sunrpc/xdr_intXX_t.c: Implement xdr_int64_t, xdr_uint64_t
+	* sunrpc/rpc/xdr.h: Add prototypes for new xdr functions.
+
+	* nis/nis_lookup.c (nis_lookup): Don't overwrite RPC error code.
+
 1999-04-07  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
 
 	* sysdeps/unix/sysv/linux/getdents.c (__getdirentries): Return
diff --git a/FAQ.in b/FAQ.in
index b0d5d0c14d..8786c4d64f 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -641,7 +641,7 @@ copy a NIS_COLD_START file from a Solaris client (the NIS_COLD_START file is
 byte order independent) or generate it with nisinit from the nis-tools
 package; available at
 
-    http://www-vt.uni-paderborn.de/~kukuk/linux/nisplus.html
+    http://www.suse.de/~kukuk/linux/nisplus.html
 
 ??	I have killed ypbind to stop using NIS, but glibc
 	continues using NIS.
@@ -1422,7 +1422,7 @@ Answers were given by:
 {PB} Phil Blundell, <Philip.Blundell@pobox.com>
 {MK} Mark Kettenis, <kettenis@phys.uva.nl>
 {ZW} Zack Weinberg, <zack@rabi.phys.columbia.edu>
-{TK} Thorsten Kukuk, <kukuk@vt.uni-paderborn.de>
+{TK} Thorsten Kukuk, <kukuk@suse.de>
 {GK} Geoffrey Keating, <geoffk@ozemail.com.au>
 {HJ} H.J. Lu, <hjl@gnu.org>
 {CG} Cristian Gafton, <gafton@redhat.com>
diff --git a/nis/nis_lookup.c b/nis/nis_lookup.c
index e194b977e4..4eed61ecdc 100644
--- a/nis/nis_lookup.c
+++ b/nis/nis_lookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@uni-paderborn.de>, 1997.
 
@@ -103,6 +103,8 @@ nis_lookup (const_nis_name name, const unsigned int flags)
 	    status = NIS_RPCERROR;
 	  else
 	    {
+	      status = NIS_SUCCESS;
+
 	      if (NIS_RES_STATUS (res) == NIS_SUCCESS)
 		{
 		    if (__type_of(NIS_RES_OBJECT (res)) == NIS_LINK_OBJ &&
@@ -171,7 +173,6 @@ nis_lookup (const_nis_name name, const unsigned int flags)
 	      break;
 	    }
 	  link_first_try = 0; /* Set it back */
-	  status= NIS_SUCCESS;
 	}
       while ((flags & HARD_LOOKUP) && status == NIS_RPCERROR);
 
diff --git a/sunrpc/Versions b/sunrpc/Versions
index 21df89b458..1d90bbeaaf 100644
--- a/sunrpc/Versions
+++ b/sunrpc/Versions
@@ -103,4 +103,8 @@ libc {
     xdr_key_netstres; xdr_keybuf; xdr_keystatus; xdr_netnamestr; xdr_sizeof;
     xdr_uint16_t; xdr_uint32_t; xdr_uint8_t; xdr_unixcred;
   }
+  GLIBC_2.1.1 {
+    xdr_hyper; xdr_u_hyper; xdr_longlong_t; xdr_u_longlong_t;
+    xdr_int64_t; xdr_uint64_t;
+  }
 }
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index 8e74d3cd7f..44bad8a337 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -290,18 +290,24 @@ struct xdr_discrim
  * also, the XDR structure is always updated by some of these calls.
  */
 extern bool_t xdr_void __P ((void));
+extern bool_t xdr_short __P ((XDR *__xdrs, short *__sp));
+extern bool_t xdr_u_short __P ((XDR *__xdrs, u_short *__usp));
 extern bool_t xdr_int __P ((XDR *__xdrs, int *__ip));
 extern bool_t xdr_u_int __P ((XDR *__xdrs, u_int *__up));
 extern bool_t xdr_long __P ((XDR *__xdrs, long *__lp));
 extern bool_t xdr_u_long __P ((XDR *__xdrs, u_long *__ulp));
-extern bool_t xdr_short __P ((XDR *__xdrs, short *__sp));
-extern bool_t xdr_u_short __P ((XDR *__xdrs, u_short *__usp));
+extern bool_t xdr_hyper __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_hyper __P ((XDR *__xdrs, u_quad_t *__ullp));
+extern bool_t xdr_longlong_t __P ((XDR *__xdrs, quad_t *__llp));
+extern bool_t xdr_u_longlong_t __P ((XDR *__xdrs, u_quad_t *__ullp));
 extern bool_t xdr_int8_t __P ((XDR *__xdrs, int8_t *__ip));
 extern bool_t xdr_uint8_t __P ((XDR *__xdrs, uint8_t *__up));
 extern bool_t xdr_int16_t __P ((XDR *__xdrs, int16_t *__ip));
 extern bool_t xdr_uint16_t __P ((XDR *__xdrs, uint16_t *__up));
 extern bool_t xdr_int32_t __P ((XDR *__xdrs, int32_t *__ip));
 extern bool_t xdr_uint32_t __P ((XDR *__xdrs, uint32_t *__up));
+extern bool_t xdr_int64_t __P ((XDR *__xdrs, int64_t *__ip));
+extern bool_t xdr_uint64_t __P ((XDR *__xdrs, uint64_t *__up));
 extern bool_t xdr_bool __P ((XDR *__xdrs, bool_t *__bp));
 extern bool_t xdr_enum __P ((XDR *__xdrs, enum_t *__ep));
 extern bool_t xdr_array __P ((XDR * _xdrs, caddr_t *__addrp, u_int *__sizep,
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index 57552c4427..6f1aed742f 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -193,12 +193,87 @@ xdr_u_long (XDR *xdrs, u_long *ulp)
 }
 
 /*
+ * XDR hyper integers
+ * same as xdr_u_hyper - open coded to save a proc call!
+ */
+bool_t
+xdr_hyper (XDR *xdrs, quad_t *llp)
+{
+  long t1;
+  long t2;
+
+  if (xdrs->x_op == XDR_ENCODE)
+    {
+      t1 = (long) ((*llp) >> 32);
+      t2 = (long) (*llp);
+      return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+    }
+
+  if (xdrs->x_op == XDR_DECODE)
+    {
+      if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+	return FALSE;
+      *llp = ((quad_t) t1) << 32;
+      *llp |= t2;
+      return TRUE;
+    }
+
+  if (xdrs->x_op == XDR_FREE)
+    return TRUE;
+
+  return FALSE;
+}
+
+
+/*
+ * XDR hyper integers
+ * same as xdr_hyper - open coded to save a proc call!
+ */
+bool_t
+xdr_u_hyper (XDR *xdrs, u_quad_t *ullp)
+{
+  unsigned long t1;
+  unsigned long t2;
+
+  if (xdrs->x_op == XDR_ENCODE)
+    {
+      t1 = (unsigned long) ((*ullp) >> 32);
+      t2 = (unsigned long) (*ullp);
+      return (XDR_PUTLONG(xdrs, &t1) && XDR_PUTLONG(xdrs, &t2));
+    }
+
+  if (xdrs->x_op == XDR_DECODE)
+    {
+      if (!XDR_GETLONG(xdrs, &t1) || !XDR_GETLONG(xdrs, &t2))
+	return FALSE;
+      *ullp = ((u_quad_t) t1) << 32;
+      *ullp |= t2;
+      return TRUE;
+    }
+
+  if (xdrs->x_op == XDR_FREE)
+    return TRUE;
+
+  return FALSE;
+}
+
+bool_t
+xdr_longlong_t (XDR *xdrs, quad_t *llp)
+{
+  return xdr_hyper (xdrs, llp);
+}
+
+bool_t
+xdr_u_longlong_t (XDR *xdrs, u_quad_t *ullp)
+{
+  return xdr_u_hyper (xdrs, ullp);
+}
+
+/*
  * XDR short integers
  */
 bool_t
-xdr_short (xdrs, sp)
-     XDR *xdrs;
-     short *sp;
+xdr_short (XDR *xdrs, short *sp)
 {
   long l;
 
@@ -226,9 +301,7 @@ xdr_short (xdrs, sp)
  * XDR unsigned short integers
  */
 bool_t
-xdr_u_short (xdrs, usp)
-     XDR *xdrs;
-     u_short *usp;
+xdr_u_short (XDR *xdrs, u_short *usp)
 {
   u_long l;
 
@@ -257,9 +330,7 @@ xdr_u_short (xdrs, usp)
  * XDR a char
  */
 bool_t
-xdr_char (xdrs, cp)
-     XDR *xdrs;
-     char *cp;
+xdr_char (XDR *xdrs, char *cp)
 {
   int i;
 
@@ -276,9 +347,7 @@ xdr_char (xdrs, cp)
  * XDR an unsigned char
  */
 bool_t
-xdr_u_char (xdrs, cp)
-     XDR *xdrs;
-     u_char *cp;
+xdr_u_char (XDR *xdrs, u_char *cp)
 {
   u_int u;
 
@@ -295,9 +364,7 @@ xdr_u_char (xdrs, cp)
  * XDR booleans
  */
 bool_t
-xdr_bool (xdrs, bp)
-     XDR *xdrs;
-     bool_t *bp;
+xdr_bool (XDR *xdrs, bool_t *bp)
 {
   long lb;
 
@@ -325,9 +392,7 @@ xdr_bool (xdrs, bp)
  * XDR enumerations
  */
 bool_t
-xdr_enum (xdrs, ep)
-     XDR *xdrs;
-     enum_t *ep;
+xdr_enum (XDR *xdrs, enum_t *ep)
 {
   enum sizecheck
     {
@@ -379,10 +444,7 @@ xdr_enum (xdrs, ep)
  * cp points to the opaque object and cnt gives the byte length.
  */
 bool_t
-xdr_opaque (xdrs, cp, cnt)
-     XDR *xdrs;
-     caddr_t cp;
-     u_int cnt;
+xdr_opaque (XDR *xdrs, caddr_t cp, u_int cnt)
 {
   u_int rndup;
   static char crud[BYTES_PER_XDR_UNIT];
diff --git a/sunrpc/xdr_intXX_t.c b/sunrpc/xdr_intXX_t.c
index 98132cd802..e50859e2aa 100644
--- a/sunrpc/xdr_intXX_t.c
+++ b/sunrpc/xdr_intXX_t.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -20,6 +20,60 @@
 #include <rpc/types.h>
 #include <rpc/xdr.h>
 
+/* XDR 64bit integers */
+bool_t
+xdr_int64_t (XDR *xdrs, int64_t *ip)
+{
+  int32_t t1;
+  int32_t t2;
+
+  switch (xdrs->x_op)
+    {
+    case XDR_ENCODE:
+      t1 = (int32_t) ((*ip) >> 32);
+      t2 = (int32_t) (*ip);
+      return (XDR_PUTINT32(xdrs, &t1) && XDR_PUTINT32(xdrs, &t2));
+    case XDR_DECODE:
+      if (!XDR_GETINT32(xdrs, &t1) || !XDR_GETINT32(xdrs, &t2))
+        return FALSE;
+      *ip = ((int64_t) t1) << 32;
+      *ip |= t2;
+      return TRUE;
+    case XDR_FREE:
+      return TRUE;
+    default:
+      return FALSE;
+    }
+}
+
+/* XDR 64bit unsigned integers */
+bool_t
+xdr_uint64_t (XDR *xdrs, uint64_t *uip)
+{
+  uint32_t t1;
+  uint32_t t2;
+
+  switch (xdrs->x_op)
+    {
+    case XDR_ENCODE:
+      t1 = (uint32_t) ((*uip) >> 32);
+      t2 = (uint32_t) (*uip);
+      return (XDR_PUTINT32 (xdrs, (int32_t *) &t1) &&
+	      XDR_PUTINT32(xdrs, (int32_t *) &t2));
+    case XDR_DECODE:
+      if (!XDR_GETINT32(xdrs, (int32_t *) &t1) ||
+	  !XDR_GETINT32(xdrs, (int32_t *) &t2))
+        return FALSE;
+      *uip = ((uint64_t) t1) << 32;
+      *uip |= t2;
+      return TRUE;
+    case XDR_FREE:
+      return TRUE;
+    default:
+      return FALSE;
+    }
+}
+
 /* XDR 32bit integers */
 bool_t
 xdr_int32_t (XDR *xdrs, int32_t *lp)
@@ -43,10 +97,10 @@ xdr_uint32_t (XDR *xdrs, uint32_t *ulp)
 {
   switch (xdrs->x_op)
     {
-    case XDR_DECODE:
-      return XDR_GETINT32 (xdrs, (int32_t *) ulp);
     case XDR_ENCODE:
       return XDR_PUTINT32 (xdrs, (int32_t *) ulp);
+    case XDR_DECODE:
+      return XDR_GETINT32 (xdrs, (int32_t *) ulp);
     case XDR_FREE:
       return TRUE;
     default: