August 2011
Intermediate to advanced
552 pages
23h 48m
English
Most often after a fork, you just want to run some other program. The exec() family of functions replaces the current running process with a new one. You will typically hear of fork() and exec() spoken of together, since they are rarely used apart from each other.
There are several variants of exec() depending on how you specify the file to run, how you specify the program arguments, and how you specify the environment variables for the new program.
Table 18.1. exec() Variants
| Finding the Executable | Program Arguments | Environment | |
|---|---|---|---|
| execl | given path | NULL-terminated argument list | environment inherited |
| execlp | PATH search | NULL-terminated argument list | environment inherited |
| execle | given path | list of arguments | explicit environment (NULL-terminated string array) ... |
Read now
Unlock full access