next up previous contents index
Next: 9.3 Unsupported Features Up: 9 Minimal C Library: Previous: 9.1 Introduction

9.2 Extended POSIX Support

  To make the OSKit usable to a larger range of standalone applications, support has been added for features such as file descriptors (open, read) and a few file system related operations (unlink, stat). Roughly, these functions correspond to what a POSIX conformant system would typically implement as system calls.

These functions map the POSIX operations to the corresponding COM interfaces. For instance, a call to open("/tmp") will be converted into calls to oskit_dir_lookup and oskit_file_open. A set of calls exists to provide the C library with COM instances it will use for these calls; in the example above, a root directory must be provided. The C library bridges differences between the COM interfaces and the functions as defined by POSIX: for instance, it implements pathname lookup using the COM single-component directory lookup interfaces. Even a simple mount facility to combine file system spaces is included.

Since the extensions are implemented largely independently of the minimal ``core'' library, this sometimes results in unusual and non-intuitive behavior. For example, printf, relying solely on console_putchar, is implemented differently than fprintf(stdout, ...), which relies on write, which in turn is mapped to the oskit_stream::write operation for the file descriptor associated with the stdio FILE structure. (By default, however, stdout's file descriptor is defined to be 1, and a function (fd_set_console) will set up file descriptors 0, 1, and 2 to point to a stream implementation based on console_getchar and console_putchar.)

It is important to note that the idea of extended POSIX support is in conflict with the stated goal of a ``minimal'' C library. On the other hand, we believe that there is virtue in having the minimal C library used in standalone applications, where possible. If only the minimal functionality is required, the file descriptor layer, etc., will not be pulled in by the linker. To use the extended functionality, it is necessary to initialize the C library with the corresponding COM interfaces to which they will be mapped. For that purpose, a set of initialization functions is provided which is described in section 9.9.

However, for those applications requiring more extended POSIX support than is supplied by the minimal C library, the FreeBSD C library can be used instead. The FreeBSD C library (see Section 13) is a complete, fully encapsulated C library that implements all of the functionality normally expected of a C library.


next up previous contents index
Next: 9.3 Unsupported Features Up: 9 Minimal C Library: Previous: 9.1 Introduction

University of Utah Flux Research Group