Lets take POSIX, whats the difference between POSIX API, libc and actual system calls?
closed as off-topic by David Richerby, vonbrand, Luke Mathieson, Juho, hengxin Feb 22 '16 at 6:59
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about computer science, within the scope defined in the help center." – David Richerby, vonbrand, Luke Mathieson, Juho, hengxin
I'll start with system call.
a system call is how a program requests a service from an operating system's kernel. This may include hardware-related services (for example, accessing a hard disk drive), creation and execution of new processes, and communication with integral kernel services such as process scheduling. System calls provide an essential interface between a process and the operating system. Wiki
A system call, sometimes referred to as a kernel call, is a request by an active process made via a software interrupt for a service performed by the kernel. (Source)
The library as an intermediary
Generally, systems provide a library or API that sits between normal programs and the operating system. On Unix-like systems, that API is usually part of an implementation of the C library (libc), such as glibc, that provides wrapper functions for the system calls, often named the same as the system calls they invoke.....For example, in Unix-like systems,
execveare C library functions that in turn execute instructions that invoke the
execsystem calls. Making the system call directly in the application code is more complicated and may require embedded assembly code to be used (in C and C++) as well as knowledge of the low-level binary interface for the system call operation, which may be subject to change over time and thus not be part of the application binary interface; the library functions are meant to abstract this away. Wiki
You may find a couple of popular POSIX system calls here.
So, to summarize, a system call is a request to the kernel for a service. The system call interface is the basic interface between a program and the kernel. The programming library, e.g. libc, has APIs on top of the basic system calls, provided by the kernel, which further ease the job of the developer.