summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1998-09-08 17:33:12 +0000
committerobrien <obrien@FreeBSD.org>1998-09-08 17:33:12 +0000
commitb0502cca708a846fcaa8653eee63191718f11433 (patch)
treed9b5aedeb1705a5ae08bdd4c565b16dc2209e9b1
parentd886019b37cf7a9d8cbde74e3434724b65f9870a (diff)
downloadFreeBSD-src-b0502cca708a846fcaa8653eee63191718f11433.zip
FreeBSD-src-b0502cca708a846fcaa8653eee63191718f11433.tar.gz
Add support for the RPC 64-bit integer type ``hyper''.
-rw-r--r--include/rpc/xdr.h4
-rw-r--r--lib/libc/xdr/xdr.c58
-rw-r--r--usr.bin/rpcgen/rpc_parse.c4
3 files changed, 62 insertions, 4 deletions
diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h
index aab60d9..39a52c2 100644
--- a/include/rpc/xdr.h
+++ b/include/rpc/xdr.h
@@ -28,7 +28,7 @@
*
* from: @(#)xdr.h 1.19 87/04/22 SMI
* from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC
- * $Id: xdr.h,v 1.5 1996/12/30 13:59:41 peter Exp $
+ * $Id: xdr.h,v 1.10 1997/05/28 04:45:15 wpaul Exp $
*/
/*
@@ -245,6 +245,8 @@ extern bool_t xdr_int16_t __P((XDR *, int16_t *));
extern bool_t xdr_u_int16_t __P((XDR *, u_int16_t *));
extern bool_t xdr_int32_t __P((XDR *, int32_t *));
extern bool_t xdr_u_int32_t __P((XDR *, u_int32_t *));
+extern bool_t xdr_int64_t __P((XDR *, int64_t *));
+extern bool_t xdr_u_int64_t __P((XDR *, u_int64_t *));
extern bool_t xdr_bool __P((XDR *, bool_t *));
extern bool_t xdr_enum __P((XDR *, enum_t *));
extern bool_t xdr_array __P((XDR *, char **, u_int *, u_int, u_int, xdrproc_t));
diff --git a/lib/libc/xdr/xdr.c b/lib/libc/xdr/xdr.c
index 12a787e..db99ce0 100644
--- a/lib/libc/xdr/xdr.c
+++ b/lib/libc/xdr/xdr.c
@@ -30,7 +30,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/
/*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/
-static char *rcsid = "$Id: xdr.c,v 1.4 1996/12/30 14:07:07 peter Exp $";
+static char *rcsid = "$Id: xdr.c,v 1.7 1997/05/28 04:57:30 wpaul Exp $";
#endif
/*
@@ -251,6 +251,62 @@ xdr_u_int32_t(xdrs, u_int32_p)
return (FALSE);
}
+/*
+ * XDR 64-bit integers
+ */
+bool_t
+xdr_int64_t(xdrs, int64_p)
+ register XDR *xdrs;
+ int64_t *int64_p;
+{
+ int64_t x;
+
+ switch (xdrs->x_op) {
+
+ case XDR_ENCODE:
+ return (xdr_opaque(xdrs, (caddr_t)int64_p, sizeof(int64_t)));
+
+ case XDR_DECODE:
+ if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
+ return (FALSE);
+ }
+ *int64_p = x;
+ return (TRUE);
+
+ case XDR_FREE:
+ return (TRUE);
+ }
+ return (FALSE);
+}
+
+/*
+ * XDR unsigned 64-bit integers
+ */
+bool_t
+xdr_u_int64_t(xdrs, uint64_p)
+ register XDR *xdrs;
+ u_int64_t *uint64_p;
+{
+ u_int64_t x;
+
+ switch (xdrs->x_op) {
+
+ case XDR_ENCODE:
+ return (xdr_opaque(xdrs, (caddr_t)uint64_p, sizeof(u_int64_t)));
+
+ case XDR_DECODE:
+ if (!xdr_opaque(xdrs, (caddr_t)&x, sizeof x)) {
+ return (FALSE);
+ }
+ *uint64_p = x;
+ return (TRUE);
+
+ case XDR_FREE:
+ return (TRUE);
+ }
+ return (FALSE);
+}
+
/*
* XDR short integers
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
index 5431520..1d952cc 100644
--- a/usr.bin/rpcgen/rpc_parse.c
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -593,7 +593,7 @@ get_type(prefixp, typep, dkind)
(void) peekscan(TOK_INT, &tok);
break;
case TOK_HYPER:
- *typep = "longlong_t";
+ *typep = "int64_t";
(void) peekscan(TOK_INT, &tok);
break;
@@ -642,7 +642,7 @@ unsigned_dec(typep)
break;
case TOK_HYPER:
get_token(&tok);
- *typep = "ulonglong_t";
+ *typep = "u_int64_t";
(void) peekscan(TOK_INT, &tok);
break;
case TOK_INT:
OpenPOWER on IntegriCloud