Date: Thu, 30 Aug 2012 20:30:09 GMT From: Pedro Giffuni <pfg@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/137443: [headers] Including /usr/include/rpc/xdr.h fails with C++ Message-ID: <201208302030.q7UKU9PB056572@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/137443; it has been noted by GNATS.
From: Pedro Giffuni <pfg@FreeBSD.org>
To: bug-followup@FreeBSD.org, stast@bsdportal.ru
Cc:
Subject: Re: kern/137443: [headers] Including /usr/include/rpc/xdr.h fails
with C++
Date: Thu, 30 Aug 2012 15:21:11 -0500
This is a multi-part message in MIME format.
--------------040301090709070801000904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
This patch should fix it.
I will be reviewing other RPC headers as well.
Pedro.
--------------040301090709070801000904
Content-Type: text/plain; charset=UTF-8;
name="patch-c++-xdr.h.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="patch-c++-xdr.h.txt"
Index: include/rpc/xdr.h
===================================================================
--- include/rpc/xdr.h (revision 239918)
+++ include/rpc/xdr.h (working copy)
@@ -43,6 +43,10 @@
#define _RPC_XDR_H
#include <sys/cdefs.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* XDR provides a conventional way for converting between C data
* types and an external bit-string representation. Library supplied
@@ -97,26 +101,26 @@
* an operations vector for the particular implementation (e.g. see xdr_mem.c),
* and two private fields for the use of the particular implementation.
*/
-typedef struct __rpc_xdr {
+typedef struct XDR {
enum xdr_op x_op; /* operation; fast additional param */
const struct xdr_ops {
/* get a long from underlying stream */
- bool_t (*x_getlong)(struct __rpc_xdr *, long *);
+ bool_t (*x_getlong)(struct XDR *, long *);
/* put a long to " */
- bool_t (*x_putlong)(struct __rpc_xdr *, const long *);
+ bool_t (*x_putlong)(struct XDR *, const long *);
/* get some bytes from " */
- bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int);
+ bool_t (*x_getbytes)(struct XDR *, char *, u_int);
/* put some bytes to " */
- bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, u_int);
+ bool_t (*x_putbytes)(struct XDR *, const char *, u_int);
/* returns bytes off from beginning */
- u_int (*x_getpostn)(struct __rpc_xdr *);
+ u_int (*x_getpostn)(struct XDR *);
/* lets you reposition the stream */
- bool_t (*x_setpostn)(struct __rpc_xdr *, u_int);
+ bool_t (*x_setpostn)(struct XDR *, u_int);
/* buf quick ptr to buffered data */
- int32_t *(*x_inline)(struct __rpc_xdr *, u_int);
+ int32_t *(*x_inline)(struct XDR *, u_int);
/* free privates of this xdr_stream */
- void (*x_destroy)(struct __rpc_xdr *);
- bool_t (*x_control)(struct __rpc_xdr *, int, void *);
+ void (*x_destroy)(struct XDR *);
+ bool_t (*x_control)(struct XDR *, int, void *);
} *x_ops;
char * x_public; /* users' data */
void * x_private; /* pointer to private data */
@@ -366,4 +370,8 @@
extern u_int xdrrec_readbytes(XDR *, caddr_t, u_int);
__END_DECLS
+#ifdef __cplusplus
+}
+#endif
+
#endif /* !_RPC_XDR_H */
--------------040301090709070801000904--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208302030.q7UKU9PB056572>
