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

Charles Wilson cygwin@cwilson.fastmail.fm
Fri Feb 26 17:09:00 GMT 2010


Eric Norum wrote:
> I did the original port of the Sun (FreeBSD) RPC/XDR code to RTEMS.
> The heavy modifications that Ralf referred to were to make the RPC
> code reentrant.  As the README_RTEMS below says, there were no
> changes to the XDR code.  I agree that for now we should stick with
> the RTEMS versions, but in the longer term it would be great to have
> solid, thread-safe, reentrant XDR and RPC routines in newlib.

Whoa, Nelly! XDR is one thing; RPC is quite something else...I'll
(briefly) discuss some of the issues below, but I don't have any
intention of porting/adding RPC itself to newlib.  XDR is nice and
simple, and differs very little across a large range of platforms (even
non-POSIX ones like native win32).

RPC, involving not just networking with multiple socket flavors, but NIS
lookups, password authentication, data encryption, and spawning multiple
processes/tasks (e.g. portmapper) -- no, I don't want to try to make a
single RPC codebase work across the various newlib targets...


Now, about reentrancy: I obviously haven't done a full audit, but with
the exception of the redirect-error-messages stuff (*), I believe XDR is
already reentrant, as all state is encapsulated by XDR* variables you
pass in to the functions.

(*) Given the modifications to this functionality discussed earlier in
the thread, I think most platforms can ignore this. By default, there
will be no error messages, just errno values.  The function to permit
error messages to be printed (the callback registration function) is not
published in the public header file... so, you really have to be
determined to screw things up to get yourself into
reentrancy/thread-safety violations here.

> Code
> that someone else develops and maintains is always a good thing.
> 
> The RTEMS version of the code is in the RTEMS distribution under
> cpukit/librpc/.

Ah, thanks.

> int rtems_rpc_start_portmapper (int priority);
> int rtems_rpc_task_init(void);
> For example, the portmapper calls this
> routine

Err, a generic RPC implementation wouldn't do this, so a combined RPC
impl in newlib is going to have a lot of #ifdef __rtems__ ugliness.

> Multitasking operation
> was provided by moving all `static persistence' variables into a
> single structure and using an RTEMS task variable to point to that
> structure.

Ditto.

> Some of the library, however, has not made it into the RTEMS 
> implementation.  FreeBSD source files which have been left out
> include: 
>   Files which provide RPC to the AF_UNIX address family
>   Files which need NIS
>   Files which provide DES authentication

Sounds like a common RPC impl would need a lot of Makefile.am goo to
exclude those files for RTEMS.

--
Chuck



More information about the Newlib mailing list