![]() | This articleis written like apersonal reflection, personal essay, or argumentative essay that states a Wikipedia editor's personal feelings or presents an original argument about a topic. Pleasehelp improve it by rewriting it in anencyclopedic style.(July 2014) (Learn how and when to remove this message) |
TheLinux kernel provides multiple interfaces touser-space and kernel-mode code. The interfaces can be classified as eitherapplication programming interface (API) orapplication binary interface (ABI), and they can be classified as either kernel–user space or kernel-internal.
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.[3] It is composed of the system call interface of the Linux kernel and the subroutines in theC standard library. The focus of the development of the Linux API has been to provide theusable features of the specifications defined inPOSIX in a way which is reasonably compatible, robust and performant, and to provide additional useful features not defined in POSIX, just as the kernel–user space APIs of other systems implementing the POSIX API also provide additional features not defined in POSIX.
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 ofsource code.[4] At the same time, Linux kernel developers have historically been conservative and meticulous about introducing new system calls.[citation needed]
Much availablefree 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] the Linux kernel and its API have been augmented with additional features. Programming for the full Linux API, rather than just the POSIX API, may provide advantages in cases where those additional features are useful. Well-known current examples areudev,systemd andWeston.[5] People such asLennart Poettering openly advocate to prefer the Linux API over the POSIX API, where this offers advantages.[6]
AtFOSDEM 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.[7]
Thesystem call interface of a kernel is the set of all implemented and availablesystem calls in a kernel. In the Linux kernel, various subsystems, such as theDirect 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.[8][9][10][11]
AC standard library for Linux includes wrappers around the system calls of the Linux kernel; the combination of the Linux kernel system call interface and a C standard library is what builds the Linux API. Some popular implementations of the C standard library are
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.
As in otherUnix-like systems, additional capabilities of the Linux kernel exist that are not part of POSIX:
futex
(fast userspace mutex),epoll
,splice
,dnotify
,fanotify
, andinotify
have been exclusive to the Linux kernel so far.getrandom
was introduced in version 3.17 of theLinux kernel mainline[12]memfd
was proposed by thekdbus developers[13]memfd_create
was merged into the Linux kernel mainline in kernel version 3.17readahead
initiates a file "read-ahead" into page cacheDRM has been paramount for the development and implementations of well-defined and performantfree and open-source graphics device drivers without which no rendering acceleration would be available at all, only the 2D drivers would be available in theX.Org Server. DRM was developed for Linux, and since has been ported to other operating systems as well.[14]
![]() | This articleneeds attention from an expert in free and open-source software, software or computing. The specific problem is:This section mostly ignores the kernel-userspace ABI (that is very real and important thing) and jumps into userspace-to-userspace APIs.WikiProject Free and open-source software,WikiProject Software orWikiProject Computing may be able to help recruit an expert.(February 2018) |
The Linux ABI is a kernel–user space ABI. As ABI is amachine code interface, the Linux ABI is bound to theinstruction 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 forLinux distributions andindependent software vendors (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 asx86,x86-64,MIPS,ARMv7-A (32-Bit),ARMv8-A (64-Bit), etc. with theendianness, if both are supported.
It should be able to compile the software with different compilers against the definitions specified in the ABI and achieve full binary compatibility. Compilers that arefree and open-source software are e.g.GNU Compiler Collection,LLVM/Clang.
Many kernel-internal APIs exist, allowing kernel subsystems to interface with one another. These are being kept fairly stable, but there is no guarantee for stability. A kernel-internal API can be changed when such a need is indicated by new research or insights; all necessary modifications and testing have to be done by the author.
The Linux kernel is a monolithic kernel, hence device drivers are kernel components. To ease the burden of companies maintaining their (proprietary) device drivers outside of the main kernel tree, stable APIs for the device drivers have been repeatedly requested. The Linux kernel developers have repeatedly denied guaranteeing stable in-kernel APIs for device drivers. Guaranteeing such would have faltered the development of the Linux kernel in the past and would still in the future and, due to the nature of free and open-source software, are not necessary. Ergo, by choice, the Linux kernel has nostable in-kernel API.[15]
Since there are no stable in-kernel APIs, there cannot be stable in-kernel ABIs.[16]
For many use cases, the Linux API is considered too low-level, so APIs of higher abstraction must be used. Higher-level APIs must be implemeted on top of lower-level APIs. Examples:
If a change results in user programs breaking, it's a bug in the kernel. We never EVER blame the user programs.
In fact, the way I see things theLinux API has been taking the role of thePOSIX API and Linux is the focal point of all Free Software development. Due to that I can only recommend developers to try to hack with only Linux in mind and experience the freedom and the opportunities this offers you. So, get yourself a copy ofThe Linux Programming Interface, ignore everything it says aboutPOSIX compatibility and hack away your amazing Linux software. It's quite relieving!