| 1 |
– |
/* Copyright (c) 1991 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 |
|
* Routines to communicate with separate process via dual pipes |
| 6 |
+ |
* |
| 7 |
+ |
* External symbols declared in standard.h |
| 8 |
|
*/ |
| 9 |
|
|
| 10 |
+ |
#include "copyright.h" |
| 11 |
+ |
|
| 12 |
|
/* find pipe buffer limit */ |
| 13 |
|
#include <sys/param.h> |
| 14 |
|
|
| 26 |
|
|
| 27 |
|
#include "vfork.h" |
| 28 |
|
|
| 29 |
+ |
#ifndef BSD |
| 30 |
+ |
#include <errno.h> |
| 31 |
+ |
#endif |
| 32 |
|
|
| 33 |
+ |
|
| 34 |
|
int |
| 35 |
|
open_process(pd, av) /* open communication to separate process */ |
| 36 |
|
int pd[3]; |
| 105 |
|
char *bpos; |
| 106 |
|
int siz; |
| 107 |
|
{ |
| 108 |
< |
register int cc, nrem = siz; |
| 109 |
< |
|
| 108 |
> |
register int cc = 0, nrem = siz; |
| 109 |
> |
retry: |
| 110 |
|
while (nrem > 0 && (cc = read(fd, bpos, nrem)) > 0) { |
| 111 |
|
bpos += cc; |
| 112 |
|
nrem -= cc; |
| 113 |
|
} |
| 114 |
< |
if (cc < 0) |
| 114 |
> |
if (cc < 0) { |
| 115 |
> |
#ifndef BSD |
| 116 |
> |
if (errno == EINTR) /* we were interrupted! */ |
| 117 |
> |
goto retry; |
| 118 |
> |
#endif |
| 119 |
|
return(cc); |
| 120 |
+ |
} |
| 121 |
|
return(siz-nrem); |
| 122 |
|
} |
| 123 |
|
|
| 128 |
|
char *bpos; |
| 129 |
|
int siz; |
| 130 |
|
{ |
| 131 |
< |
register int cc, nrem = siz; |
| 132 |
< |
|
| 131 |
> |
register int cc = 0, nrem = siz; |
| 132 |
> |
retry: |
| 133 |
|
while (nrem > 0 && (cc = write(fd, bpos, nrem)) > 0) { |
| 134 |
|
bpos += cc; |
| 135 |
|
nrem -= cc; |
| 136 |
|
} |
| 137 |
< |
if (cc < 0) |
| 137 |
> |
if (cc < 0) { |
| 138 |
> |
#ifndef BSD |
| 139 |
> |
if (errno == EINTR) /* we were interrupted! */ |
| 140 |
> |
goto retry; |
| 141 |
> |
#endif |
| 142 |
|
return(cc); |
| 143 |
+ |
} |
| 144 |
|
return(siz-nrem); |
| 145 |
|
} |