Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Kernel Runtime Library


Detailed Description

This module consists mostly of stubs provided to satisfy the linker when building in the newlib C runtime library.

Many of the stubs will be replaced by real functions as necessary to aid kernel development. Some of the functions make no sense from within the kernel.


Files

file  __cxa_atexit.cpp
 Stub implementation of the C++ application exit function dispatcher.
file  abort.cpp
 Stub C standard library abort() function.
file  close.cpp
 Stub C standard library close() function.
file  fstat.cpp
 Stub C standard library fstat() function.
file  isatty.cpp
 Stub implementation of the POSIX isatty() function.
file  lseek.cpp
 Stub lseek() implementation for the C standard library.
file  open.cpp
 Stub implementation of the C standard library function open().
file  read.cpp
 Stub implementation of the C standard library function read().
file  sbrk.cpp
 Stubbed out sbrk() function for the C standard library.

Functions

int __cxa_atexit (void(*)(void *), void *, void *)
 Minimal implementation of __cxa_atexit() for the kernel.
void abort ()
 Causes abnormal program termination.
int close (int)
 Minimal implementation of close() for the kernel.
int fstat (int, struct stat *st)
 Minimal implementation of fstat for kernel.
int isatty (int)
 Indicates if a file descriptor is associated with a terminal device.
int lseek (int, int, int)
 Minimal implementation of lseek() for the kernel.
int open (const char *, int, int)
 Minimal implementation of open() for kernel.
int read (int, char *, int)
 Minimal implementation of read() for kernel.
void * sbrk (int increment)
 Copyright (C) 2004 Bregmasoft.


Function Documentation

int __cxa_atexit void(*)(void *)  ,
void *  ,
void * 
 

Minimal implementation of __cxa_atexit() for the kernel.

Since the kernel handles its exit dispatch in a different way, this function does nothing, but it;s easier to just supply an empty stub than to figure out how to satisfy the toolchain's desire for this function in a more appropriate way.

All of the arguments passed to this function are ignored.

Returns:
0 (always).

void abort  ) 
 

Causes abnormal program termination.

The abort() function causes abnormal program termniation. Since this is the kernel we're talking about here, abnormal program termination mean to write a message out to the kernel error logger and halt operations.

This library call is required by the ISO C and C++ standard library implementations. It currently does nothing, but the symbol needs to be defined and the best way to do that is to provide an empty function.

Note that the C++ standard (AFAIK) does not add exception specifications to the C-standard abort() call, but some of the header files I'm working with do, so I'm adding it in here.

Todo:
Added a configury macro to deal with the {optional} exception specification on abort().

Conforming To
ISO/IEC 9899:1990 Programming Languages -- C ISO/IEC 14882:1998(E) Programming Languages -- C++

Here is the call graph for this function:

int close int   ) 
 

Minimal implementation of close() for the kernel.

Returns:
-1 (always).

int fstat int  ,
struct stat *  st
 

Minimal implementation of fstat for kernel.

Returns:
0 (always).

int isatty int   ) 
 

Indicates if a file descriptor is associated with a terminal device.

This function indicates if a file descriptor is associated with a terminal device.

This function is not a part of the ISO/IEC 9899:1990 (C) standard library but is a part of the IEEE Std 1003.1-2001 (POSIX) library, and is declared in the header <unistd.h>. It is only provided here because newlib will not link without the symbol being defined.

Returns:
1 if the file descriptor is associated with a terminal device, 0 otherwise.

int lseek int  ,
int  ,
int 
 

Minimal implementation of lseek() for the kernel.

Returns:
0 (always).

int open const char *  ,
int  ,
int 
 

Minimal implementation of open() for kernel.

Returns:
-1 (always).

int read int  ,
char *  ,
int 
 

Minimal implementation of read() for kernel.

Returns:
0 (always).

void * sbrk int  increment  ) 
 

Copyright (C) 2004 Bregmasoft.

This function increments or decrements the break, or high memory address, by increment bytes.

Parameters:
increment [IN] The number of bytes to add (or subtract) from the current memory address space. A value of zero can be used to get the current high address of the memory address space.
Returns:
a pointer to the start of the new area (which is usually the same as the old address limit, but is returned in case there is more than one task sharing the same address space). On error, -1 is returned, but this implementation will not set errno, so yer fuct.
Todo:
This minimal sbrk() should be replaced AS SOON AS POSSIBLE.

Here is the call graph for this function:


Generated on Fri Sep 2 10:45:05 2005 for zygoma by doxygen 1.4.2