The documentation for the open()
function says the following:
The open() system call opens the file specified by pathname.
I thought that open()
is a wrapper function for a system call, and is not itself a system call.
Or are the wrapper functions for system calls also called system calls?
Short answer - Yes.
Long answer - it depends. A system call is the programmatic way in which a computer program requests a service from the kernel of the operating system it is executed on. 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.
System calls are not defined as specific functions. Rather they are request for services or in other words the OS API. They are almost always hidden from the user by the standard functions which are provided by the language standard. And the standard is implemented in the compilers which differ from OS to OS.
I think that the other answer by Petar is what is correct but I'd also like to add that for me the simplest way to explain why open is considered a system call is because syscalls are not guaranteed to be the same across all OS's. For example if we imagine an OS where syscall 1 is open, another OS's might use syscall 1 for write (as linux x64 does), so for the sake of compatibility functions such open()
were added, where the OS would provide the implementation of open()
as a call to the appropriate syscall value, and the programmer wouldn't have to worry about calling the right syscall number between different OS's
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With