| 13 |
|
#include <sys/uio.h> |
| 14 |
|
|
| 15 |
|
#ifndef HDSUF |
| 16 |
< |
#define HDSUF ".hdisp" |
| 16 |
> |
#define HDSUF ".hdi" |
| 17 |
|
#endif |
| 18 |
|
|
| 19 |
|
static int inp_flags; |
| 105 |
|
goto readerr; |
| 106 |
|
} |
| 107 |
|
switch (msg.type) { /* take appropriate action */ |
| 108 |
< |
case DR_BUNDLE: |
| 108 |
> |
case DR_BUNDLE: /* new bundle to calculate */ |
| 109 |
|
if (msg.nbytes != sizeof(PACKHEAD)) |
| 110 |
|
error(INTERNAL, "bad DR_BUNDLE from display process"); |
| 111 |
|
bundle_set(BS_ADD, (PACKHEAD *)buf, 1); |
| 112 |
|
break; |
| 113 |
< |
case DR_NEWSET: |
| 113 |
> |
case DR_NEWSET: /* new calculation set */ |
| 114 |
|
if (msg.nbytes % sizeof(PACKHEAD)) |
| 115 |
|
error(INTERNAL, "bad DR_NEWSET from display process"); |
| 116 |
|
disp_result(DS_STARTIMM, 0, NULL); |
| 118 |
|
disp_result(DS_ENDIMM, 0, NULL); |
| 119 |
|
disp_flush(); |
| 120 |
|
break; |
| 121 |
< |
case DR_ADDSET: |
| 121 |
> |
case DR_ADDSET: /* add to calculation set */ |
| 122 |
|
if (msg.nbytes % sizeof(PACKHEAD)) |
| 123 |
|
error(INTERNAL, "bad DR_ADDSET from display process"); |
| 124 |
|
disp_result(DS_STARTIMM, 0, NULL); |
| 125 |
|
bundle_set(BS_ADD, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); |
| 126 |
|
disp_result(DS_ENDIMM, 0, NULL); |
| 127 |
< |
disp_check(0); /* hack -- delete usu. follows add */ |
| 127 |
> |
disp_flush(); |
| 128 |
|
break; |
| 129 |
< |
case DR_ADJSET: |
| 129 |
> |
case DR_ADJSET: /* adjust calculation set members */ |
| 130 |
|
if (msg.nbytes % sizeof(PACKHEAD)) |
| 131 |
|
error(INTERNAL, "bad DR_ADJSET from display process"); |
| 132 |
|
disp_result(DS_STARTIMM, 0, NULL); |
| 134 |
|
disp_result(DS_ENDIMM, 0, NULL); |
| 135 |
|
disp_flush(); |
| 136 |
|
break; |
| 137 |
< |
case DR_DELSET: |
| 137 |
> |
case DR_DELSET: /* delete from calculation set */ |
| 138 |
|
if (msg.nbytes % sizeof(PACKHEAD)) |
| 139 |
|
error(INTERNAL, "bad DR_DELSET from display process"); |
| 140 |
|
bundle_set(BS_DEL, (PACKHEAD *)buf, msg.nbytes/sizeof(PACKHEAD)); |
| 141 |
|
break; |
| 142 |
< |
case DR_ATTEN: |
| 142 |
> |
case DR_ATTEN: /* block for priority request */ |
| 143 |
|
if (msg.nbytes) |
| 144 |
|
error(INTERNAL, "bad DR_ATTEN from display process"); |
| 145 |
|
/* send acknowledgement */ |
| 146 |
|
disp_result(DS_ACKNOW, 0, NULL); |
| 147 |
|
return(disp_check(1)); /* block on following request */ |
| 148 |
< |
case DR_SHUTDOWN: |
| 148 |
> |
case DR_KILL: /* kill computation process(es) */ |
| 149 |
|
if (msg.nbytes) |
| 150 |
+ |
error(INTERNAL, "bad DR_KILL from display process"); |
| 151 |
+ |
if (nprocs > 0) |
| 152 |
+ |
done_rtrace(); |
| 153 |
+ |
else |
| 154 |
+ |
error(WARNING, "no rtrace process to kill"); |
| 155 |
+ |
break; |
| 156 |
+ |
case DR_RESTART: /* restart computation process(es) */ |
| 157 |
+ |
if (msg.nbytes) |
| 158 |
+ |
error(INTERNAL, "bad DR_RESTART from display process"); |
| 159 |
+ |
if (ncprocs > nprocs) |
| 160 |
+ |
new_rtrace(); |
| 161 |
+ |
else if (nprocs > 0) |
| 162 |
+ |
error(WARNING, "rtrace already runnning"); |
| 163 |
+ |
else |
| 164 |
+ |
error(WARNING, "holodeck not open for writing"); |
| 165 |
+ |
break; |
| 166 |
+ |
case DR_CLOBBER: /* clobber holodeck */ |
| 167 |
+ |
if (msg.nbytes) |
| 168 |
+ |
error(INTERNAL, "bad DR_CLOBBER from display process"); |
| 169 |
+ |
if (!force || !ncprocs) |
| 170 |
+ |
error(WARNING, "request to clobber holodeck denied"); |
| 171 |
+ |
else { |
| 172 |
+ |
error(WARNING, "clobbering holodeck contents"); |
| 173 |
+ |
hdclobber(NULL); |
| 174 |
+ |
} |
| 175 |
+ |
break; |
| 176 |
+ |
case DR_SHUTDOWN: /* shut down program */ |
| 177 |
+ |
if (msg.nbytes) |
| 178 |
|
error(INTERNAL, "bad DR_SHUTDOWN from display process"); |
| 179 |
|
return(0); /* zero return signals shutdown */ |
| 180 |
< |
case DR_NOOP: |
| 180 |
> |
case DR_NOOP: /* do nothing */ |
| 181 |
|
break; |
| 182 |
|
default: |
| 183 |
|
error(INTERNAL, "unrecognized request from display process"); |