ProvaPratica 2009.01.15

From Sistemi Operativi
Revision as of 15:04, 28 April 2014 by Stefano 92 (talk | contribs) (Created page with "<h1>http://www.cs.unibo.it/~renzo/so/compiti/2009-01-15.pdf</h1> == Esercizio 1 == <syntaxhighlight lang="C"> #include <stdio.h> #include <stdlib.h> #include <unistd.h> i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

http://www.cs.unibo.it/~renzo/so/compiti/2009-01-15.pdf


Esercizio 1

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc,char*argv[])
{
	int ris;
	ris=fork();
	while(ris>0)
	{
		printf("%d\n",ris);
		wait(&ris);
		if (WIFSIGNALED(ris))
			ris=fork();
		else
			return(0);
	}
	execvp(argv[1],argv+1);
	return(0);
}

stefano92