Chapter 11. C and math library overview

Table of Contents
Omitted functionality
Included non-ISO functions
Deviations from the standard
Math library compatibility modes
Some implementation details
Thread safety
C library startup

eCos provides compatibility with the ISO 9899:1990 specification for the standard C library, which is essentially the same as the better-known ANSI C3.159-1989 specification (C-89).

There are three aspects of this compatibility supplied by eCos. First there is a C library which implements the functions defined by the ISO standard, except for the mathematical functions. This is provided by the eCos's C library package.

Then eCos provides a math library, which implements the mathematical functions from the ISO C library. This distinction between C and math libraries is frequently drawn — most standard C library implementations provide separate linkable files for the two, and the math library contains all the functions from the math.h header file.

There is a third element to the ISO C library, which is the environment in which applications run when they use the standard C library. This environment is set up by the C library startup procedure (see the section called C library startup) and it provides (among other things) a main() entry point function, an exit() function that does the cleanup required by the standard, and an environment that can be read with getenv().

The description in this manual focuses on the eCos-specific aspects of the C library (mostly related to eCos's configurability) as well as mentioning the omissions from the standard in this release. We do not attempt to define the semantics of each function, since that information can be found in the ISO, ANSI, POSIX and IEEE standards, and the many books that have been written about the standard C library.

copyright notice. The eCos C library includes software developed by the University of California at Berkeley and its contributors. The University of California at Berkeley licensing terms request that we place this notice in the product. Full details can be found in the affected source files.

Omitted functionality

The ISO C functionality that is currently omitted in the C library can be grouped by the header files in which they are declared:

stdio.h

remove()ftell()
rename()rewind()
tmpfile()fgetpos()
tmpnam()fsetpos()
fseek() 

Most of these functions are omitted because they only apply to disk-based filesystems.

time.h

time()ctime()
difftime()gmtime()
mktime()localtime()
asctime()strftime()

Note that clock() is implemented, even though the other timekeeping routines are not.

stdlib.h

mblen()wcstombs()
mbtowc()MB_CUR_MAX
wctomb()system()
mbstowcs() 

Most of these functions are related to multibyte and wide character support. system() is omitted for now because it is not used much in embedded system work.

signal.h

signal()SIGABRT
raise()SIGFPE
sig_atomic_tSIGILL
SIG_DFLSIGINT
SIG_ERRSIGSEGV
SIG_IGNSIGTERM