Search code examples
linuxsystem-callsmanpage

Why isn't `execlp()` in the system call section


I noticed that the entry for execlp() is not in the system call (2) section of the man pages, but instead resides in section (3), subroutines. Why is this, while fork() resides in section (2)?

Here are the links:
https://linux.die.net/man/2/fork
https://linux.die.net/man/3/execlp


Solution

  • Because execlp() (and all the other execXXX() functions in the same man page) is a library function wrapper around the execve() system call. The steps of collecting the variadic arguments into an array, and searching for the program in the PATH environment variable, are done in user-mode code in the library, before calling into the kernel to initiate execution of the program.

    fork(), on the other hand, simply calls directly into the kernel.