It is a family of functions that do the same thing but actually no.
When we call exec()
, we never reutrn back to the callling program. The program
called by the exec()
function replaces itself with the calling progam. The only way
that we could return to original process if exec()
fails to execute.
Thats why we usually use fork() & exec()
, so that we can safely return to main process
without losing anything :).
what stays:
PID
,PPID
- opened file descriptors
- current directory, root directory
what does not:
- code
- stack
- heap
- data
(new stack and new heap)
sufixes:
l
~ arguments are passed as function argumentsv
~ arguments are passed by char arrayp
~ search in$PATH
for provided executableP
~ specifying that we will provide a path to an executablee
~ enviromental variables are provided in a char array