/* send the monitor thread a pointer to the ping action */
write(c->mgr_pipe[1], &err, 1);
- read(c->mon_pipe[0], &err, 1);
}
static void remove_old(void)
struct active_array *arrays;
int sock; /* listen to external programs */
int mgr_pipe[2]; /* communicate between threads */
- int mon_pipe[2]; /* communicate between threads */
int devnum;
char *devname; /* e.g. md0. This appears in metadata_verison:
* external:/md0/12
rv = pipe(container->mgr_pipe);
if (rv < 0)
return rv;
- rv = pipe(container->mon_pipe);
- if (rv < 0)
- goto err_mon_pipe;
rv = clone(run_child, stack+4096-64,
CLONE_FS|CLONE_FILES|CLONE_VM|CLONE_SIGHAND|CLONE_THREAD,
return rv;
err_clone:
- close(container->mon_pipe[0]);
- close(container->mon_pipe[1]);
- err_mon_pipe:
close(container->mgr_pipe[0]);
close(container->mgr_pipe[1]);
#endif
static int wait_and_act(struct supertype *container, int pfd,
- int monfd, int nowait)
+ int nowait)
{
fd_set rfds;
int maxfd = 0;
if (read(pfd, &err, 1) > 0)
err = handle_pipe(active_cmd, *aap);
- write(monfd, &err, 1);
}
}
int first = 1;
do {
rv = wait_and_act(container, container->mgr_pipe[0],
- container->mon_pipe[1], first);
+ first);
first = 0;
} while (rv >= 0);
}