June 2017
Intermediate to advanced
478 pages
13h 14m
English
The fork function creates a copy of a running program, but it does not run a different program. For that, you need one of the exec functions:
int execl(const char *path, const char *arg, ...); int execlp(const char *file, const char *arg, ...); int execle(const char *path, const char *arg, ..., char * const envp[]); int execv(const char *path, char *const argv[]); int execvp(const char *file, char *const argv[]); int execvpe(const char *file, char *const argv[], ..., char *const envp[]);
Each takes a path to the program file to load and run. If the function succeeds, the kernel discards all the resources of the current process, including memory and file descriptors, and allocates memory to the new program being ...
Read now
Unlock full access