Exec at the OS level

Up until now, we have covered six of the seven exec family APIs. Finally, the seventh one is the execve(2). Did you notice? The 2 in brackets conveys that it's a system call (recall the details covered regarding system calls in Chapter 1, Linux System Architecture).

The fact is, all the preceding six exec APIs are within glibc—the library layer; only the execve(2) is a system call. You will realize that, ultimately, to have a process be able to execute another program—thus launching or running a successor—will require OS-level support. So, yes, the reality is that all the above six exec APIs are merely wrappers; they transform their arguments and invoke the execve system call.

This is the signature of the execve(2) ...

Get Hands-On System Programming with Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.