Add xdr support

Charles Wilson cygwin@cwilson.fastmail.fm
Sat Feb 13 06:44:00 GMT 2010


The attached patch(es) add XDR support to cygwin. eXternal Data
Representation (XDR) is a standard data encoding mechanism (RFC 1832,
4506) most frequently seen in the implementation of the SunRPC protocol.
 XDR allows binary data structures to be encoded in an architecture
independent manner for communication between heterogeneous computer systems.

For years, the Sun RPC code, and the XDR implementation, was in legal
license limbo
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=181493
as its license terms were of debatable compatibility with the GPL. In
February of 2009, that changed:

http://blogs.sun.com/webmink/entry/old_code_and_old_licenses
http://lwn.net/Articles/319648/

As documented in the libtirpc rpm.spec file from Fedora 11:
* Tue May 19 2009 Tom "spot" Callaway <tcallawa@redhat.com> 0.1.10-7
- Replace the Sun RPC license with the BSD license, with the explicit
  permission of Sun Microsystems

So, the attached implementations were taken from Fedora 11's libtirpc
package, after the modifications by Tom Callaway. Thus, each file
carries the (3-clause) BSD license, and not the old "SunRPC" license.

Last year, I worked on it some to get it to compile cleanly under cygwin
(1.5,1.7), mingw, msvc80, and linux (32bit, 64bit), while being careful
to maintain the BSD license.  I also wrote a whole slew of tests to
guarantee correct operation and identical representation on all of these
platforms (these carry the MIT/X license). I won't say it has full test
coverage, but it's awfully close.  Anyway, I finally got around to
uploading that package to googlecode this week:

http://code.google.com/p/bsd-xdr/

The attached patch is basically a fork of that bsd-xdr core code. I
removed all the #ifdefs that made msvc80 and mingw happy, as they aren't
needed in newlib and would complicate any attempt to expand the use of
the new code to other newlib targets other than cygwin.  I reworked both
the headers and implementation files to follow newlib-isms like using
_EXFUN() and _DEFUN macros and such.  I did not, however, attempt to add
'chew'-able documentation to the various files.

This fork, rather than relying on <byteorder.h> (which isn't available
inside newlib), uses its own private ntohl/htonl implementations. Also,
while most xdr implementations print errors to stderr using the
BSD-flavor warnx() function, this version allows the caller to configure
an error reporting function (more below).

I did not include the test suite; it would take quite a bit of effort to
translate the bsd-xdr/test/ code into cygwin's testsuite framework --
newlib/libc/ itself doesn't appear to have a test suite AFAICT.  I'm not
sure it's worth the effort, actually -- none of the BSD's or glibc or
linux's include test code for XDR, which is why I had to code tests from
the ground up for my bsd-xdr package.  I did link my test suite against
this implementation inside a newly-built cygwin1.dll, and it passed with
flying colors.

Most of the code goes in newlib, but is only built for $host cygwin.
However, I post it here first for review and comments; rev 2 will go to
the newlib list.  The cygwin components are basically just adding the
new exports, and providing a callback function for the error reporting
framework in the xdr implementation, that uses (in effect) debug_printf().

Note that the newlib patches depend on the ones I posted earlier today
to the newlib list, concerning compatibility with the src/libtool.m4 and
src/ltmain.sh files which were recently updated, as well as
compatibility with ac-2.64 and am-1.11.1:
http://sourceware.org/ml/newlib/2010/msg00114.html

So, apply those two patches first, then these three.  Yes, three: (1)
newlib 'primary' changes, (2) newlib 're-autotool' changes, and (3)
cygwin changes.  I had to compress the first two, because they are too
large to include as inline attachments.

Obviously, the newlib contributions can retain their BSD (or MIT/X, for
two internal files) license, like all the other such files in newlib.
The cygwin components are GPL, and fall under my existing copyright
assignment to Red Hat.

Patch#1: newlib primary
==========================
2010-02-12  Charles Wilson  <...>

        Add eXtensible Data Record (XDR) support for cygwin
	* configure.host: Build libc/xdr only on cygwin.
	* Makefile.am: Install xdr headers.
	* libc/configure.in: Support new libc/xdr subdirectory.
	* libc/Makefile.am: Support new libc/xdr subdirectory.
	* libc/include/rpc/types.h: New.
	* libc/include/rpc/xdr.h: New.
	* libc/xdr/Makefile.am: New.
	* libc/xdr/dummy.c: New.
	* libc/xdr/xdr.c: New.
	* libc/xdr/xdr_array.c: New.
	* libc/xdr/xdr_float.c: New.
	* libc/xdr/xdr_mem.c: New.
	* libc/xdr/xdr_private.c: New.
	* libc/xdr/xdr_private.h: New.
	* libc/xdr/xdr_rec.c: New.
	* libc/xdr/xdr_reference.c: New.
	* libc/xdr/xdr_sizeof.c: New.
	* libc/xdr/xdr_stdio.c: New.

Patch#2: newlib auto
===========================
2010-02-12  Charles Wilson  <...>

	Regenerate using ac-2.64 and am-1.11.1
	* Makefile.in: Regenerate.
	* libc/configure: Regenerate.
	* libc/Makefile.in: Regenerate.
	* libc/argz/Makefile.in: Regenerate.
	* libc/ctype/Makefile.in: Regenerate.
	* libc/errno/Makefile.in: Regenerate.
	* libc/iconv/ccs/binary/Makefile.in: Regenerate.
	* libc/iconv/ccs/Makefile.in: Regenerate.
	* libc/iconv/ces/Makefile.in: Regenerate.
	* libc/iconv/lib/Makefile.in: Regenerate.
	* libc/iconv/Makefile.in: Regenerate.
	* libc/locale/Makefile.in: Regenerate.
	* libc/misc/Makefile.in: Regenerate.
	* libc/posix/Makefile.in: Regenerate.
	* libc/reent/Makefile.in: Regenerate.
	* libc/search/Makefile.in: Regenerate.
	* libc/signal/Makefile.in: Regenerate.
	* libc/stdio/Makefile.in: Regenerate.
	* libc/stdio64/Makefile.in: Regenerate.
	* libc/stdlib/Makefile.in: Regenerate.
	* libc/string/Makefile.in: Regenerate.
	* libc/syscalls/Makefile.in: Regenerate.
	* libc/time/Makefile.in: Regenerate.
	* libc/unix/Makefile.in: Regenerate.
	* libc/xdr/Makefile.in: Regenerate.

Patch #3: cygwin
=========================
2010-02-12  Charles Wilson  <...>

	Add XDR support.
	* cygwin.din: Export xdr functions.
	* include/cygwin/version.h: Bump version.
	* cygxdr.cc: New.
	* cygxdr.h: New.
	* init.cc: Ensure that xdr functions use an approximation
	to debug_print for warnings, rather than stderr.
	* Makefile.in: Add cygxdr.

--
Chuck
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdr-cygwin.patch
Type: text/x-patch
Size: 4841 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20100213/47b7b9ca/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdr-newlib-primary.patch.lzma
Type: application/octet-stream
Size: 20184 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20100213/47b7b9ca/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdr-newlib-auto.patch.lzma
Type: application/octet-stream
Size: 7090 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20100213/47b7b9ca/attachment-0001.obj>


More information about the Cygwin-patches mailing list