On Thu, Aug 16, 2018 at 09:51:05PM +0530, Subhashini Rao Beerisetty wrote:
Hi All,
I'm trying to get the difference between system call and POSIX call. System calls are user mode API's (open(), close(), ioctl(),...) gets the kernel service via software interrupt. What about POSIX calls and how it differs with the system call.? Can anyone clarify me on this.
glibc is the library that connects user-space libs/apps to the system call interface (unistd.h basically) so if you do an open() in user-space you are calling glibc and that can call sys_open() but there are POSIX calls that will not necessarily do a system call if they can handle the request with available resources or with cached data. So there is no 1:1 mapping at runtime from POSIX call to system call - and there can be multiple POSIX calls that map to a single system call (e.g. printf -> write) Note that you can do system calls directly with system() but that is generaly not how you do it - you to through the glibc calls which do some checks before invoking the actual system call. Does that clarify it ? thx! hofrat