📑 Table of Contents
klibc
DeveloperH. Peter Anvin
Stable release
2.0.14[1] / 4 March 2025; 15 months ago (4 March 2025)
Operating systemLinux
TypeRuntime library
LicenseBSD licenses/GPLv2
Websitekernel.org/pub/linux/libs/klibc/ Edit this on Wikidata
Repository

In computing, 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, and it is part of the early user space, i.e. components used during kernel startup, but which do not run in kernel mode.[2] These components do not have access to the standard library (usually glibc or musl) used by normal userspace programs.

The development of klibc library was part of the 2002 effort to move some Linux initialization code out of the kernel.[3][4][5] According to its documentation, the klibc library is optimized for correctness and small size.[2] Because of its design, klibc is also technically suitable for embedded software 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[6] and Ubuntu. Furthermore, it has a set of small Unix utilities that are useful in early user space: cpio, dash, fstype, mkdir, mknod, mount, nfsmount, run-init, etc. all using the klibc library.[7] An alternate strategy is to include everything in one executable, like BusyBox, which determines the requested applet via arguments or hard links or symlinks.

Licensing

edit

klibc is dual-licensed under a BSD three-clause[8] (formerly four-clause, rectified via the Historical Permission Notice and Disclaimer), 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

edit
  1. ^ https://git.kernel.org/pub/scm/libs/klibc/klibc.git/tag/?h=klibc-2.0.14. {{cite web}}: Missing or empty |title= (help)
  2. ^ a b "Early userspace support". Archived from the original on 2011-05-02. Retrieved 2020-09-29.
  3. ^ Jonathan Corbet, (November 2002) Initramfs arrives, LWN.net
  4. ^ "initramfs merge, part 1 of N". 2002-02-11.
  5. ^ "Re: initramfs merge, part 1 of N". 2002-02-11.
  6. ^ Debian stable Klibc.
  7. ^ "libs/klibc/klibc.git / tree".{{cite web}}: CS1 maint: deprecated archival service (link)
  8. ^ "klibc.spec.in - klibc/klibc.git - klibc main development tree". git.kernel.org. Retrieved 2020-12-06.
edit

📚 Artikel Terkait di Wikipedia

C (programming language)

Time Variadic POSIX Implementations Bionic libhybris dietlibc glibc EGLIBC klibc Windows CRT musl Newlib uClibc Compilers ACK Borland Turbo C Clang Comeau

C standard library

systems (MMU-less) and used in the Cygwin GNU distribution for Windows klibc, primarily for booting Linux systems musl, another lightweight C standard

Linux

files subsystem Networking subsystem Other components: ALSA, DRI, evdev, klibc, LVM, device mapper, Linux Network Scheduler, Netfilter Linux Security Modules:

Musl

distros. Free and open-source software portal Bionic libc dietlibc EGLIBC klibc Newlib uClibc "musl - obsolete versions". musl-libc.org. 2017-10-31. Retrieved

User space and kernel space

files subsystem Networking subsystem Other components: ALSA, DRI, evdev, klibc, LVM, device mapper, Linux Network Scheduler, Netfilter Linux Security Modules:

ArcaOS

Windows software to OS/2. ArcaOS provides a Unix compatibility layer named kLIBC that facilitates the porting of open source Linux applications to ArcaOS

Stdarg.h

Time Variadic POSIX Implementations Bionic libhybris dietlibc glibc EGLIBC klibc Windows CRT musl Newlib uClibc Compilers ACK Borland Turbo C Clang Comeau

Rust for Linux

libraries C standard library glibc uClibc Bionic libhybris dietlibc EGLIBC klibc musl Newlib libcgroup libdrm libalsa libevdev libusb liburing Components