exec (system call)

The Linux kernel has one corresponding system call named "execve", whereas all aforementioned functions are user-space wrappers around it.

The POSIX standard declares exec functions in the unistd.h header file, in the C language.

Some programs may incorrectly rely on this argument providing the location of the executable, but there is no guarantee of this nor is it standardized across platforms.

In the execl, execlp, execv, and execvp calls, the new process image inherits the current environment variables.

A successful exec replaces the current process image, so it cannot return anything to the program that made the call.

If an exec function does return to the calling program, an error occurs, the return value is −1, and errno is set to one of the following values: DOS is not a multitasking operating system, but replacing the previous executable image has a great merit there due to harsh primary memory limitations and lack of virtual memory.

The same API is used for overlaying programs in DOS and it has effects similar to ones on POSIX systems.

[1] Wrapper scripts often use this command to run a program (either directly or through an interpreter or virtual machine) after setting environment variables or other configuration.

[citation needed] OS/360 and successors include a system call XCTL (transfer control) that performs a similar function to exec.