I have been writing programs in C/C++ that make use of the Linux API and make system calls like fork(),read(),write() etc. Now, I am beginning to wonder if these library functions are actually system calls, or are they some kind of wrapper functions.
What really happens when a program makes a call to write() ? How does this function interact with the kernel ? If this is a wrapper then why do we need it ?
All such functions are real userspace functions in libc.so
that your binary is linked against. But most of them are just tiny wrappers for syscalls which are the interface between the userspace and the kernel (see also syscall(2)
).
Note that functions that are purely userspace (like fmod(3)
) or do some things in userspace in addition to calling the kernel (like execl(3)
) have their manpages in the section 3 while functions that just call the kernel (like read(2)
) have them in the section 2.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments