Klibc
   HOME

TheInfoList



OR:

In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, klibc is a minimalistic subset of the standard C library developed by H. Peter Anvin. It was developed mainly to be used during the
Linux startup process The multi-stage booting process of Linux is in many ways similar to the BSD and other Unix-style boot processes, from which it derives. Booting a Linux installation involves multiple stages and software components, including firmware initializat ...
, and it is part of the
early user space The multi-stage booting process of Linux is in many ways similar to the BSD and other Unix-style boot processes, from which it derives. Booting a Linux installation involves multiple stages and software components, including firmware initializ ...
, i.e. components used during kernel startup, but which do not run in
kernel mode In computer science, hierarchical protection domains, often called protection rings, are mechanisms to protect data and functionality from faults (by improving fault tolerance) and malicious behavior (by providing computer security). Compute ...
.https://www.kernel.org/doc/Documentation/early-userspace/README These components do not have access to the standard library (usually
glibc The GNU C Library, commonly known as glibc, is the GNU Project's implementation of the C standard library. Despite its name, it now also directly supports C++ (and, indirectly, other programming languages). It was started in the 1980s ...
or
musl musl is a C standard library intended for operating systems based on the Linux kernel, released under the MIT License. It was developed by Rich Felker with the goal to write a clean, efficient and standards-conformant libc implementation. ...
) used by normal
userspace A modern computer operating system usually segregates virtual memory into user space and kernel space. Primarily, this separation serves to provide memory protection and hardware protection from malicious or errant software behaviour. Kerne ...
programs. The development of klibc library was part of the 2002 effort to move some Linux initialization code out of the kernel. According to its documentation, the klibc library is optimized for correctness and small size. Because of its design, klibc is also technically suitable for
embedded software Embedded software is computer software, written to control machines or devices that are not typically thought of as computers, commonly known as embedded systems. It is typically specialized for the particular hardware that it runs on and has tim ...
in general on a variety of platforms, and is used even by full-featured programs such as the MirBSD Korn Shell. During the Linux startup process, klibc is loaded from within a temporary RAM file system, initramfs. It is incorporated by default into initial RAM file systems that are created by the mkinitramfs script in
Debian Debian (), also known as Debian GNU/Linux, is a Linux distribution composed of free and open-source software, developed by the community-supported Debian Project, which was established by Ian Murdock on August 16, 1993. The first version of De ...
and
Ubuntu Ubuntu ( ) is a Linux distribution based on Debian and composed mostly of free and open-source software. Ubuntu is officially released in three editions: '' Desktop'', ''Server'', and ''Core'' for Internet of things devices and robots. All ...
. Furthermore, it has a set of small Unix utilities that are useful in
early user space The multi-stage booting process of Linux is in many ways similar to the BSD and other Unix-style boot processes, from which it derives. Booting a Linux installation involves multiple stages and software components, including firmware initializ ...
:
cpio cpio is a general file archiver utility and its associated file format. It is primarily installed on Unix-like computer operating systems. The software utility was originally intended as a tape archiving program as part of the Programmer's Work ...
,
dash The dash is a punctuation mark consisting of a long horizontal line. It is similar in appearance to the hyphen but is longer and sometimes higher from the baseline. The most common versions are the endash , generally longer than the hyphen ...
, fstype,
mkdir The mkdir (make directory) command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language. In DOS, OS/2, ...
,
mknod In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files ...
, mount, nfsmount, run-init, etc. all using the ''klibc'' library. An alternate strategy is to include everything in one executable, like
BusyBox BusyBox is a software suite that provides several Unix utilities in a single executable file. It runs in a variety of POSIX environments such as Linux, Android, and FreeBSD, although many of the tools it provides are designed to work with inte ...
, which determines the requested applet via arguments or hard links or symlinks.


Licensing

klibc is dual-licensed under a BSD three-clause (formerly four-clause, rectified via the
Historical Permission Notice and Disclaimer The Historical Permission Notice and Disclaimer (HPND) is an open source license, approved by the Open Source Initiative (OSI) and verified as GPL-compatible by the Free Software Foundation. It is unique among the OSI's licenses because of the choi ...
), as well as the GPLv2 (GPLv2 ''only'', due to Linux-kernel restrictions). This dual license allows compatibility with both non-copyleft software, ''as well as'' GPLv3 programs ''via'' ''the BSD license'' (which otherwise would not be compatible). (However, if klibc includes any GPLv2 kernel code such as that in glibc, the entire application reverts to GPLv2.)


References


External links


Mailing list

initramfs and where user space truly begins
- LWN,
Jonathan Corbet LWN.net is a computing webzine with an emphasis on free software and software for Linux and other Unix-like operating systems. It consists of a weekly issue, separate stories which are published most days, and threaded discussion attached to eve ...
, July 11, 2006. {{DISPLAYTITLE:klibc C standard library Free computer libraries Free software programmed in C Interfaces of the Linux kernel Linux APIs Software using the BSD license Software using the GPL license