Differences between CodeSafe glibc, bsdlib and host glibc (SoloXC only)

In order to provide CodeSafe developers the ability to write standard POSIX calls and be able to run in the SEE environments, gcc wrappers are used in Solo XC programs to override certain standard GNU C library (glibc) functions. Older SEE programs built to run on Solo+ use the BSD C Library (bsdlib). For example, both CodeSafe and Libc, have a definition for the function socket:

socket(int __domain, int __type, int __protocol)

At link time, the function call is overridden and resolved to the CodeSafe implementation. A linker options is used to accomplish that.


The standard POSIX socket() function can still be used calling real_socket(). The applicability of the standard (real_*) familiarity of functions is limited in the SEE environment due to embedded system constraints.

All the wrapped functions were replaced by equivalent ones with the underlying IPC support to communicate with nShield core and provide the same functionality as in legacy systems.

List functions that were wrapped and redefined:

  • socket()

  • bind()

  • listen()

  • accept()

  • connect()

  • read()

  • write()

  • send()

  • setsockopt()

  • poll()

  • select()

glibc Compatibility exceptions

As a consequence of some function redefinitions and the underlying differences, some standard C functions may not work as expected in CodeSafe.

FILE *fdopen( int fd, const char *mode): associates a stream with an existing file descriptor, fd. In the case of a socket fd (returned by CodeSafe socket() implementation) the association result may fail or cause unexpected errors in subsequent calls. Developers should avoid using fdopen with non-standard Unix file descriptors.