TCP/IP Stack issue

Eric Norum eric.norum at
Thu Dec 20 15:50:25 UTC 2001

Kapil Arora wrote:
> Hi,
> We are trying to segregate the TCP/IP stack from RTEMS
> source to port it to other real-time operating system. Now,
> the issue is that RTEMS's TCP/IP stack seems to be tightly
> coupled with the RTEMS kernel code and using it's functions
> directly which are not mapping to the kernel of the target
> OS. Can anyone help with some documentation available for
> this type of development.
> Thanks in advance,
> Kapil.

When I ported the FreeBSD code I tried to leave the original source
alone as much as possible.  The parts that are really RTEMS-specific are
in the rtems/ and the lib/ directories.  Porting the BSD code is pretty
much just a matter of coming up with a way to simulate the BSD kernel
task synchronization primitives (sleep/wakeup) and semantics (the
FreeBSD code I started with used the traditional UNIX kernel semantics
where a thread active in the kernel is atomic and won't be preempted by
other threads).  The current RTEMS implementation uses events for the
former and a mutex semaphore for the latter.

If I were porting the code again I'd probably implement sleep/wakeup
directly rather than implementing RTEMS versions of the socket-specific
task synchronization routines.  There's a performance hit in doing this,
but it would make it easier to port the full BSD termios code as well as
the bsd network stack.  The advantage would be in things like support
for pseudo-ttys and a fully-functioning select().  It might be time to
see about adding a BSD proc structure within the RTEMS task structure as
well, since so many of the BSD routines now require a `struct proc *'

Eric Norum                                 eric.norum at
Department of Electrical Engineering       Phone: (306) 966-5394
University of Saskatchewan                 FAX:   (306) 966-5407
Saskatoon, Canada.

More information about the users mailing list