System Library
Warning: This document is a work in progress.

- Abstract
- System Library Requirements
  1. Hide System Header Files
  2. No Exposed Functions
  3. No Exposed Data
  4. No Exceptions
  5. Standard Error Codes
  6. Minimize Overhead
- System Library Design
  1. Use Opaque Classes
  2. Common Implementations
  3. Multiple Implementations
  4. Use Low Level Interfaces
  5. No Memory Allocation
  6. No Virtual Methods
- System Library Details
  1. Tracking Bugzilla Bug: 351
  2. Reference Implementatation

Written by the Reid Spencer

Abstract

This document describes the requirements, design, and implementation details of LLVM's System Library. The library is composed of the header files in `llvm/include/llvm/System` and the source files in `llvm/lib/System`. The goal of this library is to completely shield LLVM from the variations in operating system interfaces. By centralizing LLVM's use of operating system interfaces, we make it possible for the LLVM tool chain and runtime libraries to be more easily ported to new platforms. The library also unclutters the rest of LLVM from #ifdef use and special cases for specific operating systems.

The System Library was donated to LLVM by Reid Spencer who formulated the original design as part of the eXtensible Programming System (XPS) which is based, in part, on LLVM.

System Library Requirements

The System library's requirements are aimed at shielding LLVM from the variations in operating system interfaces. The following sections define the requirements needed to fulfill this objective.

Hide System Header Files

To be written.

No Exposed Functions

To be written.

No Exposed Data

To be written.

No Exceptions

To be written.

Standard Error Codes

To be written.

Minimize Overhead

To be written.

System Library Design

In order to fulfill the requirements of the system library, strict design objectives must be maintained in the library as it evolves. The goal here is to provide interfaces to operating system concepts (files, memory maps, sockets, signals, locking, etc) efficiently and in such a way that the remainder of LLVM is completely operating system agnostic.

Use Opaque Classes

no public data

onlyprimitive typed private/protected data

data size is "right" for platform, not max of all platforms

each class corresponds to O/S concept

Common Implementations

To be written.

Multiple Implementations

To be written.

Use Low Level Interfaces

To be written.

No Memory Allocation

To be written.

No Virtual Methods

To be written.

System Library Details

To be written.

Bug 351

See bug 351 for further details on the progress of this work

Reference Implementation

The `linux` implementation of the system library will always be the reference implementation. This means that (a) the concepts defined by the linux must be identically replicated in the other implementations and (b) the linux implementation must always be complete (provide implementations for all concepts).