| 5 |
|
* Parallel network process handling routines |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include <stdlib.h> |
| 9 |
|
#include <stdio.h> |
| 10 |
+ |
#include <string.h> |
| 11 |
|
#include <signal.h> |
| 12 |
|
#include <fcntl.h> |
| 13 |
|
#include <unistd.h> |
| 19 |
|
|
| 20 |
|
PSERVER *pslist = NULL; /* global process server list */ |
| 21 |
|
|
| 22 |
< |
static PROC *pindex[FD_SETSIZE]; /* process index table */ |
| 22 |
> |
static NETPROC *pindex[FD_SETSIZE]; /* process index table */ |
| 23 |
|
|
| 24 |
|
static char ourhost[64]; /* this host name */ |
| 25 |
|
static char ourdir[PATH_MAX]; /* our working directory */ |
| 31 |
|
|
| 32 |
|
extern char *remsh; /* externally defined remote shell program */ |
| 33 |
|
|
| 32 |
– |
extern char *getenv(); |
| 34 |
|
|
| 34 |
– |
|
| 35 |
|
PSERVER * |
| 36 |
|
addpserver(host, dir, usr, np) /* add a new process server */ |
| 37 |
|
char *host, *dir, *usr; |
| 41 |
|
/* allocate the struct */ |
| 42 |
|
if (np < 1) |
| 43 |
|
return(NULL); |
| 44 |
< |
ps = (PSERVER *)malloc(sizeof(PSERVER)+(np-1)*sizeof(PROC)); |
| 44 |
> |
ps = (PSERVER *)malloc(sizeof(PSERVER)+(np-1)*sizeof(NETPROC)); |
| 45 |
|
if (ps == NULL) |
| 46 |
|
return(NULL); |
| 47 |
|
if (!ourhost[0]) { /* initialize */ |
| 232 |
|
{ |
| 233 |
|
char errbuf[BUFSIZ]; |
| 234 |
|
int nr; |
| 235 |
< |
register PROC *pp; |
| 235 |
> |
register NETPROC *pp; |
| 236 |
|
/* look up associated process */ |
| 237 |
|
if ((pp = pindex[fd]) == NULL) |
| 238 |
|
abort(); /* serious consistency error */ |
| 286 |
|
int pn; |
| 287 |
|
int status; |
| 288 |
|
{ |
| 289 |
< |
register PROC *pp; |
| 289 |
> |
register NETPROC *pp; |
| 290 |
|
|
| 291 |
|
pp = ps->proc + pn; |
| 292 |
|
if (pp->cf != NULL) /* client cleanup */ |