• Home
  • Raw
  • Download

Lines Matching full:system

2 System Library
8 This document provides some details on LLVM's System Library, located in the
9 source at ``lib/System`` and ``include/llvm/System``. The library's purpose is
11 services LLVM needs from the operating system. Much of LLVM is written using
12 portability features of standard C++. However, in a few areas, system dependent
13 facilities are needed and the System Library is the wrapper around those system
16 By centralizing LLVM's use of operating system interfaces, we make it possible
18 platforms since (theoretically) only ``lib/System`` needs to be ported. This
21 interfaces provided in ``include/llvm/System``.
23 Note that the System Library is not intended to be a complete operating system
28 The System Library was written by Reid Spencer who formulated the design based
29 on similar work originating from the eXtensible Programming System (XPS).
37 portability rules associated with the System Library. Adherence to these rules
38 should help the System Library achieve its goal of shielding LLVM from the
39 variations in operating system interfaces and doing so efficiently. The
42 Don't Include System Headers
45 Except in ``lib/System``, no LLVM source code should directly ``#include`` a
46 system header. Care has been taken to remove all such ``#includes`` from LLVM
47 while ``lib/System`` was being developed. Specifically this means that header
50 ``lib/System``.
52 To obtain system-dependent functionality, existing interfaces to the system
53 found in ``include/llvm/System`` should be used. If an appropriate interface is
54 not available, it should be added to ``include/llvm/System`` and implemented in
55 ``lib/System`` for all supported platforms.
57 Don't Expose System Headers
60 The System Library must shield LLVM from **all** system headers. To obtain
61 system level functionality, LLVM source must ``#include "llvm/System/Thing.h"``
62 and nothing else. This means that ``Thing.h`` cannot expose any system header
63 files. This protects LLVM from accidentally using system specific functionality
64 and only allows it via the ``lib/System`` interface.
70 exposed through the ``lib/System`` interface. These headers and the things they
72 them directly or obtain their inclusion through ``lib/System`` interfaces.
78 template library may be exposed through the ``lib/System`` interface. These
81 ``lib/System`` interfaces.
86 The entry points specified in the interface of ``lib/System`` must be aimed at
88 simply wrap each operating system call. It would be preferable to wrap several
89 operating system calls that are always used in conjunction with one another by
94 operating system calls: ``getenv``, ``fork``, ``execve``, and ``wait``. The
95 correct thing for ``lib/System`` to provide is a function, say
97 we don't want is wrappers for the operating system calls involved.
99 There must **not** be a one-to-one relationship between operating system
100 calls and the System library's interface. Any such interface function will be
106 There must be no functionality specified in the interface of ``lib/System``
108 system wrapper here, just enough to satisfy LLVM's needs. And, LLVM doesn't
109 need much. This design goal aims to keep the ``lib/System`` interface small and
119 systems supported for a given class of operating system (e.g. Unix, Win32).
124 The System Library interfaces can be called quite frequently by LLVM. In order
132 Any functions defined by system libraries (i.e. not defined by ``lib/System``)
133 must not be exposed through the ``lib/System`` interface, even if the header
134 file for that function is not exposed. This prevents inadvertent use of system
137 For example, the ``stat`` system call is notorious for having variations in the
138 data it provides. ``lib/System`` must not declare ``stat`` nor allow it to be
142 provided by the System Library must be implemented on all platforms (even those
148 Any data defined by system libraries (i.e. not defined by ``lib/System``) must
149 not be exposed through the ``lib/System`` interface, even if the header file
156 Operating system interfaces will generally provide error results for every
161 disk sector", or "system call interrupted". We'll call the first group "*soft*"
164 ``lib/System`` must always attempt to minimize soft errors. This is a design
174 open the file will produce an error. However, ``lib/System`` should not simply
180 This design principle needs to be maintained in ``lib/System`` because it
197 None of the ``lib/System`` interface functions may be declared with C++
200 functions. This is a performance consideration: ``lib/System`` functions are at
202 them to be as efficient as possible. However, no routines in the system
208 Implementations of the System Library interface are separated by their general
209 class of operating system. Currently only Unix and Win32 classes are defined
210 but more could be added for other operating system classifications. To
211 distinguish which implementation to compile, the code in ``lib/System`` uses
213 through the ``llvm/Config/config.h`` file. Each source file in ``lib/System``,
214 after implementing the generic (operating system independent) functionality
217 ``lib/System/File.cpp``, we'd expect to see in that file:
228 The implementation in ``lib/System/Unix/File.cpp`` should handle all Unix
229 variants. The implementation in ``lib/System/Win32/File.cpp`` should handle all
231 operating system that will provide the implementation. The specific details for
237 The implementation of a ``lib/System`` interface can vary drastically between
240 forward on all operating system. System V IPC on the other hand isn't even
241 supported on all platforms. Instead of "supporting" System V IPC,
242 ``lib/System`` should provide an interface to the basic concept of
243 inter-process communications. The implementations might use System V IPC if
245 for a given operating system. In all cases, the interface and the