Index: cpukit/librpc/src/xdr/xdr.c
===================================================================
--- cpukit/librpc/src/xdr/xdr.c	(revision df49c60c9671e4a28e636964d744c1f59fb6cb68)
+++ cpukit/librpc/src/xdr/xdr.c	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -51,4 +51,8 @@
 #include <rpc/xdr.h>
 
+#if defined(__rtems__)
+#define warnx(msg) fprintf(stderr, msg "\n");
+#endif
+
 /*
  * constants specific to the xdr "protocol"
@@ -61,5 +65,5 @@
  * for unit alignment
  */
-static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
+static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
 
 /*
@@ -117,4 +121,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -146,4 +151,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -156,5 +162,5 @@
 bool_t
 xdr_long(xdrs, lp)
-	register XDR *xdrs;
+	XDR *xdrs;
 	long *lp;
 {
@@ -167,5 +173,5 @@
 		return (TRUE);
 	}
-
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -177,5 +183,5 @@
 bool_t
 xdr_u_long(xdrs, ulp)
-	register XDR *xdrs;
+	XDR *xdrs;
 	u_long *ulp;
 {
@@ -188,4 +194,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -198,5 +205,5 @@
 bool_t
 xdr_int32_t(xdrs, int32_p)
-	register XDR *xdrs;
+	XDR *xdrs;
 	int32_t *int32_p;
 {
@@ -219,4 +226,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -228,5 +236,5 @@
 bool_t
 xdr_u_int32_t(xdrs, u_int32_p)
-	register XDR *xdrs;
+	XDR *xdrs;
 	u_int32_t *u_int32_p;
 {
@@ -253,66 +261,9 @@
 
 /*
- * 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
  */
 bool_t
 xdr_short(xdrs, sp)
