Linux kernel interfaces: Difference between revisions

Content deleted Content added
Remove overkill formatting
m Bot: http → https
 
(2 intermediate revisions by one other user not shown)
Line 1:
{{Short description|An overview and comparison of the Linux kernel APIAPIs and ABI.ABIs}}
{{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. thatThe areinterfaces usedcan forbe varyingclassified purposesas andeither that[[application haveprogramming varyinginterface]] properties(API) by design. There are two types ofor [[application programmingbinary interface]] (APIABI), inand thethey Linuxcan kernel:be classified as either kernel–user space andor kernel -internal.
 
== {{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=httphttps://www.freedesktop.org/wiki/Software/libevdev/ |title=libevdev |publisher=[[freedesktop.org]]}}</ref> (by [[freedesktop.org]]).]]
[[File:Linux kernel API.svg|thumb|upright=1.5|Linux API vs. [[POSIX]] API]]
 
The Linux API includes the kernel&ndash;user space API, which allows code in user space to access system resources and services of the Linux kernel.<ref>{{cite web
| url = httphttps://www.linux.it/~rubini/docs/ksys/ksys.html
| title = Kernel System Calls
| date = 2006-11-02 | access-date = 2014-11-11
Line 32:
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=httphttps://www.linux-magazine.com/Issues/2014/165/Kernel-News |title=System Call Organization}}</ref><ref>{{cite web |url=https://lkml.org/lkml/2014/2/27/571 |title= Making a universal list of syscalls? |publisher=[[LKML]] |date=2014-02-27}}</ref><ref>{{cite web |url=https://lwn.net/Articles/585415/ |title=Flags as a system call API design pattern |publisher=[[LWN.net]] |date=2014-02-12}}</ref><ref>{{cite web |url=https://lwn.net/Articles/446528/ |title=On vsyscalls and the vDSO |publisher=[[LWN.net]] |date=2011-06-08}}</ref>
 
=== The C standard library ===
Line 71:
== Linux ABI ==
{{Expert needed|free and open-source software|ex2=software|ex3=computing|reason=This section mostly ignores the kernel-userspace ABI (that is very real and important thing) and jumps into userspace-to-userspace APIs|date=February 2018}}
[[File:Linux API and Linux ABI.svg|thumb|upright=1.5|The Linux API and the Linux [[Application binary interface|ABI]] ]]
{{Main article|x32 ABI|Linux Standard Base}}
 
The Linux [[application binary interface]] (ABI) is a kernel–user space ABI. As ABI is a [[machine code]] interface, the Linux ABI is bound to the [[instruction set]]. Defining a useful ABI and keeping it stable is less the responsibility of the Linux kernel developers or of the developers of the GNU C Library, and more the task for [[Linux distribution]]s and [[independent software vendor]]s (ISVs) who wish to sell and provide support for their proprietary software as binaries only for such a single Linux ABI, as opposed to supporting multiple Linux ABIs.
 
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 86:
 
== In-kernel ABIs ==
Since there are no stable in-kernel APIs, there cannot be stable in-kernel ABIs.<ref>{{cite web|url=httphttps://abi-laboratory.pro/tracker/timeline/linux/ | title=Analysis of ABI changes in the Linux kernel |publisher=Andrey Ponomarenko's ABI laboratory|date=2016-03-15}}</ref>
 
== Abstraction APIs ==
Line 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]
* [httphttps://man7.org/tlpi/ The Linux Programming Interface] book, [httphttps://man7.org/tlpi/api_changes/ Linux and ''glibc'' API changes] since [[The Linux Programming Interface]] was released in 2010
*{{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