1 |
– |
/* Copyright (c) 1996 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Parallel network process handling routines |
6 |
|
*/ |
7 |
|
|
8 |
|
#include <stdio.h> |
12 |
– |
#include <sys/types.h> |
13 |
– |
#include <sys/param.h> |
9 |
|
#include <signal.h> |
10 |
|
#include <fcntl.h> |
11 |
+ |
#include "selcall.h" |
12 |
|
#include "netproc.h" |
13 |
+ |
#include "paths.h" |
14 |
|
#include "vfork.h" |
18 |
– |
/* select call compatibility stuff */ |
19 |
– |
#ifndef FD_SETSIZE |
20 |
– |
#include <sys/param.h> |
21 |
– |
#define FD_SETSIZE NOFILE /* maximum # select file descriptors */ |
22 |
– |
#endif |
23 |
– |
#ifndef FD_SET |
24 |
– |
#ifndef NFDBITS |
25 |
– |
#define NFDBITS (8*sizeof(int)) /* number of bits per fd_mask */ |
26 |
– |
#endif |
27 |
– |
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) |
28 |
– |
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) |
29 |
– |
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) |
30 |
– |
#ifndef BSD |
31 |
– |
#define bzero(d,n) (void)memset(d,0,n) |
32 |
– |
#endif |
33 |
– |
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) |
34 |
– |
#endif |
15 |
|
|
16 |
|
PSERVER *pslist = NULL; /* global process server list */ |
17 |
|
|
18 |
|
static PROC *pindex[FD_SETSIZE]; /* process index table */ |
19 |
|
|
20 |
|
static char ourhost[64]; /* this host name */ |
21 |
< |
static char ourdir[MAXPATHLEN]; /* our working directory */ |
21 |
> |
static char ourdir[MAXPATH]; /* our working directory */ |
22 |
|
static char ouruser[32]; /* our user name */ |
23 |
|
static char *ourshell; /* our user's shell */ |
24 |
|
|
27 |
|
|
28 |
|
extern char *remsh; /* externally defined remote shell program */ |
29 |
|
|
50 |
– |
extern char *malloc(), *realloc(); |
30 |
|
extern char *getenv(); |
31 |
|
|
32 |
|
|
43 |
|
if (ps == NULL) |
44 |
|
return(NULL); |
45 |
|
if (!ourhost[0]) { /* initialize */ |
46 |
< |
char dirtmp[MAXPATHLEN]; |
46 |
> |
char dirtmp[MAXPATH]; |
47 |
|
register char *cp; |
48 |
|
register int len; |
49 |
|
|
122 |
|
/* remove server from list */ |
123 |
|
psp->next = ps->next; |
124 |
|
pslist = pstart.next; |
125 |
< |
free((char *)ps); /* free associated memory */ |
125 |
> |
free((void *)ps); /* free associated memory */ |
126 |
|
} |
127 |
|
|
128 |
|
|
149 |
|
char *command; |
150 |
|
int (*compf)(); |
151 |
|
{ |
152 |
< |
char udirt[MAXPATHLEN]; |
152 |
> |
char udirt[MAXPATH]; |
153 |
|
char *av[16]; |
154 |
|
int pfd[2], pid; |
155 |
|
register int i; |
292 |
|
close(pp->efd); /* close error stream */ |
293 |
|
pindex[pp->efd] = NULL; |
294 |
|
FD_CLR(pp->efd, &errdesc); |
295 |
< |
free((char *)pp->errs); |
295 |
> |
free((void *)pp->errs); |
296 |
|
pp->com = NULL; /* clear settings */ |
297 |
|
pp->pid = -1; |
298 |
|
pp->efd = -1; |