.

:


? !




 

- 䳿 exec(), .

 

exec , , .

. execve.

 

3 ѳ exec

 

l - list

e - environ

v -

p - PATH

 

#include <unistd.h>

int execl (path, arg0, arg1, ..., argn, (char*)0)

char *path, *arg0, *arg1, ..., *argn;

int execv (path, argv)

char *path, *argv[];

int execle (path, arg0, arg1, ..., argn, (char*)0, envp)

char *path, *arg0, *arg1,..., *argn, *envp[];

int execve (path, argv, envp)

char *path, *argv[], *envp[];

int execlp (file, arg0, arg1, ..., argn, (char*)0)

char *file, *arg0, *arg1,..., *argn;

int execvp (file, argv)

char *file, *argv[];

 

Apye path aa ' a, o opa poec.

Apye file ae aae ' a, o opa poec. Ec apye file e co /, pec e a oc caoo e aax ae epeeo PATH.

Apye arg0, arg1, ..., argn a coo, coo NUL. coo cco apye, epea ooy opay poec. Apye arg0 a , c path, path.

Apye argv aco a co , coo NUL. coo cco apye, epea ooy opay poec. Apye argv[0] a , c path, path.

Apye envp ec aco a co , coo NUL. coo oa cpe ooo opa poec. ee ac y .

B aepe e ypa ae cap opa poec. ypa cap opa, ae -1 errno aocc o .

 

:

− a e ,

− pec e a e aaoo.

− e a aao pec e a,

− a e ,

− ,

− a , opa e c opao oᒺoo a,

− o a co poeypo (pa ceeo cpy), a ac py ,

− ' .

− co a cc apye pe cce 512 a.

− ooo a e aoo,

− pec aa path, argv envp xo a apecoo poc poec.

 






: 2015-09-20; !; : 324 | |


:

:

:





© 2015-2021 lektsii.org - -

: 0.002 .