Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does libc function "strcpy()" invoke any syscall?

I want to know if there is any libc function that does not invoke any syscall()? For example, for the libc function "strcpy()", does it any syscall (let's consider all possible linux systems).

like image 509
Richard Avatar asked Jan 16 '23 09:01

Richard


1 Answers

System calls are very heavy performance-wise since they imply a context switch into the kernel. Therefore, for a simple library function like strcpy (whose functionality is effectively equivalent to while(*d++ = *s++), but potentially optimized for the architecture), a system call would not make any sense.

Note that a page fault during copying could result in a kernel context switch and the appearance of a system call, but that would not be a result of strcpy directly calling a system call.

like image 176
nneonneo Avatar answered Jan 30 '23 22:01

nneonneo