This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add XDR support (only built #if cygwin, for now)


Corinna Vinschen wrote:
> On Feb 26 20:01, Charles Wilson wrote:
>> Charles Wilson wrote:
>>> The attached patch(es) add XDR support to newlib. eXternal Data
>> This update is in response to the previous discussion.
> 
> Thanks.  I applied the patch with these patches.  I just forgot to
> regenerate Makefile.in in the first go, so I added it in a second
> checkin.

Thanks. I had a few extant changes I had not yet published -- typos,
grammatical fixes in README, etc.

Also, I was unsure about whether the new header files should include the
RPC declarations, so that the same XDR header files could be used
directly by external RPC implementations.  The attached patch adds the
public ones.

Finally, when rebuilding, I found a thinko in xdr/Makefile.am:
"EXTRA_SOURCES" is a bad name -- automake gives the following warnings:
xdr/Makefile.am:20: variable `EXTRA_SOURCES' is defined but no program or
xdr/Makefile.am:20: library has `EXTRA' as canonical name (possible typo)

why this is a problem, but GENERAL_SOURCES and ELIX_SOURCES are not, I
don't know, but the attached fixes both that and regenerates xdr/Makefile.in

2010-03-02  Charles Wilson  <...>

	* libc/xdr/README: Correct grammatical errors.
	* libc/include/rpc/types.h: Add public types used
	by RPC implementations.
	* libc/include/rpc/xdr.h: Add defines used by RPC
	implementations.
	* libc/xdr/Makefile.am: Eliminate automake warning.
	* libc/xdr/Makefile.in: Regenerate.

--
Chuck

Index: libc/include/rpc/types.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/rpc/types.h,v
retrieving revision 1.1
diff -u -p -r1.1 types.h
--- libc/include/rpc/types.h	2 Mar 2010 12:05:14 -0000	1.1
+++ libc/include/rpc/types.h	2 Mar 2010 13:50:09 -0000
@@ -52,6 +52,12 @@ typedef int64_t   quad_t;
 typedef int32_t   bool_t;
 typedef int32_t   enum_t;
 
+typedef u_int32_t rpcprog_t;
+typedef u_int32_t rpcvers_t;
+typedef u_int32_t rpcproc_t;
+typedef u_int32_t rpcprot_t;
+typedef u_int32_t rpcport_t;
+typedef   int32_t rpc_inline_t;
 
 #ifndef NULL
 # define NULL 0
Index: libc/include/rpc/xdr.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/rpc/xdr.h,v
retrieving revision 1.1
diff -u -p -r1.1 xdr.h
--- libc/include/rpc/xdr.h	2 Mar 2010 12:05:14 -0000	1.1
+++ libc/include/rpc/xdr.h	2 Mar 2010 13:50:09 -0000
@@ -224,6 +224,16 @@ typedef bool_t _EXFNPTR(xdrproc_t, (XDR 
     } while (0)
 
 /*
+ * Solaris strips the '_t' from these types -- not sure why.
+ * But, let's be compatible.
+ */
+#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
+#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
+#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
+#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
+#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
+
+/*
  * Support struct for discriminated unions.
  * You create an array of xdrdiscrim structures, terminated with
  * an entry with a null procedure pointer.  The xdr_union routine gets
Index: libc/xdr/Makefile.am
===================================================================
RCS file: /cvs/src/src/newlib/libc/xdr/Makefile.am,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile.am
--- libc/xdr/Makefile.am	2 Mar 2010 12:05:18 -0000	1.1
+++ libc/xdr/Makefile.am	2 Mar 2010 13:50:12 -0000
@@ -17,7 +17,7 @@ GENERAL_SOURCES = \
 STDIO_SOURCES = \
   xdr_stdio.c
 
-EXTRA_SOURCES = \
+EXTRA_SRC = \
   xdr_float_vax.c
 
 ## None of these functions are specified by EL/IX
@@ -43,7 +43,7 @@ endif
 endif
 endif
 
-EXTRA_DIST = README $(EXTRA_SOURCES)
+EXTRA_DIST = README $(EXTRA_SRC)
 
 libxdr_la_LDFLAGS = -Xcompiler -nostdlib
 
Index: libc/xdr/Makefile.in
===================================================================
RCS file: /cvs/src/src/newlib/libc/xdr/Makefile.in,v
retrieving revision 1.2
diff -u -p -r1.2 Makefile.in
--- libc/xdr/Makefile.in	2 Mar 2010 12:21:52 -0000	1.2
+++ libc/xdr/Makefile.in	2 Mar 2010 13:50:12 -0000
@@ -253,7 +253,7 @@ GENERAL_SOURCES = \
 STDIO_SOURCES = \
   xdr_stdio.c
 
-EXTRA_SOURCES = \
+EXTRA_SRC = \
   xdr_float_vax.c
 
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@ELIX_SOURCES = $(GENERAL_SOURCES)
@@ -262,7 +262,7 @@ EXTRA_SOURCES = \
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_SOURCES = 
 @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_SOURCES = 
 @ELIX_LEVEL_1_TRUE@ELIX_SOURCES = 
-EXTRA_DIST = README $(EXTRA_SOURCES)
+EXTRA_DIST = README $(EXTRA_SRC)
 libxdr_la_LDFLAGS = -Xcompiler -nostdlib
 @USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libxdr.la
 @USE_LIBTOOL_TRUE@libxdr_la_SOURCES = dummy.c $(ELIX_SOURCES)
Index: libc/xdr/README
===================================================================
RCS file: /cvs/src/src/newlib/libc/xdr/README,v
retrieving revision 1.1
diff -u -p -r1.1 README
--- libc/xdr/README	2 Mar 2010 12:05:18 -0000	1.1
+++ libc/xdr/README	2 Mar 2010 13:50:12 -0000
@@ -1,9 +1,10 @@
 INTRODUCTION
 ======================
-This directory contains a port of the Sun RPC code (derived
-from the relicensed -- to 3-clause BSD -- implementation in
-Fedora 11's libtirpc package version 0.1.10-7). It has been
-adapted for newlib in the following ways:
+This directory contains a port of eXternal Data Representation
+(XDR) code from SunRPC (derived from the relicensed -- to
+3-clause BSD -- implementation in Fedora 11's libtirpc package
+version 0.1.10-7). It has been adapted for newlib in the
+following ways:
 
 1) xdr_* functions for fixed-width integral types have been
    added, such as xdr_int32_t() and similar. The implementation
@@ -58,7 +59,7 @@ xdr_float.c:
   ...
   #elif defined(__vax__)
   #include "xdr_float_vax.c"
- +#else defined(__my_platform__)
+ +#elif defined(__my_platform__)
  +#include "xdr_float_my_platform.c"
   #endif
 
@@ -121,7 +122,7 @@ The desired callback can be registered b
 The return value is the "old" function pointer, which may
 be NULL.
 
-However, neither the typedef or the registration function
+However, neither the typedef nor the registration function
 are declared in the public headers. Clients wishing to use
 them must either declare the necessary symbols manually,
 or #include "xdr_private.h". More on this point, below.
@@ -143,13 +144,13 @@ For instance:
     ...
   }
 
-Will cause xdr-generated error messages to go to stderr.
+will cause xdr-generated error messages to go to stderr.
 
 It is not expected that end-user applications will make use
 of this facility.  Rather, it is expected that IF certain
 *platforms* desire that these error messages be recorded,
-rather expecting client apps print error messages as
-necessary, then those platforms will, in their startup
+instead of expecting client apps to print error messages as
+necessary (*), then those platforms will, in their startup
 objects or static initialization, direct these messages to
 a logging facility, strace debug facility, etc.
 
@@ -158,14 +159,15 @@ Therefore, the platform startup code, if
 from that file.
 
 However, most newlib targets will probably be satisfied with
-the default (silent) behavior. Note that the original Sun RPC,
-as well as the glibc implementation, print these error messages
-to stderr.  Cygwin, for greater similarity to glibc, registers
-an error message handler similar to the example above, within
-its startup code.
-
-(*) Client apps should already check for FALSE return values;
-    in this case they would then check errno and act appropriately.
+the default (silent) behavior. Note that the original Sun RPC
+implementation of XDR, as well as the glibc implementation,
+print these error messages to stderr.  Cygwin, for greater
+similarity to glibc, registers an error message handler similar
+to the example above, within its startup code.
+
+(*) Client apps should already check for FALSE return values.
+    In this case when xdr function return FALSE, the client
+    app would then check errno and act appropriately.
 
 
 LICENSING AND PEDIGREE
@@ -185,7 +187,7 @@ As documented in the libtirpc rpm.spec f
 
 So, in the XDR implementation from Fedora 11's libtirpc package,
 after the modification above by Tom Callaway, each file carries
-the 3-clause BSD license, and not the so-called "SunRPC" license.
+the 3-clause BSD license and not the so-called "SunRPC" license.
 It is from this version that the newlib implementation here was
 derived, with the modifications described in the introduction,
 above.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]