Lines Matching full:workers
82 * sends writeheader()'s and lists of daddr's to the workers via pipes.
83 * The following structure defines the instruction packets sent to workers.
91 #define WORKERS 3 /* 1 worker writing, 1 reading, 1 for slack */ macro
103 } workers[WORKERS+1]; variable
139 for (i = 0; i <= WORKERS; i++) { in alloctape()
144 workers[i].tblock = (char (*)[TP_BSIZE]) in alloctape()
146 workers[i].req = (struct req *)workers[i].tblock - ntrec - 1; in alloctape()
148 wp = &workers[0]; in alloctape()
238 if (++wp >= &workers[WORKERS]) in flushtape()
239 wp = &workers[0]; in flushtape()
258 for (i = 0; i < WORKERS; i++) { in flushtape()
259 if (workers[i].sent) { in flushtape()
260 if (atomic_read(workers[i].fd, in flushtape()
266 workers[i].sent = 0; in flushtape()
308 for (f = 0; f < WORKERS; f++) { in trewind()
317 if (workers[f].sent) { in trewind()
318 if (atomic_read(workers[f].fd, (void *)&got, sizeof got) in trewind()
323 workers[f].sent = 0; in trewind()
330 (void) close(workers[f].fd); in trewind()
332 while (wait((int *)NULL) >= 0) /* wait for any signals from workers */ in trewind()
396 twp = &workers[WORKERS]; in rollforward()
400 * Each of the N workers should have requests that need to in rollforward()
402 * (workers[WORKERS]) to construct request lists to be sent to in rollforward()
405 for (i = 0; i < WORKERS; i++) { in rollforward()
447 if (++wp >= &workers[WORKERS]) in rollforward()
448 wp = &workers[0]; in rollforward()
478 * Clear the first workers' response. One hopes that it in rollforward()
630 create_workers(); /* Share open tape file descriptor with workers */ in startnewtape()
682 * proceed - handler for SIGUSR2, used to synchronize IO between the workers.
706 for (i = 0; i < WORKERS; i++) { in create_workers()
707 if (i == wp - &workers[0]) { in create_workers()
714 (workers[i].pid = fork()) < 0) in create_workers()
715 quit("too many workers, %d (recompile smaller): %s\n", in create_workers()
718 workers[i].fd = cmd[1]; in create_workers()
719 workers[i].sent = 0; in create_workers()
720 if (workers[i].pid == 0) { /* Worker starts up here */ in create_workers()
722 (void) close(workers[j].fd); in create_workers()
729 for (i = 0; i < WORKERS; i++) in create_workers()
730 (void) atomic_write(workers[i].fd, in create_workers()
731 (const void *) &workers[(i + 1) % WORKERS].pid, in create_workers()
732 sizeof workers[0].pid); in create_workers()
742 for (i = 0; i < WORKERS; i++) in killall()
743 if (workers[i].pid > 0) { in killall()
744 (void) kill(workers[i].pid, SIGKILL); in killall()
745 workers[i].sent = 0; in killall()