Index: cpukit/ChangeLog
===================================================================
--- cpukit/ChangeLog	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/ChangeLog	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -1,2 +1,9 @@
+2005-01-07	Ralf Corsepius <ralf.corsepius@rtems.org>
+
+	* librpc/include/rpc/auth_des.h, librpc/include/rpc/xdr.h,
+	librpc/src/rpc/auth_des.c, librpc/src/rpc/auth_unix.c,
+	librpc/src/rpc/rpc_prot.c, librpc/src/xdr/xdr.c:
+	Misc. ansi-fications, misc. updates from FreeBSD.
+
 2005-01-07	Joel Sherrill <joel@OARcorp.com>
 
Index: cpukit/librpc/include/rpc/auth_des.h
===================================================================
--- cpukit/librpc/include/rpc/auth_des.h	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/librpc/include/rpc/auth_des.h	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -104,5 +104,5 @@
 
 __BEGIN_DECLS
-extern int authdes_getucred __P(( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * ));
+extern int authdes_getucred ( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );
 __END_DECLS
 
Index: cpukit/librpc/include/rpc/xdr.h
===================================================================
--- cpukit/librpc/include/rpc/xdr.h	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/librpc/include/rpc/xdr.h	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -1,2 +1,4 @@
+/*	$NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $	*/
+
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -29,5 +31,5 @@
  *	from: @(#)xdr.h 1.19 87/04/22 SMI
  *	from: @(#)xdr.h	2.2 88/07/29 4.0 RPCSRC
- * $FreeBSD: src/include/rpc/xdr.h,v 1.14 1999/12/29 05:00:44 peter Exp $
+ * $FreeBSD: src/include/rpc/xdr.h,v 1.23 2003/03/07 13:19:40 nectar Exp $
  */
 
@@ -100,24 +102,24 @@
 	struct xdr_ops {
 		/* get a long from underlying stream */
-		bool_t	(*x_getlong) (struct __rpc_xdr *, long *);
+		bool_t	(*x_getlong)(struct __rpc_xdr *, long *);
 		/* put a long to underlying stream */
-		bool_t	(*x_putlong) (struct __rpc_xdr *, long *);
+		bool_t	(*x_putlong)(struct __rpc_xdr *, const long *);
 		/* get some bytes from underlying stream */
-		bool_t	(*x_getbytes) (struct __rpc_xdr *, caddr_t, u_int);
+		bool_t	(*x_getbytes)(struct __rpc_xdr *, char *, u_int);
 		/* put some bytes to underlying stream */
-		bool_t	(*x_putbytes) (struct __rpc_xdr *, caddr_t, u_int);
+		bool_t	(*x_putbytes)(struct __rpc_xdr *, const char *, u_int);
 		/* returns bytes off from beginning */
-		u_int	(*x_getpostn) (struct __rpc_xdr *);
+		u_int	(*x_getpostn)(struct __rpc_xdr *);
 		/* lets you reposition the stream */
-		bool_t  (*x_setpostn) (struct __rpc_xdr *, u_int);
+		bool_t  (*x_setpostn)(struct __rpc_xdr *, u_int);
 		/* buf quick ptr to buffered data */
-		int32_t *(*x_inline) (struct __rpc_xdr *, u_int);
+		int32_t *(*x_inline)(struct __rpc_xdr *, u_int);
 		/* free privates of this xdr_stream */
-		void	(*x_destroy) (struct __rpc_xdr *);
+		void	(*x_destroy)(struct __rpc_xdr *);
 	} *x_ops;
-	caddr_t 	x_public;	/* users' data */
-	caddr_t		x_private;	/* pointer to private data */
-	caddr_t 	x_base;		/* private used for position info */
-	int		x_handy;	/* extra private word */
+	char *	 	x_public;	/* users' data */
+	void *		x_private;	/* pointer to private data */
+	char *	 	x_base;		/* private used for position info */
+	u_int		x_handy;	/* extra private word */
 } XDR;
 
@@ -186,5 +188,5 @@
  * Support struct for discriminated unions.
  * You create an array of xdrdiscrim structures, terminated with
- * a entry with a null procedure pointer.  The xdr_union routine gets
+ * an entry with a null procedure pointer.  The xdr_union routine gets
  * the discriminant value and then searches the array of structures
  * for a matching value.  If a match is found the associated xdr routine
@@ -233,34 +235,34 @@
  */
 __BEGIN_DECLS
-extern bool_t	xdr_void	(void);
-extern bool_t	xdr_int		(XDR *, int *);
-extern bool_t	xdr_u_int	(XDR *, u_int *);
-extern bool_t	xdr_long	(XDR *, long *);
-extern bool_t	xdr_u_long	(XDR *, u_long *);
-extern bool_t	xdr_short	(XDR *, short *);
-extern bool_t	xdr_u_short	(XDR *, u_short *);
-extern bool_t	xdr_int16_t	(XDR *, int16_t *);
-extern bool_t	xdr_u_int16_t	(XDR *, u_int16_t *);
-extern bool_t	xdr_int32_t	(XDR *, int32_t *);
-extern bool_t	xdr_u_int32_t	(XDR *, u_int32_t *);
-extern bool_t	xdr_int64_t	(XDR *, int64_t *);
-extern bool_t	xdr_u_int64_t	(XDR *, u_int64_t *);
-extern bool_t	xdr_bool	(XDR *, bool_t *);
-extern bool_t	xdr_enum	(XDR *, enum_t *);
-extern bool_t	xdr_array	(XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
-extern bool_t	xdr_bytes	(XDR *, char **, u_int *, u_int);
-extern bool_t	xdr_opaque	(XDR *, caddr_t, u_int);
-extern bool_t	xdr_string	(XDR *, char **, u_int);
-extern bool_t	xdr_union	(XDR *, enum_t *, char *, struct xdr_discrim *, xdrproc_t);
+extern bool_t	xdr_void(void);
+extern bool_t	xdr_int(XDR *, int *);
+extern bool_t	xdr_u_int(XDR *, u_int *);
+extern bool_t	xdr_long(XDR *, long *);
+extern bool_t	xdr_u_long(XDR *, u_long *);
+extern bool_t	xdr_short(XDR *, short *);
+extern bool_t	xdr_u_short(XDR *, u_short *);
+extern bool_t	xdr_int16_t(XDR *, int16_t *);
+extern bool_t	xdr_u_int16_t(XDR *, u_int16_t *);
+extern bool_t	xdr_int32_t(XDR *, int32_t *);
+extern bool_t	xdr_u_int32_t(XDR *, u_int32_t *);
+extern bool_t	xdr_int64_t(XDR *, int64_t *);
+extern bool_t	xdr_u_int64_t(XDR *, u_int64_t *);
+extern bool_t	xdr_bool(XDR *, bool_t *);
+extern bool_t	xdr_enum(XDR *, enum_t *);
+extern bool_t	xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t);
+extern bool_t	xdr_bytes(XDR *, char **, u_int *, u_int);
+extern bool_t	xdr_opaque(XDR *, caddr_t, u_int);
+extern bool_t	xdr_string(XDR *, char **, u_int);
+extern bool_t	xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t);
 extern unsigned long	xdr_sizeof (xdrproc_t, void *);
