--- ray/src/util/netproc.c 2003/10/27 10:32:06 2.12 +++ ray/src/util/netproc.c 2004/03/26 21:36:19 2.15 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: netproc.c,v 2.12 2003/10/27 10:32:06 schorsch Exp $"; +static const char RCSid[] = "$Id: netproc.c,v 2.15 2004/03/26 21:36:19 schorsch Exp $"; #endif /* * Parallel network process handling routines @@ -11,11 +11,12 @@ static const char RCSid[] = "$Id: netproc.c,v 2.12 200 #include #include #include +#include +#include "rtmisc.h" #include "selcall.h" #include "netproc.h" #include "paths.h" -#include "vfork.h" PSERVER *pslist = NULL; /* global process server list */ @@ -31,11 +32,18 @@ static int maxfd; /* maximum assigned descriptor */ extern char *remsh; /* externally defined remote shell program */ +static int readerrs(int fd); +static void wait4end(void); +static int finishjob(PSERVER *ps, int pn, int status); -PSERVER * -addpserver(host, dir, usr, np) /* add a new process server */ -char *host, *dir, *usr; -int np; + +extern PSERVER * +addpserver( /* add a new process server */ + char *host, + char *dir, + char *usr, + int np +) { register PSERVER *ps; /* allocate the struct */ @@ -104,8 +112,10 @@ int np; } -delpserver(ps) /* delete a process server */ -PSERVER *ps; +extern void +delpserver( /* delete a process server */ + PSERVER *ps +) { PSERVER pstart; register PSERVER *psp; @@ -128,9 +138,10 @@ PSERVER *ps; } -PSERVER * -findjob(pnp) /* find out where process is running */ -register int *pnp; /* modified */ +extern PSERVER * +findjob( /* find out where process is running */ + register int *pnp /* modified */ +) { register PSERVER *ps; register int i; @@ -145,11 +156,12 @@ register int *pnp; /* modified */ } -int -startjob(ps, command, compf) /* start a job on a process server */ -register PSERVER *ps; -char *command; -int (*compf)(); +extern int +startjob( /* start a job on a process server */ + register PSERVER *ps, + char *command, + pscompfunc *compf +) { char udirt[PATH_MAX]; char *av[16]; @@ -173,7 +185,7 @@ int (*compf)(); exit(1); } /* start child process */ - if ((pid = vfork()) == 0) { + if ((pid = fork()) == 0) { close(pfd[0]); /* connect stderr to pipe */ if (pfd[1] != 2) { dup2(pfd[1], 2); @@ -227,8 +239,9 @@ int (*compf)(); static int -readerrs(fd) /* read error output from fd */ -int fd; +readerrs( /* read error output from fd */ + int fd +) { char errbuf[BUFSIZ]; int nr; @@ -258,8 +271,8 @@ int fd; } -static -wait4end() /* read error streams until someone is done */ +static void +wait4end(void) /* read error streams until someone is done */ { fd_set readfds, excepfds; register int i; @@ -281,10 +294,11 @@ wait4end() /* read error streams until someone is do static int -finishjob(ps, pn, status) /* clean up finished process */ -PSERVER *ps; -int pn; -int status; +finishjob( /* clean up finished process */ + PSERVER *ps, + int pn, + int status +) { register NETPROC *pp; @@ -305,10 +319,11 @@ int status; } -int -wait4job(ps, pid) /* wait for process to finish */ -PSERVER *ps; -int pid; +extern int +wait4job( /* wait for process to finish */ + PSERVER *ps, + int pid +) { int status, psn, psn2; PSERVER *ps2;