-	register XDR *xdrs;
+	XDR *xdrs;
 	short *sp;
 {
@@ -335,4 +286,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -343,5 +295,5 @@
 bool_t
 xdr_u_short(xdrs, usp)
-	register XDR *xdrs;
+	XDR *xdrs;
 	u_short *usp;
 {
@@ -364,4 +316,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -373,5 +326,5 @@
 bool_t
 xdr_int16_t(xdrs, int16_p)
-	register XDR *xdrs;
+	XDR *xdrs;
 	int16_t *int16_p;
 {
@@ -394,4 +347,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -402,5 +356,5 @@
 bool_t
 xdr_u_int16_t(xdrs, u_int16_p)
-	register XDR *xdrs;
+	XDR *xdrs;
 	u_int16_t *u_int16_p;
 {
@@ -423,4 +377,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -468,5 +423,5 @@
 bool_t
 xdr_bool(xdrs, bp)
-	register XDR *xdrs;
+	XDR *xdrs;
 	bool_t *bp;
 {
@@ -489,4 +444,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -529,9 +485,9 @@
 bool_t
 xdr_opaque(xdrs, cp, cnt)
-	register XDR *xdrs;
+	XDR *xdrs;
 	caddr_t cp;
-	register u_int cnt;
-{
-	register u_int rndup;
+	u_int cnt;
+{
+	u_int rndup;
 	static int crud[BYTES_PER_XDR_UNIT];
 
@@ -581,11 +537,11 @@
 bool_t
 xdr_bytes(xdrs, cpp, sizep, maxsize)
-	register XDR *xdrs;
+	XDR *xdrs;
 	char **cpp;
-	register u_int *sizep;
+	u_int *sizep;
 	u_int maxsize;
 {
-	register char *sp = *cpp;  /* sp is the actual string pointer */
-	register u_int nodesize;
+	char *sp = *cpp;  /* sp is the actual string pointer */
+	u_int nodesize;
 
 	/*
@@ -610,11 +566,11 @@
 		}
 		if (sp == NULL) {
-			*cpp = sp = (char *)mem_alloc(nodesize);
+			*cpp = sp = mem_alloc(nodesize);
 		}
 		if (sp == NULL) {
-			(void) fprintf(stderr, "xdr_bytes: out of memory\n");
-			return (FALSE);
-		}
-		/* fall into ... */
+			warnx("xdr_bytes: out of memory");
+			return (FALSE);
+		}
+		/* FALLTHROUGH */
 
 	case XDR_ENCODE:
@@ -628,4 +584,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -656,11 +613,11 @@
 bool_t
 xdr_union(xdrs, dscmp, unp, choices, dfault)
-	register XDR *xdrs;
+	XDR *xdrs;
 	enum_t *dscmp;		/* enum to decide which arm to work on */
 	char *unp;		/* the union itself */
-	struct xdr_discrim *choices;	/* [value, xdr proc] for each arm */
+	const struct xdr_discrim *choices;	/* [value, xdr proc] for each arm */
 	xdrproc_t dfault;	/* default xdr routine */
 {
-	register enum_t dscm;
+	enum_t dscm;
 
 	/*
@@ -705,9 +662,9 @@
 bool_t
 xdr_string(xdrs, cpp, maxsize)
-	register XDR *xdrs;
+	XDR *xdrs;
 	char **cpp;
 	u_int maxsize;
 {
-	register char *sp = *cpp;  /* sp is the actual string pointer */
+	char *sp = *cpp;  /* sp is the actual string pointer */
 	u_int size;
 	u_int nodesize;
@@ -721,9 +678,9 @@
 			return(TRUE);	/* already free */
 		}
-		/* fall through... */
+		/* FALLTHROUGH */
 	case XDR_ENCODE:
 		size = strlen(sp);
 		break;
-	case XDR_DECODE:  /* to avoid warning */
+	case XDR_DECODE:
 		break;
 	}
@@ -746,11 +703,11 @@
 		}
 		if (sp == NULL)
-			*cpp = sp = (char *)mem_alloc(nodesize);
+			*cpp = sp = mem_alloc(nodesize);
 		if (sp == NULL) {
-			(void) fprintf(stderr, "xdr_string: out of memory\n");
+			warnx("xdr_string: out of memory");
 			return (FALSE);
 		}
 		sp[size] = 0;
-		/* fall into ... */
+		/* FALLTHROUGH */
 
 	case XDR_ENCODE:
@@ -762,4 +719,5 @@
 		return (TRUE);
 	}
+	/* NOTREACHED */
 	return (FALSE);
 }
@@ -776,2 +734,125 @@
 	return xdr_string(xdrs, cpp, LASTUNSIGNED);
 }
+
+/*
+ * XDR 64-bit integers
+ */
+bool_t
+xdr_int64_t(xdrs, int64_p)
+	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);
+	}
+	/* NOTREACHED */
+	return (FALSE);
+}
+
+
+/*
+ * XDR unsigned 64-bit integers
+ */
+bool_t
+xdr_u_int64_t(xdrs, uint64_p)
+	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);
+	}
+	/* NOTREACHED */
+	return (FALSE);
+}
+
+/* FIXME: RTEMS does not support u_longlong_t and longlong_t, yet */
+#if !defined(__rtems__)
+/*
+ * XDR hypers
+ */
+bool_t
+xdr_hyper(xdrs, llp)
+	XDR *xdrs;
+	longlong_t *llp;
+{
+
+	/*
+	 * Don't bother open-coding this; it's a fair amount of code.  Just
+	 * call xdr_int64_t().
+	 */
+	return (xdr_int64_t(xdrs, (int64_t *)llp));
+}
+
+
+/*
+ * XDR unsigned hypers
+ */
+bool_t
+xdr_u_hyper(xdrs, ullp)
+	XDR *xdrs;
+	u_longlong_t *ullp;
+{
+
+	/*
+	 * Don't bother open-coding this; it's a fair amount of code.  Just
+	 * call xdr_u_int64_t().
+	 */
+	return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
+}
+
+
+/*
+ * XDR longlong_t's
+ */
+bool_t
+xdr_longlong_t(xdrs, llp)
+	XDR *xdrs;
+	longlong_t *llp;
+{
+
+	/*
+	 * Don't bother open-coding this; it's a fair amount of code.  Just
+	 * call xdr_int64_t().
+	 */
+	return (xdr_int64_t(xdrs, (int64_t *)llp));
+}
+
+
+/*
+ * XDR u_longlong_t's
+ */
+bool_t
+xdr_u_longlong_t(xdrs, ullp)
+	XDR *xdrs;
+	u_longlong_t *ullp;
+{
+
+	/*
+	 * Don't bother open-coding this; it's a fair amount of code.  Just
+	 * call xdr_u_int64_t().
+	 */
+	return (xdr_u_int64_t(xdrs, (u_int64_t *)ullp));
+}
+#endif