-extern bool_t	xdr_char	(XDR *, char *);
-extern bool_t	xdr_u_char	(XDR *, u_char *);
-extern bool_t	xdr_vector	(XDR *, char *, u_int, u_int, xdrproc_t);
-extern bool_t	xdr_float	(XDR *, float *);
-extern bool_t	xdr_double	(XDR *, double *);
-extern bool_t	xdr_reference	(XDR *, caddr_t *, u_int, xdrproc_t);
-extern bool_t	xdr_pointer	(XDR *, caddr_t *, u_int, xdrproc_t);
-extern bool_t	xdr_wrapstring	(XDR *, char **);
-extern void	xdr_free 	(xdrproc_t, char *);
+extern bool_t	xdr_char(XDR *, char *);
+extern bool_t	xdr_u_char(XDR *, u_char *);
+extern bool_t	xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);
+extern bool_t	xdr_float(XDR *, float *);
+extern bool_t	xdr_double(XDR *, double *);
+extern bool_t	xdr_reference(XDR *, caddr_t *, u_int, xdrproc_t);
+extern bool_t	xdr_pointer(XDR *, caddr_t *, u_int, xdrproc_t);
+extern bool_t	xdr_wrapstring(XDR *, char **);
+extern void	xdr_free(xdrproc_t, char *);
 __END_DECLS
 
