summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-08-11 17:36:12 -0700
committerHarshavardhana <harsha@harshavardhana.net>2014-08-15 12:22:11 -0700
commita42ea55a0062ea7c39a9e0390f13e8cb16a914aa (patch)
tree0232e5333bf376164798505d4f6bc20187fdb8ed /rpc
parent873e9870c8cf8926b6a9aa43bbbb7d76b0994cc1 (diff)
porting: OSX/Darwin 10.9 porting issues
xdrproc_t() arguments are variadic and non-variadic On OSX > 10.9 ------------- typedef bool_t (*xdrproc_t)(XDR *, void *, unsigned int); On OSX < 10.9 ------------ typedef bool_t (*xdrproc_t)(XDR *, ...); FreeBSD all versions ------------ typedef bool_t (*xdrproc_t)(XDR *, ...); NetBSD 6.1.4 ----------- typedef bool_t (*xdrproc_t)(XDR *, const void *); Linux all versions ----------- typedef bool_t (*xdrproc_t)(XDR *, void *,...); This weird and odd implementations across various platforms should be handled properly. Change-Id: I49fab73cba0d965c78c71da1beba1ffb2d58b8f8 BUG: 1130307 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/8488 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'rpc')
-rw-r--r--rpc/xdr/src/xdr-generic.c8
-rw-r--r--rpc/xdr/src/xdr-generic.h28
2 files changed, 32 insertions, 4 deletions
diff --git a/rpc/xdr/src/xdr-generic.c b/rpc/xdr/src/xdr-generic.c
index 58d1ee77ee2..fd6fceb9425 100644
--- a/rpc/xdr/src/xdr-generic.c
+++ b/rpc/xdr/src/xdr-generic.c
@@ -24,7 +24,7 @@ xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc)
xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len,
XDR_ENCODE);
- if (!proc (&xdr, res)) {
+ if (!PROC(&xdr, res)) {
ret = -1;
goto ret;
}
@@ -48,8 +48,8 @@ xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc)
xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
XDR_DECODE);
- if (!proc (&xdr, args)) {
- ret = -1;
+ if (!PROC (&xdr, args)) {
+ ret = -1;
goto ret;
}
@@ -72,7 +72,7 @@ xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc,
xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len,
XDR_DECODE);
- if (!proc (&xdr, args)) {
+ if (!PROC (&xdr, args)) {
ret = -1;
goto ret;
}
diff --git a/rpc/xdr/src/xdr-generic.h b/rpc/xdr/src/xdr-generic.h
index 2547d7e545d..2f12290ef02 100644
--- a/rpc/xdr/src/xdr-generic.h
+++ b/rpc/xdr/src/xdr-generic.h
@@ -24,6 +24,34 @@
#define XDR_BYTES_PER_UNIT 4
+/*
+ On OSX > 10.9
+ -------------
+ typedef bool_t (*xdrproc_t)(XDR *, void *, unsigned int);
+
+ On OSX < 10.9
+ ------------
+ typedef bool_t (*xdrproc_t)(XDR *, ...);
+
+ FreeBSD all versions
+ ------------
+ typedef bool_t (*xdrproc_t)(XDR *, ...);
+
+ NetBSD 6.1.4
+ -----------
+ typedef bool_t (*xdrproc_t)(XDR *, const void *);
+
+ Linux all versions
+ -----------
+ typedef bool_t (*xdrproc_t)(XDR *, void *,...);
+*/
+
+#if defined(__NetBSD__)
+#define PROC(xdr, res) proc(xdr, res)
+#else
+#define PROC(xdr, res) proc(xdr, res, 0)
+#endif
+
ssize_t
xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc);