DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T e

⟦490223364⟧ TextFile

    Length: 800 (0x320)
    Types: TextFile
    Names: »execs.c«

Derivation

└─⟦db229ac7e⟧ Bits:30007240 EUUGD20: SSBA 1.2 / AFW Benchmarks
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21E/bsd/execs.c« 
    └─⟦this⟧ »EUUGD20/AFUU-ssba1.21/ssba1.21F/bsd/execs.c« 

TextFile

main(argc, argv)
	char	*argv[];
{
	register int nexecs, i;
	char *cp, *sbrk();
	int pid,child,status,brksize;

	if (argc < 3){
		printf("usage : %s number-of-execs sbrk-size job-name\n", argv[0]);
		exit(1);
	}
	nexecs = atoi(argv[1]);
	if (nexecs < 0 ){
		printf("%s: bad number of execs \n", argv[1]);
		exit(2);
	}
	brksize = atoi(argv[2]);
	if (brksize < 0 ){
		printf("%s: bad size to sbrk \n", argv[2]);
		exit(3);
	}
	cp = sbrk(brksize);
	if((int)cp == -1){
		perror("sbrk");
		exit(4);
	}
	for (i = 0; i < brksize; i += 1024)
		cp[i] = i;
	while (nexecs-- > 0){
		child = fork();
		if (child == -1){
			perror("fork");
			exit(-1);
		}
		if (child == 0){
			execv(argv[3], argv);
			perror("execv");
			exit(-1);
		}
		while((pid = wait(&status)) != -1 && pid != child)
				;
	}
	exit(0);
}