Content deleted Content added
Guy Harris (talk | contribs) →{{Anchor|Linux API}}Linux API: Not all of the APIs in the C library are kernel-user space APIs. bsearch() is in the C and POSIX standards, and thus is in GNU libc, but does nothing that involves system calls. printf() makes system calls, but the key part of its functionality - the formatting - is done entirely in user mode. |
m Bot: http → https |
||
(26 intermediate revisions by 12 users not shown) | |||
Line 1:
{{Short description|
{{essay-like|date=July 2014}}
[[File:Linux kernel interfaces.svg|thumb|upright=1.5|Linux API, Linux ABI, and in-kernel APIs and ABIs]]
The [[Linux kernel]] provides multiple interfaces to [[User space and kernel space|user-space and kernel-mode]] code.
== {{Anchor|Linux API}}Linux API ==
[[File:Linux API.svg|thumb|upright=1.5|The '''Linux API''' is composed out of the system call interface of the Linux kernel, the [[GNU C Library]] (by [[GNU]]), [[cgroups|libcgroup]],<ref name="libcgroup">{{cite web|url=https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/|title=ControlGroupInterface|publisher=[[freedesktop.org]]}}</ref> [[Direct Rendering Manager|libdrm]], [[Advanced Linux Sound Architecture|libalsa]] and [[evdev|libevdev]]<ref name="libevdev">{{cite web |url=
[[File:Linux kernel API.svg|thumb|upright=1.5|Linux API vs. [[POSIX]] API]]
The Linux API includes the kernel–user space API, which allows code in user space to access system resources and services of the Linux kernel.<ref>{{cite web
| url =
| title = Kernel System Calls
| date = 2006-11-02 | access-date = 2014-11-11
| author = Alessandro Rubini | website = linux.it
}}</ref> It is composed
The Linux API, by choice, has been kept stable over the decades through a policy of not introducing breaking changes; this stability guarantees the portability of [[source code]].<ref>{{cite web
Line 31 ⟶ 25:
}}</ref> At the same time, Linux kernel developers have historically been conservative and meticulous about introducing new system calls.{{citation needed|date=November 2014}}
Much available [[free and open-source software]] is written for the POSIX API. Since so much more development flows into the Linux kernel as compared to the other POSIX-compliant combinations of kernel and C standard library,{{citation needed|date=July 2014}} the Linux kernel and its API have been augmented with additional features.
At [[FOSDEM]] 2016, [[Michael Kerrisk]] explained some of the perceived issues with the Linux kernel's user-space API, describing that it contains multiple design errors by being non-extensible, unmaintainable, overly complex, of limited purpose, in violation of standards, and inconsistent. Most of those mistakes cannot be fixed because doing so would break the ABI that the kernel presents to the user space.<ref>{{cite web|url=https://archive.fosdem.org/2016/schedule/event/design_linux_kernel_api/|title=How to design a Linux kernel API|author=Michael Kerrisk|author-link=Michael Kerrisk|date=2016-01-31|access-date=2016-02-04}}</ref>
=== {{Anchor|System Call Interface|SCI}} System call interface of the Linux kernel===
The ''system call interface'' of a kernel is the set of all implemented and available [[system calls]] in a kernel. In the Linux kernel, various subsystems, such as the [[Direct Rendering Manager]] (DRM), define their own system calls, all of which are part of the system call interface.
Various issues with the organization of the Linux kernel system calls are being publicly discussed. Issues have been pointed out by Andy Lutomirski, [[Michael Kerrisk]] and others.<ref>{{cite web |url=
=== The C standard library ===
Line 52 ⟶ 46:
* [[dietlibc]]
* [[Bionic (software)|libbionic]] and [[Hybris (software)|libhybris]]
Although the landscape is shifting, amongst these options, glibc remains the most popular implementation, to the point of many treating it as the default and the term equivalent to libc.
==== Additions to POSIX ====
Line 74 ⟶ 70:
== Linux ABI ==
{{Expert needed|
[[File:Linux API and Linux ABI.svg|thumb|upright=1.5|The Linux API and
{{Main article|x32 ABI|Linux Standard Base}}
The
An ABI has to be defined for every instruction set, such as [[x86]], [[x86-64]], [[MIPS architecture|MIPS]], [[ARMv7-A]] (32-Bit), [[ARMv8-A]] (64-Bit), etc. with the [[endianness]], if both are supported.
Line 85 ⟶ 81:
== In-kernel APIs ==
The Linux kernel is a monolithic kernel, hence device drivers are kernel components. To ease the burden of companies maintaining their (proprietary) device drivers
== In-kernel ABIs ==
Since there are no stable in-kernel APIs, there cannot be stable in-kernel ABIs.<ref>{{cite web|url=
== Abstraction APIs ==
[[File:Linux kernel and OpenGL video games.svg|thumb|OpenGL is indeed an abstraction API to make use of diverse GPUs of multiple vendors without the need to program for each one specifically.]]
[[File:Division of labor cpu and gpu.svg|thumb|But the implementation of the OpenGL-specification is executed on the CPU in the context of the running operating system. One design goal of [[Vulkan (API)|Vulkan]] was to make the "graphics driver", i.e. the implementation of the graphics API, do less.]]
For
* Implementation of the [[OpenGL]] and [[Vulkan (API)|Vulkan]] specifications in proprietary Linux graphics drivers and the free and open-source implementation in [[Mesa (computer graphics)|Mesa]].
Line 104 ⟶ 100:
== See also ==
{{Portal|Linux}}
* ''[[The Linux Programming Interface]]'' by [[Michael Kerrisk]]▼
* {{Annotated link|Hybris (software)}}
* [[Semaphore (programming)]]▼
* {{Annotated link|netlink}}
▲** {{mono|[[File descriptor|eventfd()]]}}
* {{Annotated link|system call}}
* {{Annotated link|Windows API}}
* {{Annotated link|windows.h}}
* {{Annotated link|Wine (software)}}
== References ==
Line 121 ⟶ 117:
*[https://web.archive.org/web/20070227215533/http://www.gnugeneration.com/books/linux/2.6.20/kernel-api/ The API of Linux kernel 2.6.20] and [https://www.kernel.org/doc/htmldocs/kernel-api/ 4.12] (in deprecated htmldocs format)
*[https://abi-laboratory.pro/?view=timeline&l=linux API/ABI changes review for Linux]
* [
*{{usurped|1=[https://archive.today/20121220032539/http://www.makelinux.net/kernel_map/ Interactive Linux kernel map]}} with main API functions and structures, {{usurped|1=[https://web.archive.org/web/20180827040646/http://www.makelinux.net/kernel_map/LKM.pdf PDF]}} version
* {{usurped|1=[https://archive.today/20130221193824/http://www.makelinux.net/ldd3 Linux Device Drivers]}} by Jonathan Corbet, Greg Kroah-Hartman and Alessandro Rubini, 3rd edition
* [http://isis.poly.edu/kulesh/stuff/src/klist/ Linux Kernel Linked List Explained] {{Webarchive|url=https://web.archive.org/web/20090925130610/http://isis.poly.edu/kulesh/stuff/src/klist/ |date=2009-09-25 }}
|