Merge lp:~jontai/openvista-gtm-integration/bug683878 into lp:openvista-gtm-integration
- bug683878
- Merge into mainline
Proposed by
Jon Tai
Status: | Merged |
---|---|
Merged at revision: | 144 |
Proposed branch: | lp:~jontai/openvista-gtm-integration/bug683878 |
Merge into: | lp:openvista-gtm-integration |
Diff against target: |
711 lines (+625/-18) 6 files modified
kids/XU_80_1508.KID (+496/-0) mumps/XU1508E.m (+18/-0) mumps/ZISTCPS.m (+7/-4) src/libopenvista/GTMSRV.m (+6/-2) src/libopenvista/gtmserver.c (+97/-12) src/libopenvista/openvista.xc.in (+1/-0) |
To merge this branch: | bzr merge lp:~jontai/openvista-gtm-integration/bug683878 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
jeff.apple | Approve | ||
Review via email:
|
Commit message
Description of the change
This is the packaging work around lp:~jeff-apple/openvista-gtm-integration/listener. This merge would supersede that merge.
Unfortunately, to make sure the MUMPS code and the C code get upgraded together, the fix itself had to be altered substantially, so I'm putting it up for review again.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'kids/XU_80_1508.KID' |
2 | --- kids/XU_80_1508.KID 1970-01-01 00:00:00 +0000 |
3 | +++ kids/XU_80_1508.KID 2010-12-04 06:46:54 +0000 |
4 | @@ -0,0 +1,496 @@ |
5 | +KIDS Distribution saved on Dec 03, 2010@21:05:29 |
6 | +artf10843, run ZTMGRSET after installing |
7 | +**KIDS**:XU*8.0*1508^ |
8 | + |
9 | +**INSTALL NAME** |
10 | +XU*8.0*1508 |
11 | +"BLD",7335,0) |
12 | +XU*8.0*1508^KERNEL^0^3101203^n |
13 | +"BLD",7335,4,0) |
14 | +^9.64PA^^ |
15 | +"BLD",7335,6.3) |
16 | +1 |
17 | +"BLD",7335,"ABPKG") |
18 | +n |
19 | +"BLD",7335,"INID") |
20 | +y |
21 | +"BLD",7335,"KRN",0) |
22 | +^9.67PA^8989.52^19 |
23 | +"BLD",7335,"KRN",.4,0) |
24 | +.4 |
25 | +"BLD",7335,"KRN",.401,0) |
26 | +.401 |
27 | +"BLD",7335,"KRN",.402,0) |
28 | +.402 |
29 | +"BLD",7335,"KRN",.403,0) |
30 | +.403 |
31 | +"BLD",7335,"KRN",.5,0) |
32 | +.5 |
33 | +"BLD",7335,"KRN",.84,0) |
34 | +.84 |
35 | +"BLD",7335,"KRN",3.6,0) |
36 | +3.6 |
37 | +"BLD",7335,"KRN",3.8,0) |
38 | +3.8 |
39 | +"BLD",7335,"KRN",9.2,0) |
40 | +9.2 |
41 | +"BLD",7335,"KRN",9.8,0) |
42 | +9.8 |
43 | +"BLD",7335,"KRN",9.8,"NM",0) |
44 | +^9.68A^1^1 |
45 | +"BLD",7335,"KRN",9.8,"NM",1,0) |
46 | +ZISTCPS^^0^B20023114 |
47 | +"BLD",7335,"KRN",9.8,"NM","B","ZISTCPS",1) |
48 | + |
49 | +"BLD",7335,"KRN",19,0) |
50 | +19 |
51 | +"BLD",7335,"KRN",19.1,0) |
52 | +19.1 |
53 | +"BLD",7335,"KRN",101,0) |
54 | +101 |
55 | +"BLD",7335,"KRN",409.61,0) |
56 | +409.61 |
57 | +"BLD",7335,"KRN",771,0) |
58 | +771 |
59 | +"BLD",7335,"KRN",870,0) |
60 | +870 |
61 | +"BLD",7335,"KRN",8989.51,0) |
62 | +8989.51 |
63 | +"BLD",7335,"KRN",8989.52,0) |
64 | +8989.52 |
65 | +"BLD",7335,"KRN",8994,0) |
66 | +8994 |
67 | +"BLD",7335,"KRN","B",.4,.4) |
68 | + |
69 | +"BLD",7335,"KRN","B",.401,.401) |
70 | + |
71 | +"BLD",7335,"KRN","B",.402,.402) |
72 | + |
73 | +"BLD",7335,"KRN","B",.403,.403) |
74 | + |
75 | +"BLD",7335,"KRN","B",.5,.5) |
76 | + |
77 | +"BLD",7335,"KRN","B",.84,.84) |
78 | + |
79 | +"BLD",7335,"KRN","B",3.6,3.6) |
80 | + |
81 | +"BLD",7335,"KRN","B",3.8,3.8) |
82 | + |
83 | +"BLD",7335,"KRN","B",9.2,9.2) |
84 | + |
85 | +"BLD",7335,"KRN","B",9.8,9.8) |
86 | + |
87 | +"BLD",7335,"KRN","B",19,19) |
88 | + |
89 | +"BLD",7335,"KRN","B",19.1,19.1) |
90 | + |
91 | +"BLD",7335,"KRN","B",101,101) |
92 | + |
93 | +"BLD",7335,"KRN","B",409.61,409.61) |
94 | + |
95 | +"BLD",7335,"KRN","B",771,771) |
96 | + |
97 | +"BLD",7335,"KRN","B",870,870) |
98 | + |
99 | +"BLD",7335,"KRN","B",8989.51,8989.51) |
100 | + |
101 | +"BLD",7335,"KRN","B",8989.52,8989.52) |
102 | + |
103 | +"BLD",7335,"KRN","B",8994,8994) |
104 | + |
105 | +"BLD",7335,"MSC") |
106 | +/home/jon/XU_80_1508.KID |
107 | +"BLD",7335,"MSCOM") |
108 | +artf10843, run ZTMGRSET after installing |
109 | +"BLD",7335,"PRE") |
110 | +XU1508E |
111 | +"BLD",7335,"QUES",0) |
112 | +^9.62^^ |
113 | +"BLD",7335,"REQB",0) |
114 | +^9.611^^ |
115 | +"MBREQ") |
116 | +0 |
117 | +"PKG",3,-1) |
118 | +1^1 |
119 | +"PKG",3,0) |
120 | +KERNEL^XU^SIGN-ON, SECURITY, MENU DRIVER, DEVICES, TASKMAN^ |
121 | +"PKG",3,20,0) |
122 | +^9.402P^^ |
123 | +"PKG",3,22,0) |
124 | +^9.49I^1^1 |
125 | +"PKG",3,22,1,0) |
126 | +8.0^3040115^2960606^1 |
127 | +"PKG",3,22,1,"PAH",1,0) |
128 | +1508^3101203 |
129 | +"PRE") |
130 | +XU1508E |
131 | +"QUES","XPF1",0) |
132 | +Y |
133 | +"QUES","XPF1","??") |
134 | +^D REP^XPDH |
135 | +"QUES","XPF1","A") |
136 | +Shall I write over your |FLAG| File |
137 | +"QUES","XPF1","B") |
138 | +YES |
139 | +"QUES","XPF1","M") |
140 | +D XPF1^XPDIQ |
141 | +"QUES","XPF2",0) |
142 | +Y |
143 | +"QUES","XPF2","??") |
144 | +^D DTA^XPDH |
145 | +"QUES","XPF2","A") |
146 | +Want my data |FLAG| yours |
147 | +"QUES","XPF2","B") |
148 | +YES |
149 | +"QUES","XPF2","M") |
150 | +D XPF2^XPDIQ |
151 | +"QUES","XPI1",0) |
152 | +YO |
153 | +"QUES","XPI1","??") |
154 | +^D INHIBIT^XPDH |
155 | +"QUES","XPI1","A") |
156 | +Want KIDS to INHIBIT LOGONs during the install |
157 | +"QUES","XPI1","B") |
158 | +NO |
159 | +"QUES","XPI1","M") |
160 | +D XPI1^XPDIQ |
161 | +"QUES","XPM1",0) |
162 | +PO^VA(200,:EM |
163 | +"QUES","XPM1","??") |
164 | +^D MG^XPDH |
165 | +"QUES","XPM1","A") |
166 | +Enter the Coordinator for Mail Group '|FLAG|' |
167 | +"QUES","XPM1","B") |
168 | + |
169 | +"QUES","XPM1","M") |
170 | +D XPM1^XPDIQ |
171 | +"QUES","XPO1",0) |
172 | +Y |
173 | +"QUES","XPO1","??") |
174 | +^D MENU^XPDH |
175 | +"QUES","XPO1","A") |
176 | +Want KIDS to Rebuild Menu Trees Upon Completion of Install |
177 | +"QUES","XPO1","B") |
178 | +NO |
179 | +"QUES","XPO1","M") |
180 | +D XPO1^XPDIQ |
181 | +"QUES","XPZ1",0) |
182 | +Y |
183 | +"QUES","XPZ1","??") |
184 | +^D OPT^XPDH |
185 | +"QUES","XPZ1","A") |
186 | +Want to DISABLE Scheduled Options, Menu Options, and Protocols |
187 | +"QUES","XPZ1","B") |
188 | +NO |
189 | +"QUES","XPZ1","M") |
190 | +D XPZ1^XPDIQ |
191 | +"QUES","XPZ2",0) |
192 | +Y |
193 | +"QUES","XPZ2","??") |
194 | +^D RTN^XPDH |
195 | +"QUES","XPZ2","A") |
196 | +Want to MOVE routines to other CPUs |
197 | +"QUES","XPZ2","B") |
198 | +NO |
199 | +"QUES","XPZ2","M") |
200 | +D XPZ2^XPDIQ |
201 | +"RTN") |
202 | +2 |
203 | +"RTN","XU1508E") |
204 | +0^^B2244259 |
205 | +"RTN","XU1508E",1,0) |
206 | +XU1508E ;MSC/JKT - Environment check routine for XU*8.0*1508 ;3DEC2010 20:18 |
207 | +"RTN","XU1508E",2,0) |
208 | + ;;8.0;KERNEL;**1508**;DEC 3, 2010; |
209 | +"RTN","XU1508E",3,0) |
210 | + ; |
211 | +"RTN","XU1508E",4,0) |
212 | + ; check for presence of $&openvista.gtmserver2 call |
213 | +"RTN","XU1508E",5,0) |
214 | + ; |
215 | +"RTN","XU1508E",6,0) |
216 | + Q:$G(^%ZOSF("OS"))'["GT.M" |
217 | +"RTN","XU1508E",7,0) |
218 | + ; |
219 | +"RTN","XU1508E",8,0) |
220 | + N XC,%I,LINE,FOUND,VERSION |
221 | +"RTN","XU1508E",9,0) |
222 | + S XC=$$GTMPATH^ZCD($$CURRENT^ZCD())_"/openvista.xc" |
223 | +"RTN","XU1508E",10,0) |
224 | + S %I=$I O XC:(READONLY) U XC |
225 | +"RTN","XU1508E",11,0) |
226 | + S FOUND=0 F R LINE Q:LINE="" S:$P(LINE,":",1)="gtmserver2" FOUND=1 |
227 | +"RTN","XU1508E",12,0) |
228 | + C XC U %I |
229 | +"RTN","XU1508E",13,0) |
230 | + I 'FOUND D |
231 | +"RTN","XU1508E",14,0) |
232 | + . S VERSION=$TR($E($P($ZV," ",2),2,999),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz") |
233 | +"RTN","XU1508E",15,0) |
234 | + . S VERSION=$P(VERSION,"-")_$P(VERSION,"-",2) |
235 | +"RTN","XU1508E",16,0) |
236 | + . D BMES^XPDUTL("** You must install version 0.8.11 or later of the openvista-libs-"_VERSION_" Linux package before installing this build **") |
237 | +"RTN","XU1508E",17,0) |
238 | + . S XPDABORT=1 |
239 | +"RTN","XU1508E",18,0) |
240 | + Q |
241 | +"RTN","ZISTCPS") |
242 | +0^1^B20023114 |
243 | +"RTN","ZISTCPS",1,0) |
244 | +%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;03DEC2010 |
245 | +"RTN","ZISTCPS",2,0) |
246 | + ;;8.0;KERNEL;**78,118,127,225,275,388,1508**;Jul 10, 1995 |
247 | +"RTN","ZISTCPS",3,0) |
248 | + Q |
249 | +"RTN","ZISTCPS",4,0) |
250 | + ; |
251 | +"RTN","ZISTCPS",5,0) |
252 | +CLOSE ;Close and reset |
253 | +"RTN","ZISTCPS",6,0) |
254 | + G CLOSE^%ZISTCP |
255 | +"RTN","ZISTCPS",7,0) |
256 | + Q |
257 | +"RTN","ZISTCPS",8,0) |
258 | + ; |
259 | +"RTN","ZISTCPS",9,0) |
260 | + ;In ZRULE, set ZISQUIT=1 to quit |
261 | +"RTN","ZISTCPS",10,0) |
262 | +LISTEN(SOCK,RTN,ZRULE) ;Listen on socket, start routine |
263 | +"RTN","ZISTCPS",11,0) |
264 | + N %A,ZISOS,X,NIO,EXIT |
265 | +"RTN","ZISTCPS",12,0) |
266 | + N $ES,$ET S $ETRAP="D OPNERR^%ZISTCPS" |
267 | +"RTN","ZISTCPS",13,0) |
268 | + S ZISOS=^%ZOSF("OS"),ZRULE=$G(ZRULE) |
269 | +"RTN","ZISTCPS",14,0) |
270 | + S POP=1 |
271 | +"RTN","ZISTCPS",15,0) |
272 | + D GETENV^%ZOSV S U="^",XUENV=Y,XQVOL=$P(Y,U,2) |
273 | +"RTN","ZISTCPS",16,0) |
274 | + S POP=1 D LONT:ZISOS["OpenM",LGTM:ZISOS["GT.M" |
275 | +"RTN","ZISTCPS",17,0) |
276 | + I 'POP C NIO ;Close port |
277 | +"RTN","ZISTCPS",18,0) |
278 | + Q |
279 | +"RTN","ZISTCPS",19,0) |
280 | + ; |
281 | +"RTN","ZISTCPS",20,0) |
282 | + ; |
283 | +"RTN","ZISTCPS",21,0) |
284 | +LONT ;Open port in Accept mode with standard terminators. |
285 | +"RTN","ZISTCPS",22,0) |
286 | + N %ZA,NEWCHAR |
287 | +"RTN","ZISTCPS",23,0) |
288 | + S NIO="|TCP|"_SOCK,EXIT=0 |
289 | +"RTN","ZISTCPS",24,0) |
290 | + ;(adr:sock:term:ibuf:obuf:queue) |
291 | +"RTN","ZISTCPS",25,0) |
292 | + O NIO:(:SOCK:"AT"::512:512:10):30 Q:'$T S POP=0 U NIO |
293 | +"RTN","ZISTCPS",26,0) |
294 | + ;Wait on read for a connect |
295 | +"RTN","ZISTCPS",27,0) |
296 | +LONT2 F U NIO R *NEWCHAR:30 S EXIT=$$EXIT Q:$T!EXIT |
297 | +"RTN","ZISTCPS",28,0) |
298 | + I EXIT C NIO Q |
299 | +"RTN","ZISTCPS",29,0) |
300 | + ;JOB params (:Concurrent Server bit:principal input:principal output) |
301 | +"RTN","ZISTCPS",30,0) |
302 | + J CHILDONT^%ZISTCPS(NIO,RTN):(:16::):10 S %ZA=$ZA |
303 | +"RTN","ZISTCPS",31,0) |
304 | + I %ZA\8196#2=1 W *-2 ;Job failed to clear bit |
305 | +"RTN","ZISTCPS",32,0) |
306 | + G LONT2 |
307 | +"RTN","ZISTCPS",33,0) |
308 | + ; |
309 | +"RTN","ZISTCPS",34,0) |
310 | +CHILDONT(IO,RTN) ;Child process for OpenM |
311 | +"RTN","ZISTCPS",35,0) |
312 | + S $ETRAP="D ^%ZTER L HALT",IO=$ZU(53) |
313 | +"RTN","ZISTCPS",36,0) |
314 | + U IO:(::"-M") ;Work like DSM |
315 | +"RTN","ZISTCPS",37,0) |
316 | + S NEWJOB=$$NEWOK |
317 | +"RTN","ZISTCPS",38,0) |
318 | + I 'NEWJOB W "421 Service temporarily down.",$C(13,10),! |
319 | +"RTN","ZISTCPS",39,0) |
320 | + I NEWJOB K NEWJOB D VAR,@RTN |
321 | +"RTN","ZISTCPS",40,0) |
322 | + HALT |
323 | +"RTN","ZISTCPS",41,0) |
324 | + ; |
325 | +"RTN","ZISTCPS",42,0) |
326 | +VAR ;Setup IO variables |
327 | +"RTN","ZISTCPS",43,0) |
328 | + S IO(0)=IO,IO(1,IO)="",POP=0 |
329 | +"RTN","ZISTCPS",44,0) |
330 | + S IOT="TCP",IOST="P-TCP",IOST(0)=0 |
331 | +"RTN","ZISTCPS",45,0) |
332 | + S IOF=$$FLUSHCHR^%ZISTCP |
333 | +"RTN","ZISTCPS",46,0) |
334 | + S ^XUTL("XQ",$J,0)=$$DT^XLFDT |
335 | +"RTN","ZISTCPS",47,0) |
336 | + Q |
337 | +"RTN","ZISTCPS",48,0) |
338 | +NEWOK() ;Is it OK to start a new process |
339 | +"RTN","ZISTCPS",49,0) |
340 | + I $G(^%ZIS(14.5,"LOGON",^%ZOSF("VOL"))) Q 0 |
341 | +"RTN","ZISTCPS",50,0) |
342 | + I $$AVJ^%ZOSV()<3 Q 0 |
343 | +"RTN","ZISTCPS",51,0) |
344 | + Q 1 |
345 | +"RTN","ZISTCPS",52,0) |
346 | +OPNERR ; |
347 | +"RTN","ZISTCPS",53,0) |
348 | + S POP=1,EXIT=1,IO("ERROR")=$ECODE,$ECODE="" |
349 | +"RTN","ZISTCPS",54,0) |
350 | + Q |
351 | +"RTN","ZISTCPS",55,0) |
352 | +EXIT() ;See if time to exit |
353 | +"RTN","ZISTCPS",56,0) |
354 | + I $$S^%ZTLOAD Q 1 |
355 | +"RTN","ZISTCPS",57,0) |
356 | + N ZISQUIT S ZISQUIT=0 |
357 | +"RTN","ZISTCPS",58,0) |
358 | + I $L(ZRULE) X ZRULE I $G(ZISQUIT) Q 1 |
359 | +"RTN","ZISTCPS",59,0) |
360 | + Q 0 |
361 | +"RTN","ZISTCPS",60,0) |
362 | + ; |
363 | +"RTN","ZISTCPS",61,0) |
364 | +LGTM ;GT.M multi thread server |
365 | +"RTN","ZISTCPS",62,0) |
366 | + N %A K ^TMP("ZISTCP",$J) |
367 | +"RTN","ZISTCPS",63,0) |
368 | + S $ZINTERRUPT="I $$JOBEXAM^ZU($ZPOSITION)" |
369 | +"RTN","ZISTCPS",64,0) |
370 | + S NIO="SCK$"_$S($J>86400:$J,1:84600+$J) ;Construct a dummy, but "unique" devicename for job |
371 | +"RTN","ZISTCPS",65,0) |
372 | + D LOG("Open for Listen "_NIO) |
373 | +"RTN","ZISTCPS",66,0) |
374 | + ;Open the device |
375 | +"RTN","ZISTCPS",67,0) |
376 | + O NIO:(ZLISTEN=SOCK_":TCP":ATTACH="listener"):30:"SOCKET" |
377 | +"RTN","ZISTCPS",68,0) |
378 | + I '$T D LOG("Can't Open Socket: "_SOCK) Q |
379 | +"RTN","ZISTCPS",69,0) |
380 | + U NIO S NIO("ZISTCP",0)=$KEY D LOG("Have port.") |
381 | +"RTN","ZISTCPS",70,0) |
382 | + ;Start Listening |
383 | +"RTN","ZISTCPS",71,0) |
384 | + W /LISTEN(1) S NIO("ZISTCP",1)=$KEY D LOG("Start Listening. "_NIO("ZISTCP",1)) |
385 | +"RTN","ZISTCPS",72,0) |
386 | + N ZC,ZR,IDX,DESC,LDESC |
387 | +"RTN","ZISTCPS",73,0) |
388 | + S ZC="ZSHOW ""D"":ZR" |
389 | +"RTN","ZISTCPS",74,0) |
390 | + X ZC |
391 | +"RTN","ZISTCPS",75,0) |
392 | + ; Find the listener file descriptor. The child must close it. |
393 | +"RTN","ZISTCPS",76,0) |
394 | + S LDESC="" F IDX=1:1:$O(ZR("D",""),-1) S:(ZR("D",IDX)["listener")&(ZR("D",IDX)["PORT="_SOCK) LDESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:LDESC'="" |
395 | +"RTN","ZISTCPS",77,0) |
396 | + ;Wait for connection |
397 | +"RTN","ZISTCPS",78,0) |
398 | +LG2 S %A=0,EXIT=0 F D Q:%A!EXIT |
399 | +"RTN","ZISTCPS",79,0) |
400 | + . U NIO:(SOCKET="listener") |
401 | +"RTN","ZISTCPS",80,0) |
402 | + . W /WAIT(30) ;Wait for connect |
403 | +"RTN","ZISTCPS",81,0) |
404 | + . I $P($KEY,"|",1)="CONNECT" S NIO("ZISTCP",2)=$KEY,%A=1 |
405 | +"RTN","ZISTCPS",82,0) |
406 | + . S EXIT=$$EXIT |
407 | +"RTN","ZISTCPS",83,0) |
408 | + . Q |
409 | +"RTN","ZISTCPS",84,0) |
410 | + I EXIT C NIO Q |
411 | +"RTN","ZISTCPS",85,0) |
412 | + ; |
413 | +"RTN","ZISTCPS",86,0) |
414 | + S NIO("SOCK")=$P($G(NIO("ZISTCP",2)),"|",2) |
415 | +"RTN","ZISTCPS",87,0) |
416 | + D LOG("Got connection on "_NIO("SOCK")) |
417 | +"RTN","ZISTCPS",88,0) |
418 | + I '$$NEWOK D G LG2 |
419 | +"RTN","ZISTCPS",89,0) |
420 | + . U NIO:(SOCKET=NIO("SOCK")) W "421 Service temporarily down.",$C(13,10),# |
421 | +"RTN","ZISTCPS",90,0) |
422 | + . C NIO:(SOCKET=NIO("SOCK")) K NIO("ZISTCP",2) |
423 | +"RTN","ZISTCPS",91,0) |
424 | + . Q |
425 | +"RTN","ZISTCPS",92,0) |
426 | + ;Find file descriptor |
427 | +"RTN","ZISTCPS",93,0) |
428 | + X ZC |
429 | +"RTN","ZISTCPS",94,0) |
430 | + S DESC="" F IDX=1:1:$O(ZR("D",""),-1) S:ZR("D",IDX)[NIO("SOCK") DESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:DESC'="" |
431 | +"RTN","ZISTCPS",95,0) |
432 | + I DESC="" D LOG("Can not find file descriptor!") G LG2 |
433 | +"RTN","ZISTCPS",96,0) |
434 | + ;spawn child process |
435 | +"RTN","ZISTCPS",97,0) |
436 | + S SPAWNID=$&openvista.gtmserver2(DESC,LDESC,"GTMLNCH^%ZISTCPS") |
437 | +"RTN","ZISTCPS",98,0) |
438 | + L +^TMP("ZISTCPS",SPAWNID) |
439 | +"RTN","ZISTCPS",99,0) |
440 | + S ^TMP("ZISTCPS",SPAWNID)=RTN |
441 | +"RTN","ZISTCPS",100,0) |
442 | + L -^TMP("ZISTCPS",SPAWNID) |
443 | +"RTN","ZISTCPS",101,0) |
444 | + D LOG("Spawned child "_SPAWNID) |
445 | +"RTN","ZISTCPS",102,0) |
446 | + ;Close the client socket since the child now has it |
447 | +"RTN","ZISTCPS",103,0) |
448 | + C NIO:(SOCKET=NIO("SOCK")) |
449 | +"RTN","ZISTCPS",104,0) |
450 | + G LG2 |
451 | +"RTN","ZISTCPS",105,0) |
452 | + Q |
453 | +"RTN","ZISTCPS",106,0) |
454 | + ; |
455 | +"RTN","ZISTCPS",107,0) |
456 | +GTMLNCH ;Run gt.m job for this connection. |
457 | +"RTN","ZISTCPS",108,0) |
458 | + N RTN S RTN="" |
459 | +"RTN","ZISTCPS",109,0) |
460 | + S IO("GTM-IP")=$P($K,"|",3) |
461 | +"RTN","ZISTCPS",110,0) |
462 | + F D Q:RTN'="" ; Loop until we get entry point |
463 | +"RTN","ZISTCPS",111,0) |
464 | + . L +^TMP("ZISTCPS",$J) ; Get lock that tells us data is ready |
465 | +"RTN","ZISTCPS",112,0) |
466 | + . S RTN=$G(^TMP("ZISTCPS",$J)) ; Get entry point |
467 | +"RTN","ZISTCPS",113,0) |
468 | + . L -^TMP("ZISTCPS",$J) ; release entry point lock |
469 | +"RTN","ZISTCPS",114,0) |
470 | + . H:RTN="" 1 ; We did not get a entry point, so wait a second for server to populate |
471 | +"RTN","ZISTCPS",115,0) |
472 | + . Q |
473 | +"RTN","ZISTCPS",116,0) |
474 | + K ^TMP("ZISTCPS",$J) |
475 | +"RTN","ZISTCPS",117,0) |
476 | + N NIO,SOCK,ZISOS,EXIT,XQVOL,$ETRAP |
477 | +"RTN","ZISTCPS",118,0) |
478 | + S U="^",$ETRAP="D ^%ZTER L HALT" |
479 | +"RTN","ZISTCPS",119,0) |
480 | + S (IO,IO(0))=$P,IO(1,IO)="" |
481 | +"RTN","ZISTCPS",120,0) |
482 | + D VAR,@RTN |
483 | +"RTN","ZISTCPS",121,0) |
484 | + Q |
485 | +"RTN","ZISTCPS",122,0) |
486 | + ; |
487 | +"RTN","ZISTCPS",123,0) |
488 | +LOG(MSG) ;LOG STATUS |
489 | +"RTN","ZISTCPS",124,0) |
490 | + N CNT |
491 | +"RTN","ZISTCPS",125,0) |
492 | + S CNT=$G(^TMP("ZISTCP",$J))+1,^TMP("ZISTCP",$J)=CNT,^($J,CNT)=MSG |
493 | +"RTN","ZISTCPS",126,0) |
494 | + Q |
495 | +"RTN","ZISTCPS",127,0) |
496 | + ; |
497 | +"VER") |
498 | +8.0^22.0 |
499 | +**END** |
500 | +**END** |
501 | |
502 | === added file 'mumps/XU1508E.m' |
503 | --- mumps/XU1508E.m 1970-01-01 00:00:00 +0000 |
504 | +++ mumps/XU1508E.m 2010-12-04 06:46:54 +0000 |
505 | @@ -0,0 +1,18 @@ |
506 | +XU1508E ;MSC/JKT - Environment check routine for XU*8.0*1508 ;3DEC2010 20:18 |
507 | + ;;8.0;KERNEL;**1508**;DEC 3, 2010; |
508 | + ; |
509 | + ; check for presence of $&openvista.gtmserver2 call |
510 | + ; |
511 | + Q:$G(^%ZOSF("OS"))'["GT.M" |
512 | + ; |
513 | + N XC,%I,LINE,FOUND,VERSION |
514 | + S XC=$$GTMPATH^ZCD($$CURRENT^ZCD())_"/openvista.xc" |
515 | + S %I=$I O XC:(READONLY) U XC |
516 | + S FOUND=0 F R LINE Q:LINE="" S:$P(LINE,":",1)="gtmserver2" FOUND=1 |
517 | + C XC U %I |
518 | + I 'FOUND D |
519 | + . S VERSION=$TR($E($P($ZV," ",2),2,999),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz") |
520 | + . S VERSION=$P(VERSION,"-")_$P(VERSION,"-",2) |
521 | + . D BMES^XPDUTL("** You must install version 0.8.11 or later of the openvista-libs-"_VERSION_" Linux package before installing this build **") |
522 | + . S XPDABORT=1 |
523 | + Q |
524 | |
525 | === modified file 'mumps/ZISTCPS.m' |
526 | --- mumps/ZISTCPS.m 2009-06-05 20:09:12 +0000 |
527 | +++ mumps/ZISTCPS.m 2010-12-04 06:46:54 +0000 |
528 | @@ -1,5 +1,5 @@ |
529 | -%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;22APR2009 |
530 | - ;;8.0;KERNEL;**78,118,127,225,275,388,MSC**;Jul 10, 1995 |
531 | +%ZISTCPS ;ISF/RWF MSC/JDA - DEVICE HANDLER TCP/IP SERVER CALLS ;03DEC2010 |
532 | + ;;8.0;KERNEL;**78,118,127,225,275,388,1508**;Jul 10, 1995 |
533 | Q |
534 | ; |
535 | CLOSE ;Close and reset |
536 | @@ -69,8 +69,11 @@ |
537 | U NIO S NIO("ZISTCP",0)=$KEY D LOG("Have port.") |
538 | ;Start Listening |
539 | W /LISTEN(1) S NIO("ZISTCP",1)=$KEY D LOG("Start Listening. "_NIO("ZISTCP",1)) |
540 | - N ZC,ZR,IDX,DESC |
541 | + N ZC,ZR,IDX,DESC,LDESC |
542 | S ZC="ZSHOW ""D"":ZR" |
543 | + X ZC |
544 | + ; Find the listener file descriptor. The child must close it. |
545 | + S LDESC="" F IDX=1:1:$O(ZR("D",""),-1) S:(ZR("D",IDX)["listener")&(ZR("D",IDX)["PORT="_SOCK) LDESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:LDESC'="" |
546 | ;Wait for connection |
547 | LG2 S %A=0,EXIT=0 F D Q:%A!EXIT |
548 | . U NIO:(SOCKET="listener") |
549 | @@ -91,7 +94,7 @@ |
550 | S DESC="" F IDX=1:1:$O(ZR("D",""),-1) S:ZR("D",IDX)[NIO("SOCK") DESC=$P($P(ZR("D",IDX),"DESC=",2)," ",1) Q:DESC'="" |
551 | I DESC="" D LOG("Can not find file descriptor!") G LG2 |
552 | ;spawn child process |
553 | - S SPAWNID=$&openvista.gtmserver(DESC,"GTMLNCH^%ZISTCPS") |
554 | + S SPAWNID=$&openvista.gtmserver2(DESC,LDESC,"GTMLNCH^%ZISTCPS") |
555 | L +^TMP("ZISTCPS",SPAWNID) |
556 | S ^TMP("ZISTCPS",SPAWNID)=RTN |
557 | L -^TMP("ZISTCPS",SPAWNID) |
558 | |
559 | === modified file 'src/libopenvista/GTMSRV.m' |
560 | --- src/libopenvista/GTMSRV.m 2009-04-23 04:45:12 +0000 |
561 | +++ src/libopenvista/GTMSRV.m 2010-12-04 06:46:54 +0000 |
562 | @@ -26,15 +26,19 @@ |
563 | Open TCPDEV:(ZLISTEN=PORTNO_":TCP":attach="listener"):TIMEOUT:"SOCKET" |
564 | Use TCPDEV |
565 | Write /listen(1) |
566 | + ZSHOW "D":ZS |
567 | + N IDX,LDESC S LDESC="" F IDX=1:1:$O(ZS("D",""),-1) D Q:LDESC'="" |
568 | + . S:ZS("D",IDX)["listener"&(ZS("D",IDX)["PORT="_PORTNO) LDESC=$P($P(ZS("D",IDX),"DESC=",2)," ",1) |
569 | + . Q |
570 | F D |
571 | . Use TCPDEV:(SOCKET="listener") |
572 | . Write /wait(TIMEOUT) |
573 | . N HANDLE S HANDLE=$P($KEY,"|",2) |
574 | . K ZS ZSHOW "D":ZS |
575 | - . N IDX,DESC S DESC="" F IDX=1:1:$O(ZS("D",""),-1) D Q:DESC'="" |
576 | + . N DESC S DESC="" F IDX=1:1:$O(ZS("D",""),-1) D Q:DESC'="" |
577 | . . S:ZS("D",IDX)[HANDLE DESC=$P($P(ZS("D",IDX),"DESC=",2)," ",1) |
578 | . . Q |
579 | - . D >mserver(DESC,CMD) |
580 | + . D >mserver2(DESC,LDESC,CMD) |
581 | . C TCPDEV:(socket=HANDLE) |
582 | . Q |
583 | Q |
584 | |
585 | === modified file 'src/libopenvista/gtmserver.c' |
586 | --- src/libopenvista/gtmserver.c 2009-04-23 04:45:12 +0000 |
587 | +++ src/libopenvista/gtmserver.c 2010-12-04 06:46:54 +0000 |
588 | @@ -37,18 +37,103 @@ |
589 | ret_val = -1; |
590 | grandchild_id = -1; |
591 | |
592 | - RETRY_EINTR(result=pipe(fds)); |
593 | - if (result<0) { |
594 | - perror("pipe()"); |
595 | - return ret_val; |
596 | - } |
597 | - child_id=fork(); |
598 | - if (child_id<0) { |
599 | - perror("child fork()"); |
600 | - return ret_val; |
601 | - } |
602 | - if (child_id==0) { |
603 | - /* In child */ |
604 | + fprintf(stderr, "$&openvista.gtmserver is deprecated; use $&openvista.gtmserver2 instead\n"); |
605 | + fprintf(stderr, "OpenVista users can upgrade by installing XU*8.0*1508 and running ZTMGRSET\n\n"); |
606 | + |
607 | + RETRY_EINTR(result=pipe(fds)); |
608 | + if (result<0) { |
609 | + perror("pipe()"); |
610 | + return ret_val; |
611 | + } |
612 | + child_id=fork(); |
613 | + if (child_id<0) { |
614 | + perror("child fork()"); |
615 | + return ret_val; |
616 | + } |
617 | + if (child_id==0) { |
618 | + /* In child */ |
619 | + RETRY_EINTR(result=close(fds[0]) ); |
620 | + if (result != 0) { |
621 | + perror("child close()"); |
622 | + SEND_PID; |
623 | + } |
624 | + /* |
625 | + * Fork again. Child exits and is reaped so as not to be a zombie. |
626 | + * Grandchild will be the actual client, which will be reaped by init. |
627 | + */ |
628 | + grandchild_id=fork(); |
629 | + if (grandchild_id<0) { |
630 | + perror("grandchild fork()"); |
631 | + SEND_PID; |
632 | + } |
633 | + if (!grandchild_id) { |
634 | + /* In grandchild */ |
635 | + RETRY_EINTR(dup2(connfd, STDIN_FILENO)); |
636 | + RETRY_EINTR(dup2(connfd, STDOUT_FILENO)); |
637 | + execlp("mumps", "mumps", "-run", cmd, (char*)0); |
638 | + /* We should never get here */ |
639 | + perror("execlp() returned"); |
640 | + _exit(-1); /* Do not do atexit() callbacks */ |
641 | + } else { |
642 | + /* Still in child. Send grandchild pid to parent. */ |
643 | + if (SEND_PID<0) { |
644 | + perror("child write()"); |
645 | + _exit(-1); |
646 | + } |
647 | + if (close(fds[1]) != 0) { |
648 | + perror("child close()"); |
649 | + } |
650 | + RETRY_EINTR(sleep(1000)); /* parent will kill us */ |
651 | + _exit(0); |
652 | + } |
653 | + } else if (child_id) { |
654 | + /* still in parent */ |
655 | + int bytes_read; |
656 | + int status; |
657 | + RETRY_EINTR(result=close(fds[1])); |
658 | + if (result != 0) { |
659 | + perror("parent close(fds[1])"); |
660 | + } |
661 | + while( (bytes_read = read(fds[0], &ret_val, sizeof ret_val))==-1 && errno==EINTR) ; |
662 | + //RETRY_EINTR(bytes_read = read(fds[0], &ret_val, sizeof ret_val)); |
663 | + if (bytes_read != sizeof ret_val) { |
664 | + perror("incomplete read()"); |
665 | + /* ret_val = -1; */ |
666 | + } |
667 | + RETRY_EINTR(result=close(fds[0])); |
668 | + if (result != 0) { |
669 | + perror("parent close(fds[0])"); |
670 | + } |
671 | + kill(child_id, SIGKILL); |
672 | + waitpid(child_id, &status, 0); |
673 | + return ret_val; |
674 | + } |
675 | +} |
676 | + |
677 | +xc_long_t gtmserver2(int count, int connfd, int listen_fd, const char *cmd) { |
678 | + int fds[2]; |
679 | + int child_id; |
680 | + int grandchild_id; |
681 | + int ret_val; |
682 | + int pid; |
683 | + int result; |
684 | + |
685 | + ret_val = -1; |
686 | + grandchild_id = -1; |
687 | + |
688 | + RETRY_EINTR(result=pipe(fds)); |
689 | + if (result<0) { |
690 | + perror("pipe()"); |
691 | + return ret_val; |
692 | + } |
693 | + child_id=fork(); |
694 | + if (child_id<0) { |
695 | + perror("child fork()"); |
696 | + return ret_val; |
697 | + } |
698 | + if (child_id==0) { |
699 | + /* In child */ |
700 | + RETRY_EINTR(close(listen_fd)); |
701 | RETRY_EINTR(result=close(fds[0]) ); |
702 | if (result != 0) { |
703 | perror("child close()"); |
704 | |
705 | === modified file 'src/libopenvista/openvista.xc.in' |
706 | --- src/libopenvista/openvista.xc.in 2009-07-08 04:08:14 +0000 |
707 | +++ src/libopenvista/openvista.xc.in 2010-12-04 06:46:54 +0000 |
708 | @@ -1,2 +1,3 @@ |
709 | @GTM_DIST@/libopenvista.so |
710 | gtmserver: xc_long_t gtmserver(I:xc_long_t, I:xc_char_t*) |
711 | +gtmserver2: xc_long_t gtmserver2(I:xc_long_t, I:xc_long_t, I:xc_char_t*) |
Make sure that waitpid is guarded against interruption in the next patch.