| 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> |
| 9 |
|
#include <signal.h> |
| 10 |
|
#include <fcntl.h> |
| 11 |
+ |
#include "selcall.h" |
| 12 |
|
#include "netproc.h" |
| 13 |
+ |
#include "paths.h" |
| 14 |
|
#include "vfork.h" |
| 17 |
– |
/* select call compatibility stuff */ |
| 18 |
– |
#ifndef FD_SETSIZE |
| 19 |
– |
#include <sys/param.h> |
| 20 |
– |
#define FD_SETSIZE NOFILE /* maximum # select file descriptors */ |
| 21 |
– |
#endif |
| 22 |
– |
#ifndef FD_SET |
| 23 |
– |
#ifndef NFDBITS |
| 24 |
– |
#define NFDBITS (8*sizeof(int)) /* number of bits per fd_mask */ |
| 25 |
– |
#endif |
| 26 |
– |
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) |
| 27 |
– |
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) |
| 28 |
– |
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) |
| 29 |
– |
#ifndef BSD |
| 30 |
– |
#define bzero(d,n) (void)memset(d,0,n) |
| 31 |
– |
#endif |
| 32 |
– |
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) |
| 33 |
– |
#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[128]; /* 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 |
|
|
| 49 |
– |
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[128]; |
| 46 |
> |
char dirtmp[MAXPATH]; |
| 47 |
|
register char *cp; |
| 48 |
|
register int len; |
| 49 |
|
|
| 50 |
|
strcpy(ourhost, myhostname()); |
| 51 |
< |
getcwd(dirtmp, sizeof(dirtmp)); |
| 51 |
> |
getwd(dirtmp); |
| 52 |
|
if ((cp = getenv("HOME")) != NULL) { |
| 53 |
|
if (!strcmp(cp, dirtmp)) |
| 54 |
|
ourdir[0] = '\0'; |
| 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[128]; |
| 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; |