28.11.2014 Views

System call - Processi, thread

System call - Processi, thread

System call - Processi, thread

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

M-fosset - Sistemi Operativi 2004-2005<br />

Esempio: execve<br />

char *env[]={“USER=anna”, “PATH=/home/anna/d1”, (char<br />

*)0};<br />

char *argv[]={“ls”,”-l”, “pippo”, (char *)0};<br />

main()<br />

{int pid, status;<br />

pid=fork();<br />

if (pid==0)<br />

}<br />

{execve(“/bin/ls”, argv, env);<br />

printf(“exec fallita!\n”);<br />

exit(1);<br />

else if (pid >0)<br />

{ pid=wait(&status); /* gestione dello stato.. */<br />

}<br />

else printf(“fork fallita!);<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!