@@ -275,5 +277,5 @@
 };
 typedef struct netobj netobj;
-extern bool_t   xdr_netobj (XDR *, struct netobj *);
+extern bool_t   xdr_netobj(XDR *, struct netobj *);
 
 /*
@@ -283,24 +285,24 @@
 __BEGIN_DECLS
 /* XDR using memory buffers */
-extern void   xdrmem_create	(XDR *, char *, u_int, enum xdr_op);
-
+extern void   xdrmem_create(XDR *, char *, u_int, enum xdr_op);
+
+/* XDR using stdio library */
 #ifdef _STDIO_H_
-/* XDR using stdio library */
-extern void   xdrstdio_create	(XDR *, FILE *, enum xdr_op);
+extern void   xdrstdio_create(XDR *, FILE *, enum xdr_op);
 #endif
 
 /* XDR pseudo records for tcp */
-extern void   xdrrec_create	(XDR *, u_int, u_int, char *,
+extern void   xdrrec_create(XDR *, u_int, u_int, char *,
 				int (*) (caddr_t, caddr_t, int),
 				int (*) (caddr_t, caddr_t, int));
 
 /* make end of xdr record */
-extern bool_t xdrrec_endofrecord (XDR *, bool_t);
+extern bool_t xdrrec_endofrecord(XDR *, bool_t);
 
 /* move to beginning of next record */
-extern bool_t xdrrec_skiprecord	(XDR *);
+extern bool_t xdrrec_skiprecord(XDR *);
 
 /* true if no more input */
-extern bool_t xdrrec_eof	(XDR *);
+extern bool_t xdrrec_eof(XDR *);
 __END_DECLS
 
Index: cpukit/librpc/src/rpc/auth_des.c
===================================================================
--- cpukit/librpc/src/rpc/auth_des.c	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/librpc/src/rpc/auth_des.c	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -52,11 +52,5 @@
 #endif
 
-extern bool_t __rpc_get_time_offset __P(( struct timeval *, nis_server *,
-						char *, char **, struct sockaddr_in * ));
-extern int rtime __P(( struct sockaddr_in *, struct timeval *, struct timeval *));
-extern bool_t xdr_authdes_cred __P(( XDR *, struct authdes_cred * ));
-extern bool_t xdr_authdes_verf __P(( XDR *, struct authdes_verf * ));
-
-#define MILLION		1000000L
+#define USEC_PER_SEC		1000000L
 #define RTIME_TIMEOUT 5		/* seconds to wait for sync */
 
@@ -66,4 +60,10 @@
 #define ATTEMPT(xdr_op)		if (!(xdr_op)) return (FALSE)
 
+extern int rtime( struct sockaddr_in *, struct timeval *, struct timeval *);
+extern bool_t xdr_authdes_cred(XDR *, struct authdes_cred *);
+extern bool_t xdr_authdes_verf(XDR *, struct authdes_verf *);
+
+extern bool_t __rpc_get_time_offset( struct timeval *, nis_server *, char *,
+	char **, struct sockaddr_in * );
 #define debug(msg)		 /*printf("%s\n", msg) */
 
@@ -71,9 +71,9 @@
  * DES authenticator operations vector
  */
-static void	authdes_nextverf();
-static bool_t	authdes_marshal();
-static bool_t	authdes_validate();
-static bool_t	authdes_refresh();
-static void	authdes_destroy();
+static void	authdes_nextverf(AUTH *);
+static bool_t	authdes_marshal(AUTH *, XDR *);
+static bool_t	authdes_validate(AUTH *, struct opaque_auth *);
+static bool_t	authdes_refresh(AUTH *);
+static void	authdes_destroy(AUTH *);
 static struct auth_ops authdes_ops = {
 	authdes_nextverf,
@@ -314,6 +314,5 @@
 /*ARGSUSED*/
 static void
-authdes_nextverf(auth)
-	AUTH *auth;
+authdes_nextverf(AUTH *auth)
 {
 	/* what the heck am I supposed to do??? */
@@ -326,7 +325,5 @@
  */
 static bool_t
-authdes_marshal(auth, xdrs)
-	AUTH *auth;
-	XDR *xdrs;
+authdes_marshal(AUTH *auth, XDR *xdrs)
 {
 	struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -346,6 +343,6 @@
 	ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
 	ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
-	if (ad->ad_timestamp.tv_usec >= MILLION) {
-		ad->ad_timestamp.tv_usec -= MILLION;
+	if (ad->ad_timestamp.tv_usec >= USEC_PER_SEC) {
+		ad->ad_timestamp.tv_usec -= USEC_PER_SEC;
 		ad->ad_timestamp.tv_sec += 1;
 	}
@@ -417,7 +414,5 @@
  */
 static bool_t
-authdes_validate(auth, rverf)
-	AUTH *auth;
-	struct opaque_auth *rverf;
+authdes_validate(AUTH *auth, struct opaque_auth *rverf)
 {
 	struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -473,6 +468,5 @@
  */
 static bool_t
-authdes_refresh(auth)
-	AUTH *auth;
+authdes_refresh(AUTH *auth)
 {
 	struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -513,6 +507,5 @@
  */
 static void
-authdes_destroy(auth)
-	AUTH *auth;
+authdes_destroy(AUTH *auth)
 {
 	struct ad_private *ad = AUTH_PRIVATE(auth);
@@ -547,5 +540,5 @@
 	if (mytime.tv_usec > timep->tv_usec) {
 		timep->tv_sec -= 1;
-		timep->tv_usec += MILLION;
+		timep->tv_usec += USEC_PER_SEC;
 	}
 	timep->tv_usec -= mytime.tv_usec;
Index: cpukit/librpc/src/rpc/auth_unix.c
===================================================================
--- cpukit/librpc/src/rpc/auth_unix.c	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/librpc/src/rpc/auth_unix.c	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -60,9 +60,9 @@
  * Unix authenticator operations vector
  */
-static void	authunix_nextverf();
-static bool_t	authunix_marshal();
-static bool_t	authunix_validate();
-static bool_t	authunix_refresh();
-static void	authunix_destroy();
+static void	authunix_nextverf(AUTH*);
+static bool_t	authunix_marshal(AUTH*, XDR*);
+static bool_t	authunix_validate(AUTH*, struct opaque_auth *);
+static bool_t	authunix_refresh(AUTH*);
+static void	authunix_destroy(AUTH*);
 
 static struct auth_ops auth_unix_ops = {
@@ -110,5 +110,5 @@
 	int uid;
 	int gid;
-	register int len;
+	int len;
 	int *aup_gids;
 {
@@ -219,6 +219,5 @@
 
 static void
-authunix_nextverf(auth)
-	AUTH *auth;
+authunix_nextverf(AUTH *auth)
 {
 	/* no action necessary */
@@ -226,9 +225,7 @@
 
 static bool_t
-authunix_marshal(auth, xdrs)
-	AUTH *auth;
-	XDR *xdrs;
-{
-	register struct audata *au = AUTH_PRIVATE(auth);
+authunix_marshal(AUTH *auth, XDR *xdrs)
+{
+	struct audata *au = AUTH_PRIVATE(auth);
 
 	return (XDR_PUTBYTES(xdrs, au->au_marshed, au->au_mpos));
@@ -236,14 +233,12 @@
 
 static bool_t
-authunix_validate(auth, verf)
-	register AUTH *auth;
-	struct opaque_auth verf;
+authunix_validate( AUTH *auth, struct opaque_auth *verf )
 {
 	register struct audata *au;
 	XDR xdrs;
 
-	if (verf.oa_flavor == AUTH_SHORT) {
+	if (verf->oa_flavor == AUTH_SHORT) {
 		au = AUTH_PRIVATE(auth);
-		xdrmem_create(&xdrs, verf.oa_base, verf.oa_length, XDR_DECODE);
+		xdrmem_create(&xdrs, verf->oa_base, verf->oa_length, XDR_DECODE);
 
 		if (au->au_shcred.oa_base != NULL) {
@@ -266,12 +261,11 @@
 
 static bool_t
-authunix_refresh(auth)
-	register AUTH *auth;
-{
-	register struct audata *au = AUTH_PRIVATE(auth);
+authunix_refresh(AUTH *auth)
+{
+	struct audata *au = AUTH_PRIVATE(auth);
 	struct authunix_parms aup;
 	struct timeval now;
 	XDR xdrs;
-	register int stat;
+	int stat;
 
 	if (auth->ah_cred.oa_base == au->au_origcred.oa_base) {
@@ -309,8 +303,7 @@
 
 static void
-authunix_destroy(auth)
-	register AUTH *auth;
-{
-	register struct audata *au = AUTH_PRIVATE(auth);
+authunix_destroy(AUTH *auth)
+{
+	struct audata *au = AUTH_PRIVATE(auth);
 
 	mem_free(au->au_origcred.oa_base, au->au_origcred.oa_length);
@@ -332,10 +325,9 @@
  */
 static void
-marshal_new_auth(auth)
-	register AUTH *auth;
+marshal_new_auth(AUTH *auth)
 {
 	XDR		xdr_stream;
-	register XDR	*xdrs = &xdr_stream;
-	register struct audata *au = AUTH_PRIVATE(auth);
+	XDR	*xdrs = &xdr_stream;
+	struct audata *au = AUTH_PRIVATE(auth);
 
 	xdrmem_create(xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
Index: cpukit/librpc/src/rpc/rpc_prot.c
===================================================================
--- cpukit/librpc/src/rpc/rpc_prot.c	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ cpukit/librpc/src/rpc/rpc_prot.c	(revision dab2d6ebae0b1f7d7b72ccafe42b729081409ff2)
@@ -51,7 +51,10 @@
 #include <rpc/rpc.h>
 
+static void accepted(enum accept_stat, struct rpc_err *);
+static void rejected(enum reject_stat, struct rpc_err *);
+
 /* * * * * * * * * * * * * * XDR Authentication * * * * * * * * * * * */
 
-struct opaque_auth _null_auth;
+extern struct opaque_auth _null_auth;
 
 /*
@@ -61,6 +64,6 @@
 bool_t
 xdr_opaque_auth(xdrs, ap)
-	register XDR *xdrs;
-	register struct opaque_auth *ap;
+	XDR *xdrs;
+	struct opaque_auth *ap;
 {
 
@@ -76,6 +79,6 @@
 bool_t
 xdr_des_block(xdrs, blkp)
-	register XDR *xdrs;
-	register des_block *blkp;
+	XDR *xdrs;
+	des_block *blkp;
 {
 	return (xdr_opaque(xdrs, (caddr_t)blkp, sizeof(des_block)));
@@ -89,6 +92,6 @@
 bool_t
 xdr_accepted_reply(xdrs, ar)
-	register XDR *xdrs;
-	register struct accepted_reply *ar;
+	XDR *xdrs;
+	struct accepted_reply *ar;
 {
 
@@ -107,5 +110,10 @@
 			return (FALSE);
 		return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
-	default:
+
+	case GARBAGE_ARGS:
+	case SYSTEM_ERR:
+	case PROC_UNAVAIL:
+	case PROG_UNAVAIL:
+/*	default: */
 		break;
 	}
@@ -118,6 +126,6 @@
 bool_t
 xdr_rejected_reply(xdrs, rr)
-	register XDR *xdrs;
-	register struct rejected_reply *rr;
+	XDR *xdrs;
+	struct rejected_reply *rr;
 {
 
@@ -138,7 +146,7 @@
 }
 
-static struct xdr_discrim reply_dscrm[3] = {
-	{ (int)MSG_ACCEPTED, xdr_accepted_reply },
-	{ (int)MSG_DENIED, xdr_rejected_reply },
+static const struct xdr_discrim reply_dscrm[3] = {
+	{ (int)MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply },
+	{ (int)MSG_DENIED, (xdrproc_t)xdr_rejected_reply },
 	{ __dontcare__, NULL_xdrproc_t } };
 
@@ -148,6 +156,6 @@
 bool_t
 xdr_replymsg(xdrs, rmsg)
-	register XDR *xdrs;
-	register struct rpc_msg *rmsg;
+	XDR *xdrs;
+	struct rpc_msg *rmsg;
 {
 	if (
@@ -168,6 +176,6 @@
 bool_t
 xdr_callhdr(xdrs, cmsg)
-	register XDR *xdrs;
-	register struct rpc_msg *cmsg;
+	XDR *xdrs;
+	struct rpc_msg *cmsg;
 {
 
@@ -188,6 +196,6 @@
 static void
 accepted(acpt_stat, error)
-	register enum accept_stat acpt_stat;
-	register struct rpc_err *error;
+	enum accept_stat acpt_stat;
+	struct rpc_err *error;
 {
 
@@ -226,6 +234,6 @@
 static void
 rejected(rjct_stat, error)
-	register enum reject_stat rjct_stat;
-	register struct rpc_err *error;
+	enum reject_stat rjct_stat;
+	struct rpc_err *error;
 {
 
@@ -253,6 +261,6 @@
 void
 _seterr_reply(msg, error)
-	register struct rpc_msg *msg;
-	register struct rpc_err *error;
+	struct rpc_msg *msg;
+	struct rpc_err *error;
 {
 
@@ -264,5 +272,5 @@
 			error->re_status = RPC_SUCCESS;
 			return;
-		};
+		}
 		accepted(msg->acpted_rply.ar_stat, error);
 		break;
@@ -292,4 +300,20 @@
 		error->re_vers.high = msg->acpted_rply.ar_vers.high;
 		break;
+
+	case RPC_FAILED:
+	case RPC_SUCCESS:
+	case RPC_PROGNOTREGISTERED:
+	case RPC_PMAPFAILURE:
+	case RPC_UNKNOWNPROTO:
+	case RPC_UNKNOWNHOST:
+	case RPC_SYSTEMERROR:
+	case RPC_CANTDECODEARGS:
+	case RPC_PROCUNAVAIL:
+	case RPC_PROGUNAVAIL:
+	case RPC_TIMEDOUT:
+	case RPC_CANTRECV:
+	case RPC_CANTSEND:
+	case RPC_CANTDECODERES:
+	case RPC_CANTENCODEARGS:
 	default:
 		break;
Index: cpukit/librpc/src/xdr/xdr.c
===================================================================
--- cpukit/librpc/src/xdr/xdr.c	(revision c9795bd69d5b636ecab41f4abf049ba8d7a4567a)
+++ 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
