Summary table – exec family of APIs

Here is a table to summarize all seven of the exec family APIs:

Exec API Arguments: long format (l) Arguments: short format (v) PATH searched? (p) Environment passed? (e) API layer

execl

Y

N

N N Lib
execlp Y N Y N Lib
execle Y N N Y Lib
execv N Y N N Lib
execvp N Y Y N Lib
execvpe N Y Y Y Lib
execve N Y N Y SysCall

The exec APIs format: exec<foo>, where <foo> is differing combinations of {l,v,p,e}.

All the listed APIs, on success, as we have learned, do not return at all. Only upon failure, would you see a return value; as per the usual norms, the global variable errno will get set to reflect the cause of the error, which can be conveniently looked up via the perror(3) or strerror(3) ...

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.