My understanding of a syscall (high level) workflow is:
- User calls libc wrapper
- wrapper puts syscall number and arguments in the right place, registers or stack
- wrapper executes syscall or int 0x80 instruction
- kernel interrupt handler calls sys_xxx() service routine
If that is the case, then there should be a bunch of sys_xxx() functions in kernel source. For example, for read()
, in kernel 2.6 code, I found sys_read. However, in kernel 5.4 code, I did not find such service routine code, the only sys_read I found is acting like a drop in replacement for the libc wrapper. So I am confused..
A related question - the reason that kernel puts the implementation in sys_xxx() is that kernel space can also call these functions, is that correct?