There's an example below. As far as sending signals go you'd either have to do it through your own proprietary messages through the pipes or you can signal out of band using "kill()" and "signal()" calls. There is no inherent OS method of signaling through a pipe itself. Matt Fahrner Manager of Networking Burlington Coat Factory /* * pipefork(): create a piped fork. * * pipefork() duplicates fork(2) in every respect except that upon * successful completion, both parent and child's passed "pipes" will * be filled in with a pair of crossed pipe(2)s. Anything written on * the parent's writable descriptor will end up on the child's * readable descriptor, likewise anything written on the child's * writable descriptor will end up on the parent's readable * descriptor. * * Returns -1 on error, 0 on success for child, or "pid" for parent * (per fork(2)). */ static char SCCS[] = "@(#)pipefork.c 1.3 Matt Fahrner, BCF 1990"; #define PIPE_READ 0 #define PIPE_WRITE 1 int pipefork(pipes) int pipes[2]; { int pipe_p_to_c[2]; /* Write parent to read child */ int pipe_c_to_p[2]; /* Write child to read parent */ int pid; int loop; /* First create two pair of pipes, one for each direction */ pipe_p_to_c[0] = pipe_c_to_p[0] = -1; /* For error cleanup */ pipe_p_to_c[1] = pipe_c_to_p[1] = -1; if (pipe(pipe_p_to_c) == -1) goto FAIL; if (pipe(pipe_c_to_p) == -1) goto FAIL; /* Now fork() off cross piping */ switch (pid = fork()) { case -1: /* Failed fork */ goto FAIL; case 0: /* Child */ pipes[PIPE_READ] = pipe_p_to_c[PIPE_READ]; pipes[PIPE_WRITE] = pipe_c_to_p[PIPE_WRITE]; (void)close(pipe_p_to_c[PIPE_WRITE]); /* Close unused */ (void)close(pipe_c_to_p[PIPE_READ]); return(0); default: /* Parent */ pipes[PIPE_READ] = pipe_c_to_p[PIPE_READ]; pipes[PIPE_WRITE] = pipe_p_to_c[PIPE_WRITE]; (void)close(pipe_c_to_p[PIPE_WRITE]); /* Close unused */ (void)close(pipe_p_to_c[PIPE_READ]); return(pid); } FAIL: for (loop = 0; loop < 2; ++loop) { /* Cleanup pipes */ (void)close(pipe_p_to_c[loop]); (void)close(pipe_c_to_p[loop]); } return(-1); /* Fail! */ }
begin:vcard n:Fahrner;Matt tel;pager:(603) 639-4142 tel;fax:(603) 443-6190 tel;work:(603) 448-4100 xt 5150 x-mozilla-html:FALSE url:http://www.gizzy.com/matt org:Burlington Coat Factory Warehouse;MIS Networking version:2.1 email;internet:[EMAIL PROTECTED] title:Manager of Networking adr;quoted-printable:;;2 South Park St.=0D=0AWillis House;Lebanon;NH;03766;USA x-mozilla-cpt:;-3648 fn:Matt Fahrner end:vcard