Exemplo n.º 1
0
int main()
{
  int i, n, pid, r;

  start(10);
  system("cp ../t10a .");
  pid = getpid();

  /* Create files t10b ... t10h */
  mkfiles();

  if (getpid() == pid)
	if (fork() == 0) {
		execl("t10a", "t10a", (char *) 0);
		exit(0);
	}
  if (getpid() == pid)
	if (fork() == 0) {
		execl("t10b", "t10b", (char *) 0);
		exit(0);
	}
  if (getpid() == pid)
	if (fork() == 0) {
		execl("t10c", "t10c", (char *) 0);
		exit(0);
	}
  if (getpid() == pid)
	if (fork() == 0) {
		execl("t10d", "t10d", (char *) 0);
		exit(0);
	}

  srand(100);
  for (i = 0; i < 60; i++) {
	r = rand() & 07;
	spawn(r);
  }

  for (i = 0; i < 4; i++) wait(&n);
  rmfiles();
  quit();
  return(-1);			/* impossible */
}
Exemplo n.º 2
0
Arquivo: pack.c Projeto: Artoria/cpack
int main(void){
  mkfiles();
  runstring();
  return 0;
}