Merge lp:~jontai/openvista-gtm-integration/gtm-packaging into lp:openvista-gtm-integration
- gtm-packaging
- Merge into mainline
Proposed by
Jon Tai
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||
Proposed branch: | lp:~jontai/openvista-gtm-integration/gtm-packaging | ||||||||
Merge into: | lp:openvista-gtm-integration | ||||||||
Diff against target: | None lines | ||||||||
To merge this branch: | bzr merge lp:~jontai/openvista-gtm-integration/gtm-packaging | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
jeff.apple | Approve | ||
Review via email: mp+5271@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Jon Tai (jontai) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === renamed file 'packages/rpm/fis-gtm.spec' => 'packages/rpm/fis-gtm-5.3003.spec' |
2 | --- packages/rpm/fis-gtm.spec 2009-02-13 12:00:25 +0000 |
3 | +++ packages/rpm/fis-gtm-5.3003.spec 2009-02-25 20:22:02 +0000 |
4 | @@ -15,7 +15,7 @@ |
5 | %define gtm_dist /opt/lsb-gtm/V5.3-003_i686 |
6 | %endif |
7 | |
8 | -Name: fis-gtm |
9 | +Name: fis-gtm-5.3003 |
10 | Version: 5.3003 |
11 | Release: 1 |
12 | Summary: High end TP schemaless database |
13 | @@ -25,14 +25,26 @@ |
14 | Group: Applications/Databases |
15 | Packager: Jonathan Tai <jon.tai@medsphere.com> |
16 | |
17 | -Requires: /bin/sh, coreutils |
18 | +Provides: fis-gtm |
19 | + |
20 | +Requires(pre): /usr/sbin/groupadd |
21 | +Requires(post): /usr/sbin/semanage, /sbin/restorecon |
22 | +Requires(postun): /usr/sbin/semanage, /usr/sbin/groupdel |
23 | + |
24 | +Requires: /bin/sh, coreutils, libicu, zlib, ncurses |
25 | BuildRequires: /bin/tcsh, libicu-devel, zlib-devel, ncurses-devel |
26 | |
27 | # The source for both i686 and x86_64 versions are both in this tarball, even |
28 | # though the tarball is named i686_src |
29 | Source: gtm_V53003_linux_i686_src.tar.gz |
30 | |
31 | -Patch1: fis-gtm_noninteractive-configure.patch |
32 | +# Patch the configure script to pre-answer all of the prompts and set the |
33 | +# installation directory |
34 | +Patch1: fis-gtm-5.3003_noninteractive-configure.patch |
35 | + |
36 | +# See https://bugs.launchpad.net/openvista-gtm-integration/+bug/327480 |
37 | +Patch2: fis-gtm-5.3003_zprompt.patch |
38 | + |
39 | BuildRoot: %{_tmppath}/%{name}-root |
40 | |
41 | %description |
42 | @@ -52,11 +64,17 @@ |
43 | exit 1 |
44 | fi |
45 | |
46 | +if ! grep '^gtm:' /etc/group > /dev/null; then |
47 | + echo "gtm group not found in /etc/group" |
48 | + exit 1 |
49 | +fi |
50 | + |
51 | if [ `/usr/bin/id -u` -ne 0 ]; then |
52 | echo "this RPM must be built as root" |
53 | exit 1 |
54 | fi |
55 | %setup -c |
56 | +%patch2 -p0 |
57 | |
58 | %build |
59 | # GT.M needs to be built with tcsh, and with a bunch of environmental variables |
60 | @@ -102,14 +120,25 @@ |
61 | %defattr(-,-,-) |
62 | /opt/lsb-gtm |
63 | |
64 | +%pre |
65 | +/usr/sbin/groupadd gtm 2> /dev/null || : |
66 | + |
67 | %post |
68 | -# For linux systems, attempt to execute the chcon command to allow use of the |
69 | -# libgtmshr shared library. This command is required on many modern SELinux |
70 | -# based systems but depends on the filesystem in use (requires context |
71 | -# support). For that reason, we attempt the command and if it works, great. If |
72 | -# it doesn't, oh well we tried. |
73 | - |
74 | -# FIXME: we get "chcon: can't apply partial context to unlabeled file /opt/lsb-gtm/V5.3-003_i686/libgtmshr.so" |
75 | -# on a system with SELinux disabled; need to test on a system with SELinux enabled |
76 | -#chcon -t texrel_shlib_t %{gtm_dist}/libgtmshr.so || : |
77 | - |
78 | +# GT.M's installation script just chcon directly, but it won't have any effect |
79 | +# on the target system (only on the build system, and then only if SELinux is |
80 | +# enabled on the build system). On the target system, we should use semanage |
81 | +# to save the correct context for libgtmshr.so in the SELinux policy. This |
82 | +# will ensure that the file has the correct context, even after relabling. |
83 | +# |
84 | +# See http://fedoraproject.org/wiki/PackagingDrafts/SELinux |
85 | +/usr/sbin/semanage fcontext -a -t textrel_shlib_t %{gtm_dist}/libgtmshr.so 2>/dev/null || : |
86 | +/sbin/restorecon %{gtm_dist}/libgtmshr.so || : |
87 | + |
88 | +%postun |
89 | +# Remove libgtmshr.so from the SELinux policy if we're removing the package |
90 | +# |
91 | +# See http://fedoraproject.org/wiki/PackagingDrafts/SELinux |
92 | +if [ $1 -eq 0 ]; then |
93 | + /usr/sbin/semanage fcontext -d -t textrel_shlib_t %{gtm_dist}/libgtmshr.so 2>/dev/null || : |
94 | + /usr/sbin/groupdel gtm 2> /dev/null || : |
95 | +fi |
96 | |
97 | === renamed file 'packages/rpm/fis-gtm_noninteractive-configure.patch' => 'packages/rpm/fis-gtm-5.3003_noninteractive-configure.patch' |
98 | --- packages/rpm/fis-gtm_noninteractive-configure.patch 2009-02-13 12:00:25 +0000 |
99 | +++ packages/rpm/fis-gtm-5.3003_noninteractive-configure.patch 2009-02-22 08:42:50 +0000 |
100 | @@ -1,5 +1,5 @@ |
101 | ---- configure 2009-02-12 17:23:27.000000000 -0800 |
102 | -+++ configure 2009-02-12 17:30:38.000000000 -0800 |
103 | +--- configure 2009-02-21 23:56:05.000000000 -0800 |
104 | ++++ configure 2009-02-21 23:56:44.000000000 -0800 |
105 | @@ -104,7 +104,7 @@ |
106 | # create temporary file to test for valid user and group names |
107 | touch tmp_owngrp |
108 | @@ -9,15 +9,19 @@ |
109 | if [ "$resp" = "" ] ; then |
110 | owner="bin" |
111 | else |
112 | -@@ -118,7 +118,7 @@ |
113 | +@@ -118,10 +118,10 @@ |
114 | fi |
115 | |
116 | $echo "Should execution of GT.M to be restricted to a group? (y or n) \c" |
117 | -read resp |
118 | -+resp="n" |
119 | ++resp="y" |
120 | if [ "$resp" = "Y" -o "$resp" = "y" ] ; then |
121 | $echo "Enter group name? \c" |
122 | - read group |
123 | +- read group |
124 | ++ group="gtm" |
125 | + if [ "$group" != "" ] ; then |
126 | + chgrp $group tmp_owngrp 2> /dev/null |
127 | + if [ 1 = "$?" ] ; then |
128 | @@ -137,7 +137,7 @@ |
129 | rm tmp_owngrp |
130 | |
131 | |
132 | === added file 'packages/rpm/fis-gtm-5.3003_zprompt.patch' |
133 | --- packages/rpm/fis-gtm-5.3003_zprompt.patch 1970-01-01 00:00:00 +0000 |
134 | +++ packages/rpm/fis-gtm-5.3003_zprompt.patch 2009-04-07 01:39:18 +0000 |
135 | @@ -0,0 +1,95 @@ |
136 | +--- sr_port/gbldefs.c 2008-12-04 12:26:37.000000000 -0800 |
137 | ++++ sr_port/gbldefs.c 2009-04-06 18:27:35.000000000 -0700 |
138 | +@@ -230,6 +230,13 @@ |
139 | + GBLDEF boolean_t dollar_ztexit_bool; /* Truth value of dollar_ztexit when coerced to boolean */ |
140 | + GBLDEF boolean_t dollar_zquit_anyway; |
141 | + |
142 | ++#define DEFAULT_PROMPT "GTM>" |
143 | ++/* The prompt buffer size (31) below would allow at least 8 Unicode characters, but since most |
144 | ++ * commonly used Unicode characters only occupy upto 3 bytes, the buffer would at least accommodate |
145 | ++ * 10 Unicode characters in a prompt */ |
146 | ++GBLDEF char prombuf[MAX_MIDENT_LEN] = DEFAULT_PROMPT; |
147 | ++GBLDEF MSTR_DEF(gtmprompt, STR_LIT_LEN(DEFAULT_PROMPT), &prombuf[0]); |
148 | ++ |
149 | + GBLDEF mv_stent *mv_chain; |
150 | + GBLDEF sgm_info *first_sgm_info; /* List of participating regions in the TP transaction with NO ftok ordering */ |
151 | + GBLDEF sgm_info *first_tp_si_by_ftok; /* List of participating regions in the TP transaction sorted on ftok order */ |
152 | +--- sr_port/gtm_env_init.c 2008-12-04 12:26:39.000000000 -0800 |
153 | ++++ sr_port/gtm_env_init.c 2009-04-06 18:27:35.000000000 -0700 |
154 | +@@ -12,6 +12,8 @@ |
155 | + #include "mdef.h" |
156 | + |
157 | + #include "gtm_logicals.h" |
158 | ++#include "gtm_stdlib.h" |
159 | ++#include "gtm_string.h" |
160 | + #include "logical_truth_value.h" |
161 | + #include "trans_numeric.h" |
162 | + #include "gtmdbglvl.h" |
163 | +@@ -28,6 +30,9 @@ |
164 | + #include "gdskill.h" /* needed for gdsfhead.h */ |
165 | + #include "gdsbt.h" /* needed for gdsfhead.h */ |
166 | + #include "gdsfhead.h" /* needed for MAXTOTALBLKS_MAX macro */ |
167 | ++#include "trans_log_name.h" |
168 | ++#include "op.h" |
169 | ++#include "svnames.h" |
170 | + |
171 | + #ifdef DEBUG |
172 | + # define INITIAL_DEBUG_LEVEL GDL_Simple |
173 | +@@ -59,6 +64,9 @@ |
174 | + GBLREF uint4 max_cache_entries; /* Maximum number of cached indirect compilations */ |
175 | + GBLREF boolean_t gtm_tp_allocation_clue; /* block# hint to start allocation for created blocks in TP */ |
176 | + |
177 | ++GBLREF char prombuf[MAX_MIDENT_LEN]; |
178 | ++GBLREF mstr gtmprompt; |
179 | ++ |
180 | + #ifdef DEBUG |
181 | + GBLREF boolean_t gtm_gvundef_fatal; |
182 | + #endif |
183 | +@@ -69,6 +77,7 @@ |
184 | + mstr val; |
185 | + boolean_t ret, is_defined; |
186 | + uint4 tdbglvl, tmsock, reservesize, memsize, cachent; |
187 | ++ char* prompt_env_val; |
188 | + |
189 | + if (!gtm_env_init_done) |
190 | + { |
191 | +@@ -194,6 +203,12 @@ |
192 | + if (is_defined) |
193 | + dollar_zquit_anyway = ret; |
194 | + |
195 | ++ if (NULL!=(prompt_env_val=GETENV(GTM_PROMPT+1)) && strlen(prompt_env_val)<sizeof(prombuf)) { |
196 | ++ val.addr = GTM_PROMPT; |
197 | ++ val.len = sizeof(GTM_PROMPT) - 1; |
198 | ++ TRANS_LOG_NAME(&val, >mprompt, prombuf, sizeof(prombuf), do_sendmsg_on_log2long); |
199 | ++ } |
200 | ++ |
201 | + /* Platform specific initializations */ |
202 | + gtm_env_init_sp(); |
203 | + gtm_env_init_done = TRUE; |
204 | +--- sr_port/op_svput.c 2008-07-11 11:47:38.000000000 -0700 |
205 | ++++ sr_port/op_svput.c 2009-04-06 18:27:35.000000000 -0700 |
206 | +@@ -40,12 +40,8 @@ |
207 | + #include "getzdir.h" |
208 | + #include "gtm_newintrinsic.h" |
209 | + |
210 | +-#define DEFAULT_PROMPT "GTM>" |
211 | +-/* The prompt buffer size (31) below would allow at least 8 Unicode characters, but since most |
212 | +- * commonly used Unicode characters only occupy upto 3 bytes, the buffer would at least accommodate |
213 | +- * 10 Unicode characters in a prompt */ |
214 | +-GBLDEF char prombuf[MAX_MIDENT_LEN] = DEFAULT_PROMPT; |
215 | +-GBLDEF MSTR_DEF(gtmprompt, STR_LIT_LEN(DEFAULT_PROMPT), &prombuf[0]); |
216 | ++GBLREF char prombuf[MAX_MIDENT_LEN]; |
217 | ++GBLREF mstr gtmprompt; |
218 | + |
219 | + GBLREF gv_key *gv_currkey; |
220 | + GBLREF gv_namehead *gv_target; |
221 | +--- sr_unix/gtm_logicals.h 2008-12-04 12:27:41.000000000 -0800 |
222 | ++++ sr_unix/gtm_logicals.h 2009-04-06 18:27:29.000000000 -0700 |
223 | +@@ -65,6 +65,7 @@ |
224 | + #define GTM_MEMORY_RESERVE "$gtm_memory_reserve" |
225 | + #define GTM_ZQUIT_ANYWAY "$gtm_zquit_anyway" |
226 | + #define GTM_NOUNDEF "$gtm_noundef" |
227 | ++#define GTM_PROMPT "$gtm_prompt" |
228 | + |
229 | + /* -------------------------- Unix only -------------------------- */ |
230 | + |
231 | |
232 | === modified file 'packages/rpm/openvista-utils.spec' |
233 | --- packages/rpm/openvista-utils.spec 2009-02-18 07:37:31 +0000 |
234 | +++ packages/rpm/openvista-utils.spec 2009-02-26 04:11:01 +0000 |
235 | @@ -8,11 +8,15 @@ |
236 | Group: Applications/System |
237 | Packager: Jonathan Tai <jon.tai@medsphere.com> |
238 | |
239 | -Requires: /bin/bash, coreutils, openssh, /usr/bin/logger, /bin/tar, /usr/bin/bzip2, /usr/bin/find, vixie-cron, fis-gtm >= 5.3003, openvista-libs |
240 | -Prereq: /sbin/chkconfig, /usr/sbin/useradd |
241 | +Requires(pre): /usr/sbin/useradd |
242 | +Requires(post): /sbin/chkconfig |
243 | +Requires(preun): /sbin/chkconfig |
244 | +Requires(postun): /usr/sbin/userdel |
245 | + |
246 | +Requires: /bin/bash, coreutils, openssh, /usr/bin/logger, /bin/tar, /usr/bin/bzip2, /usr/bin/find, vixie-cron, fis-gtm, openvista-libs |
247 | |
248 | # RPM should have a suggests tag... |
249 | -# Suggests: bash-completion, putty-utils |
250 | +# Suggests: bash-completion, putty-tools |
251 | |
252 | Source: openvista-utils-%{version}.tar.bz2 |
253 | BuildArch: noarch |
254 | @@ -45,9 +49,9 @@ |
255 | install scripts/usr/bin/ovtied %{buildroot}%{_bindir}/ |
256 | install scripts/usr/bin/ovbackup %{buildroot}%{_bindir}/ |
257 | |
258 | -install -d %{buildroot}%{_sysconfdir}/init.d/ |
259 | -install scripts/etc/init.d/openvista_early %{buildroot}%{_sysconfdir}/init.d/ |
260 | -install scripts/etc/init.d/openvista %{buildroot}%{_sysconfdir}/init.d/ |
261 | +install -d %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
262 | +install scripts/etc/init.d/openvista_early %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
263 | +install scripts/etc/init.d/openvista %{buildroot}%{_sysconfdir}/rc.d/init.d/ |
264 | |
265 | install -d %{buildroot}%{_sysconfdir}/bash_completion.d/ |
266 | install -m 644 scripts/etc/bash_completion.d/openvista %{buildroot}%{_sysconfdir}/bash_completion.d/ |
267 | @@ -71,8 +75,8 @@ |
268 | %{_bindir}/openvista |
269 | %{_bindir}/ovtied |
270 | %{_bindir}/ovbackup |
271 | -%{_sysconfdir}/init.d/openvista_early |
272 | -%{_sysconfdir}/init.d/openvista |
273 | +%{_sysconfdir}/rc.d/init.d/openvista_early |
274 | +%{_sysconfdir}/rc.d/init.d/openvista |
275 | %{_sysconfdir}/bash_completion.d/openvista |
276 | %config %{_sysconfdir}/cron.d/openvista |
277 | %{_sysconfdir}/cron.daily/openvista |
278 | @@ -93,3 +97,8 @@ |
279 | /sbin/chkconfig --del openvista |
280 | fi |
281 | |
282 | +%postun |
283 | +if [ $1 = 0 ]; then |
284 | + /usr/sbin/userdel openvista 2> /dev/null || : |
285 | +fi |
286 | + |
287 | |
288 | === renamed file 'packages/rpm/putty-utils.spec' => 'packages/rpm/putty-tools.spec' |
289 | --- packages/rpm/putty-utils.spec 2009-02-07 21:26:40 +0000 |
290 | +++ packages/rpm/putty-tools.spec 2009-02-26 00:01:36 +0000 |
291 | @@ -1,4 +1,4 @@ |
292 | -Name: putty-utils |
293 | +Name: putty-tools |
294 | Version: 0.60 |
295 | Release: 1 |
296 | Summary: PuTTY command-line utilities |
297 | @@ -10,7 +10,7 @@ |
298 | Conflicts: putty |
299 | |
300 | Source: putty-%{version}.tar.gz |
301 | -Patch: putty-utils_fix-make-install.patch |
302 | +Patch: putty-tools_fix-make-install.patch |
303 | BuildRoot: %{_tmppath}/%{name}-root |
304 | |
305 | %description |
306 | |
307 | === renamed file 'packages/rpm/putty-utils_fix-make-install.patch' => 'packages/rpm/putty-tools_fix-make-install.patch' |
308 | === modified file 'scripts/etc/init.d/openvista' |
309 | --- scripts/etc/init.d/openvista 2009-02-09 19:57:36 +0000 |
310 | +++ scripts/etc/init.d/openvista 2009-03-02 20:04:16 +0000 |
311 | @@ -47,6 +47,8 @@ |
312 | |
313 | umask 007 |
314 | |
315 | + cd "$root/$instance/tmp" |
316 | + |
317 | # FIXME: check to see if routine exists; if not, fail gracefully |
318 | # FIXME: logging? |
319 | mumps -run ^ZINITS |
320 | @@ -62,12 +64,12 @@ |
321 | |
322 | umask 007 |
323 | |
324 | + cd "$root/$instance/tmp" |
325 | + |
326 | # FIXME: check to see if routine exists; if not, fail gracefully |
327 | # FIXME: logging? |
328 | mumps -run ^ZINITK |
329 | |
330 | - # FIXME: wait a few seconds, then kill all mumps processes |
331 | - |
332 | return $? |
333 | } |
334 | |
335 | @@ -94,6 +96,10 @@ |
336 | for instance in `ls $root`; do |
337 | action $" Running shutdown hooks for $instance: " zinitk "$instance" |
338 | done |
339 | + |
340 | + sleep 10 |
341 | + |
342 | + killall mumps |
343 | ;; |
344 | *) |
345 | echo "Usage: openvista {start|stop}" |
346 | |
347 | === modified file 'scripts/etc/init.d/openvista_early' |
348 | --- scripts/etc/init.d/openvista_early 2009-02-09 19:57:36 +0000 |
349 | +++ scripts/etc/init.d/openvista_early 2009-03-04 07:25:38 +0000 |
350 | @@ -63,11 +63,54 @@ |
351 | return $result |
352 | fi |
353 | |
354 | + # After recovery, the database files may still need to be run down. this |
355 | + # was observed on our own OpenVista appliance and also tested on the |
356 | + # WorldVistA VOE "four-slice toaster" appliance. An easy (and somewhat |
357 | + # reliable) way to trigger the not-rundown effect is to connect with CIS, |
358 | + # then halt the machine by killing qemu. Upon the next boot, the journal |
359 | + # recovery will run, but attempts to access the database will result in |
360 | + # not-rundown errors. Adding a call to mupip rundown here seems to fix the |
361 | + # issue. |
362 | + mupip rundown -region DEFAULT 2>&1 \ |
363 | + | grep -v '^$' \ |
364 | + | logger -p user.info -t "GTM[$$]" |
365 | + |
366 | + result=${PIPESTATUS[0]} |
367 | + |
368 | + if [ $result -ne 0 ]; then |
369 | + return $result |
370 | + fi |
371 | + |
372 | mupip set -journal="ENABLE,ON,BEFORE_IMAGES" -region DEFAULT 2>&1 \ |
373 | | grep -v '^$' \ |
374 | | logger -p user.info -t "GTM[$$]" |
375 | |
376 | - return ${PIPESTATUS[0]} |
377 | + result=${PIPESTATUS[0]} |
378 | + |
379 | + if [ $result -ne 0 ]; then |
380 | + return $result |
381 | + fi |
382 | + |
383 | + mv -f "$root/$instance/globals/scratch.dat" "$root/$instance/globals/scratch.dat~" |
384 | + |
385 | + result=$? |
386 | + |
387 | + if [ $result -ne 0 ]; then |
388 | + return $result |
389 | + fi |
390 | + |
391 | + mupip create -region=SCRATCH 2>&1 \ |
392 | + | grep -v '^$' \ |
393 | + | logger -p user.info -t "GTM[$$]" |
394 | + |
395 | + result=${PIPESTATUS[0]} |
396 | + |
397 | + if [ $result -ne 0 ]; then |
398 | + return $result |
399 | + fi |
400 | + |
401 | + chmod 660 "$root/$instance/globals/scratch.dat" |
402 | + return $? |
403 | } |
404 | |
405 | case "$1" in |
406 | |
407 | === modified file 'scripts/usr/bin/ovbackup' |
408 | --- scripts/usr/bin/ovbackup 2009-02-12 22:38:17 +0000 |
409 | +++ scripts/usr/bin/ovbackup 2009-03-01 09:15:33 +0000 |
410 | @@ -43,8 +43,8 @@ |
411 | |
412 | case "$num_backups" in |
413 | ""|0|*[!0-9]*) |
414 | - # num_backups was not set, blank, 0, or not an integer; set to default of 2 |
415 | - num_backups=2 |
416 | + # num_backups was not set, blank, 0, or not an integer; set to default of 3 |
417 | + num_backups=3 |
418 | ;; |
419 | esac |
420 | |
421 | |
422 | === modified file 'scripts/usr/lib/openvista/functions' |
423 | --- scripts/usr/lib/openvista/functions 2009-02-18 07:37:31 +0000 |
424 | +++ scripts/usr/lib/openvista/functions 2009-03-01 09:37:22 +0000 |
425 | @@ -39,9 +39,10 @@ |
426 | fi |
427 | |
428 | export gtm_dist="$root/$instance/gtm" |
429 | - export gtmroutines="$root/$instance/objects($root/$instance/routines/development $root/$instance/routines/hotfixes $root/$instance/routines/customer $root/$instance/routines/medsphere $root/$instance/routines/vendor $root/$instance/routines/foia) $root/$instance/gtm" |
430 | + export gtmroutines="$root/$instance/objects($root/$instance/routines) $root/$instance/gtm" |
431 | export gtmgbldir="$root/$instance/globals/mumps.gld" |
432 | export gtm_zinterrupt='I $$JOBEXAM^ZU($ZPOSITION)' |
433 | + export gtm_prompt="$instance>" |
434 | export GTMXC_openvista='/usr/share/openvista/openvista.xc' |
435 | export PATH="/usr/local/bin:/bin:/usr/bin:$root/$instance/gtm" |
436 | |
437 | |
438 | === modified file 'scripts/usr/sbin/ovinstanceadd' |
439 | --- scripts/usr/sbin/ovinstanceadd 2009-02-12 00:05:08 +0000 |
440 | +++ scripts/usr/sbin/ovinstanceadd 2009-03-01 09:37:22 +0000 |
441 | @@ -55,13 +55,7 @@ |
442 | install -o root -g $user -m 2750 -d "$root/$instance" |
443 | install -o root -g $user -m 2750 -d "$root/$instance/globals" |
444 | install -o root -g $user -m 2770 -d "$root/$instance/journals" |
445 | -install -o root -g $user -m 2750 -d "$root/$instance/routines" |
446 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/development" |
447 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/hotfixes" |
448 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/customer" |
449 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/medsphere" |
450 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/vendor" |
451 | -install -o root -g $user -m 2770 -d "$root/$instance/routines/foia" |
452 | +install -o root -g $user -m 2770 -d "$root/$instance/routines" |
453 | install -o root -g $user -m 2770 -d "$root/$instance/objects" |
454 | install -o root -g $user -m 2770 -d "$root/$instance/images" # FIXME: apache needs read/write access |
455 | install -o root -g $user -m 2770 -d "$root/$instance/backups" |
456 | |
457 | === added directory 'src/gtm' |
458 | === added directory 'src/gtm/sr_port' |
459 | === added file 'src/gtm/sr_port/gbldefs.c' |
460 | --- src/gtm/sr_port/gbldefs.c 1970-01-01 00:00:00 +0000 |
461 | +++ src/gtm/sr_port/gbldefs.c 2009-04-07 01:13:36 +0000 |
462 | @@ -0,0 +1,1012 @@ |
463 | +/**************************************************************** |
464 | + * * |
465 | + * Copyright 2001, 2008 Fidelity Information Services, Inc * |
466 | + * * |
467 | + * This source code contains the intellectual property * |
468 | + * of its copyright holder(s), and is made available * |
469 | + * under a license. If you do not know the terms of * |
470 | + * the license, please stop and do not read further. * |
471 | + * * |
472 | + ****************************************************************/ |
473 | + |
474 | + /* General repository for global variable definitions. This keeps us from |
475 | + pulling in modules and all their references when all we wanted was the |
476 | + global data def.. */ |
477 | + |
478 | +#include "mdef.h" |
479 | + |
480 | +#include "gtm_inet.h" |
481 | +#include "gtm_iconv.h" |
482 | +#include "gtm_socket.h" |
483 | +#include "gtm_unistd.h" |
484 | +#include "gtm_limits.h" |
485 | + |
486 | +#include <signal.h> |
487 | +#ifdef __MVS__ |
488 | +#include "gtm_time.h" /* required for fd_set */ |
489 | +#endif |
490 | +#include <sys/time.h> |
491 | +#ifdef UNIX |
492 | +# include <sys/un.h> |
493 | +#endif |
494 | +#ifdef VMS |
495 | +# include <descrip.h> /* Required for gtmsource.h */ |
496 | +# include <ssdef.h> |
497 | +# include <fab.h> |
498 | +# include "desblk.h" |
499 | +#endif |
500 | +#include "cache.h" |
501 | +#include "hashtab_int4.h" |
502 | +#include "hashtab_int8.h" |
503 | +#include "hashtab_mname.h" |
504 | +#include "hashtab_objcode.h" |
505 | +#include "rtnhdr.h" |
506 | +#include "gdsroot.h" |
507 | +#include "gdskill.h" |
508 | +#include "ccp.h" |
509 | +#include "gtm_facility.h" |
510 | +#include "fileinfo.h" |
511 | +#include "gdsbt.h" |
512 | +#include "gdsfhead.h" |
513 | +#include "filestruct.h" |
514 | +#include "gdscc.h" |
515 | +#include "comline.h" |
516 | +#include "compiler.h" |
517 | +#include "cmd_qlf.h" |
518 | +#include "io.h" |
519 | +#include "iosp.h" |
520 | +#include "jnl.h" |
521 | +#include "lv_val.h" |
522 | +#include "sbs_blk.h" |
523 | +#include "mdq.h" |
524 | +#include "mprof.h" |
525 | +#include "mv_stent.h" |
526 | +#include "stack_frame.h" |
527 | +#include "stp_parms.h" |
528 | +#include "stringpool.h" |
529 | +#include "buddy_list.h" /* needed for tp.h */ |
530 | +#include "tp.h" |
531 | +#include "tp_frame.h" |
532 | +#include "mlkdef.h" |
533 | +#include "zshow.h" |
534 | +#include "zwrite.h" |
535 | +#include "zbreak.h" |
536 | +#include "fnpc.h" |
537 | +#include "mmseg.h" |
538 | +#ifndef VMS |
539 | +# include "gtmsiginfo.h" |
540 | +#endif |
541 | +#include "gtmimagename.h" |
542 | +#include "iotcpdef.h" |
543 | +#include "gt_timer.h" |
544 | +#include "iosocketdef.h" /* needed for socket_pool and MAX_N_SOCKETS*/ |
545 | +#include "ctrlc_handler_dummy.h" |
546 | +#include "unw_prof_frame_dummy.h" |
547 | +#include "op.h" |
548 | +#include "gtmsecshr.h" |
549 | +#include "error_trap.h" |
550 | +#include "patcode.h" /* for pat_everything and sizeof_pat_everything */ |
551 | +#include "source_file.h" /* for REV_TIME_BUFF_LEN */ |
552 | +#include "mupipbckup.h" |
553 | +#include "dpgbldir.h" |
554 | +#include "mmemory.h" |
555 | +#include "have_crit.h" |
556 | + |
557 | +/* FOR REPLICATION RELATED GLOBALS */ |
558 | +#include "repl_msg.h" |
559 | +#include "gtmsource.h" |
560 | +#include "gtmrecv.h" |
561 | + |
562 | +/* FOR MERGE RELATED GLOBALS */ |
563 | +#include "subscript.h" |
564 | +#include "lvname_info.h" |
565 | +#include "gvname_info.h" |
566 | +#include "op_merge.h" |
567 | + |
568 | +#ifdef UNIX |
569 | +/* The define of CHEXPAND below causes error.h to create GBLDEFs */ |
570 | +#define CHEXPAND |
571 | +#include "error.h" |
572 | + |
573 | +#include "cli.h" |
574 | +#include "invocation_mode.h" |
575 | +#include "fgncal.h" |
576 | +#include "parse_file.h" /* for MAX_FBUFF */ |
577 | +#include "repl_sem.h" |
578 | +#include "gtm_zlib.h" |
579 | +#endif |
580 | + |
581 | +#include "jnl_typedef.h" |
582 | + |
583 | +#ifdef VMS |
584 | +#include "gtm_logicals.h" /* for GTM_MEMORY_NOACCESS_COUNT */ |
585 | +#endif |
586 | + |
587 | +#include "gds_blk_upgrade.h" /* for UPGRADE_IF_NEEDED flag */ |
588 | +#include "cws_insert.h" /* for CWS_REORG_ARRAYSIZE */ |
589 | + |
590 | +#ifdef UNICODE_SUPPORTED |
591 | +#include "gtm_icu_api.h" |
592 | +#include "gtm_utf8.h" |
593 | +#endif |
594 | + |
595 | +#define DEFAULT_ZERROR_STR "Unprocessed $ZERROR, see $ZSTATUS" |
596 | +#define DEFAULT_ZERROR_LEN (sizeof(DEFAULT_ZERROR_STR) - 1) |
597 | + |
598 | +GBLDEF gd_region *db_init_region; |
599 | +GBLDEF sgmnt_data_ptr_t cs_data; |
600 | +GBLDEF sgmnt_addrs *cs_addrs; |
601 | + |
602 | +GBLDEF unsigned short proc_act_type; |
603 | +GBLDEF volatile bool ctrlc_pending; |
604 | +GBLDEF volatile int4 ctrap_action_is; |
605 | +GBLDEF bool out_of_time; |
606 | +GBLDEF io_pair io_curr_device; /* current device */ |
607 | +GBLDEF io_pair io_std_device; /* standard device */ |
608 | +GBLDEF io_log_name *dollar_principal; /* pointer to log name GTM$PRINCIPAL if defined */ |
609 | +GBLDEF bool prin_in_dev_failure = FALSE; |
610 | +GBLDEF bool prin_out_dev_failure = FALSE; |
611 | +GBLDEF io_desc *active_device; |
612 | + |
613 | +GBLDEF bool error_mupip = FALSE, |
614 | + compile_time = FALSE, |
615 | + file_backed_up = FALSE, |
616 | + gv_replopen_error = FALSE, |
617 | + gv_replication_error = FALSE, |
618 | + incremental = FALSE, |
619 | + jobpid = FALSE, |
620 | + online = FALSE, |
621 | + record = FALSE, |
622 | + is_standalone = FALSE, |
623 | + std_dev_outbnd = FALSE, |
624 | + in_mupip_freeze = FALSE, |
625 | + in_backup = FALSE, |
626 | + view_debug1 = FALSE, |
627 | + view_debug2 = FALSE, |
628 | + view_debug3 = FALSE, |
629 | + view_debug4 = FALSE, |
630 | + dec_nofac; |
631 | + |
632 | +GBLDEF boolean_t is_updproc = FALSE, |
633 | + is_updhelper = FALSE, |
634 | + mupip_jnl_recover = FALSE, |
635 | + repl_allowed = FALSE, |
636 | + run_time = FALSE, |
637 | + unhandled_stale_timer_pop = FALSE, |
638 | + gtcm_connection = FALSE, |
639 | + is_replicator = FALSE, /* TRUE => this process can write jnl records to the jnlpool for replicated db */ |
640 | + tp_in_use = FALSE, /* TRUE => TP has been used by this process and is thus initialized */ |
641 | + dollar_truth = TRUE; |
642 | + |
643 | +GBLDEF VSIG_ATOMIC_T forced_exit = FALSE; /* Asynchronous signal/interrupt handler sets this variable to TRUE, |
644 | + * hence the VSIG_ATOMIC_T type in the definition. |
645 | + */ |
646 | +GBLDEF intrpt_state_t intrpt_ok_state = INTRPT_OK_TO_INTERRUPT; /* any other value implies it is not ok to interrupt */ |
647 | + |
648 | +GBLDEF unsigned char *msp, |
649 | + *mubbuf, |
650 | + *restart_ctxt, |
651 | + *stackbase, |
652 | + *stacktop, |
653 | + *stackwarn, |
654 | + *restart_pc; |
655 | +GBLDEF int4 backup_close_errno, |
656 | + backup_write_errno, |
657 | + mubmaxblk, |
658 | + forced_exit_err, |
659 | + exit_state, |
660 | + restore_read_errno; |
661 | +GBLDEF volatile int4 outofband, crit_count = 0; |
662 | +GBLDEF int mumps_status = SS_NORMAL, |
663 | + stp_array_size = 0; |
664 | +GBLDEF gvzwrite_struct gvzwrite_block; |
665 | +GBLDEF io_log_name *io_root_log_name; |
666 | +GBLDEF lvzwrite_struct lvzwrite_block; |
667 | +GBLDEF mliteral literal_chain; |
668 | +GBLDEF mstr *comline_base, |
669 | + dollar_zsource, |
670 | + *err_act, |
671 | + **stp_array, |
672 | + extnam_str, |
673 | + env_gtm_env_xlate; |
674 | +GBLDEF MSTR_CONST(default_sysid, "gtm_sysid"); |
675 | +GBLDEF int (*gtm_env_xlate_entry)() = NULL; |
676 | +GBLDEF void (*gtm_sigusr1_handler)() = NULL; |
677 | +GBLDEF mval dollar_zgbldir, |
678 | + dollar_zstatus, |
679 | + dollar_zstep = DEFINE_MVAL_LITERAL(MV_STR | MV_NM | MV_INT | MV_NUM_APPROX, 0, 0, 1, "B", 0, 0), |
680 | + dollar_ztrap, |
681 | + ztrap_pop2level = DEFINE_MVAL_LITERAL(MV_NM | MV_INT, 0, 0, 0, 0, 0, 0), |
682 | + zstep_action, |
683 | + dollar_system, |
684 | + dollar_estack_delta = DEFINE_MVAL_LITERAL(MV_STR, 0, 0, 0, NULL, 0, 0), |
685 | + dollar_etrap, |
686 | + dollar_zerror = DEFINE_MVAL_LITERAL(MV_STR, 0, 0, DEFAULT_ZERROR_LEN, DEFAULT_ZERROR_STR, 0, 0), |
687 | + dollar_zyerror, |
688 | + dollar_ztexit = DEFINE_MVAL_LITERAL(MV_STR, 0, 0, 0, NULL, 0, 0); |
689 | +GBLDEF uint4 dollar_zjob; |
690 | +GBLDEF mval dollar_zinterrupt; |
691 | +GBLDEF boolean_t dollar_zininterrupt; |
692 | +GBLDEF boolean_t dollar_ztexit_bool; /* Truth value of dollar_ztexit when coerced to boolean */ |
693 | +GBLDEF boolean_t dollar_zquit_anyway; |
694 | + |
695 | +#define DEFAULT_PROMPT "GTM>" |
696 | +/* The prompt buffer size (31) below would allow at least 8 Unicode characters, but since most |
697 | + * commonly used Unicode characters only occupy upto 3 bytes, the buffer would at least accommodate |
698 | + * 10 Unicode characters in a prompt */ |
699 | +GBLDEF char prombuf[MAX_MIDENT_LEN] = DEFAULT_PROMPT; |
700 | +GBLDEF MSTR_DEF(gtmprompt, STR_LIT_LEN(DEFAULT_PROMPT), &prombuf[0]); |
701 | + |
702 | +GBLDEF mv_stent *mv_chain; |
703 | +GBLDEF sgm_info *first_sgm_info; /* List of participating regions in the TP transaction with NO ftok ordering */ |
704 | +GBLDEF sgm_info *first_tp_si_by_ftok; /* List of participating regions in the TP transaction sorted on ftok order */ |
705 | +GBLDEF spdesc indr_stringpool, |
706 | + rts_stringpool, |
707 | + stringpool; |
708 | +GBLDEF stack_frame *frame_pointer; |
709 | +GBLDEF stack_frame *zyerr_frame = NULL; |
710 | +GBLDEF symval *curr_symval; |
711 | +GBLDEF tp_frame *tp_pointer; |
712 | +GBLDEF tp_region *halt_ptr, |
713 | + *grlist; |
714 | +GBLDEF trans_num local_tn; /* transaction number for THIS PROCESS (starts at 0 each time) */ |
715 | +GBLDEF gv_namehead *gv_target; |
716 | +GBLDEF gv_namehead *gv_target_list; |
717 | +GBLDEF gvt_container *gvt_pending_list; /* list of gvts that need to be re-examined/re-allocated when region is opened */ |
718 | +GBLDEF buddy_list *gvt_pending_buddy_list;/* buddy_list for maintaining memory for gv_targets to be re-examined/allocated */ |
719 | + |
720 | +GBLDEF int4 exi_condition; |
721 | +GBLDEF uint4 gtmDebugLevel; |
722 | +GBLDEF caddr_t smCallerId; /* Caller of top level malloc/free */ |
723 | +GBLDEF int process_exiting; |
724 | +GBLDEF int4 dollar_zsystem; |
725 | +GBLDEF int4 dollar_zeditor; |
726 | +GBLDEF boolean_t sem_incremented = FALSE; |
727 | +GBLDEF boolean_t new_dbinit_ipc = FALSE; |
728 | +GBLDEF mval **ind_result_array, **ind_result_sp, **ind_result_top; |
729 | +GBLDEF mval **ind_source_array, **ind_source_sp, **ind_source_top; |
730 | +GBLDEF rtn_tabent *rtn_fst_table, *rtn_names, *rtn_names_top, *rtn_names_end; |
731 | +GBLDEF int4 break_message_mask; |
732 | +GBLDEF bool rc_locked = FALSE; |
733 | +GBLDEF boolean_t certify_all_blocks = FALSE; /* If flag is set all blocks are checked after they are |
734 | + * written to the database. Upon error we stay critical |
735 | + * and report. This flag can be set via the MUMPS command |
736 | + * VIEW "GDSCERT":1. */ |
737 | +GBLDEF mval curr_gbl_root; |
738 | +GBLDEF gd_addr *original_header; |
739 | +GBLDEF hash_table_mname *gd_tab_ptr = NULL; |
740 | +GBLDEF mem_list *mem_list_head; |
741 | +GBLDEF boolean_t debug_mupip; |
742 | +GBLDEF unsigned char t_fail_hist[CDB_MAX_TRIES]; |
743 | +GBLDEF cache_rec_ptr_t cr_array[((MAX_BT_DEPTH * 2) - 1) * 2]; /* Maximum number of blocks that can be in transaction */ |
744 | +GBLDEF unsigned int cr_array_index; |
745 | +GBLDEF boolean_t need_core; /* Core file should be created */ |
746 | +GBLDEF boolean_t created_core; /* core file was created */ |
747 | +GBLDEF boolean_t core_in_progress; /* creating core NOW */ |
748 | +GBLDEF boolean_t dont_want_core; /* Higher level flag overrides need_core set by lower level rtns */ |
749 | +GBLDEF boolean_t exit_handler_active; /* recursion prevention */ |
750 | +GBLDEF boolean_t block_saved; |
751 | +#if defined(KEEP_zOS_EBCDIC) || defined(VMS) |
752 | +GBLDEF iconv_t dse_over_cvtcd = (iconv_t)0; |
753 | +#endif |
754 | +GBLDEF gtm_chset_t dse_over_chset = CHSET_M; |
755 | +GBLDEF short int last_source_column; |
756 | +GBLDEF char window_token; |
757 | +GBLDEF mval window_mval; |
758 | +GBLDEF char director_token; |
759 | +GBLDEF mval director_mval; |
760 | +LITDEF MIDENT_DEF(zero_ident, 0, NULL); /* the null mident */ |
761 | +static char ident_buff1[sizeof(mident_fixed)]; |
762 | +static char ident_buff2[sizeof(mident_fixed)]; |
763 | +GBLDEF MIDENT_DEF(window_ident, 0, &ident_buff1[0]); /* the current identifier */ |
764 | +GBLDEF MIDENT_DEF(director_ident, 0, &ident_buff2[0]); /* the look-ahead identifier */ |
765 | +GBLDEF char *lexical_ptr; |
766 | +GBLDEF int4 aligned_source_buffer[MAX_SRCLINE / sizeof(int4) + 1]; |
767 | +GBLDEF unsigned char *source_buffer = (unsigned char *)aligned_source_buffer; |
768 | +GBLDEF int4 source_error_found; |
769 | +GBLDEF src_line_struct src_head; |
770 | +GBLDEF bool code_generated; |
771 | +GBLDEF short int source_column, source_line; |
772 | +GBLDEF bool devctlexp; |
773 | +GBLDEF char cg_phase; /* code generation phase */ |
774 | +/* Previous code generation phase: Only used by emit_code.c to initialize the push list at the |
775 | + * beginning of each phase (bug fix: C9D12-002478) */ |
776 | +GBLDEF char cg_phase_last; |
777 | + |
778 | +GBLDEF int cmd_cnt; |
779 | + |
780 | +GBLDEF command_qualifier glb_cmd_qlf = { CQ_DEFAULT }, |
781 | + cmd_qlf = { CQ_DEFAULT }; |
782 | +#ifdef __osf__ |
783 | +#pragma pointer_size (save) |
784 | +#pragma pointer_size (long) |
785 | +#endif |
786 | +GBLDEF char **cmd_arg; |
787 | +#ifdef __osf__ |
788 | +#pragma pointer_size (restore) |
789 | +#endif |
790 | + |
791 | +#ifndef __vax |
792 | +GBLDEF fnpc_area fnpca; /* $piece cache structure area */ |
793 | +#endif |
794 | + |
795 | +#ifdef UNIX |
796 | +GBLDEF volatile uint4 heartbeat_counter = 0; |
797 | +#endif |
798 | + |
799 | +/* DEFERRED EVENTS */ |
800 | +GBLDEF int dollar_zmaxtptime = 0; |
801 | +GBLDEF bool licensed = TRUE; |
802 | + |
803 | +#if defined(UNIX) |
804 | +GBLDEF volatile int4 num_deferred; |
805 | +#elif defined(VMS) |
806 | +GBLDEF volatile short num_deferred; |
807 | +GBLDEF int4 lkid, lid; |
808 | +GBLDEF desblk exi_blk; |
809 | +GBLDEF struct chf$signal_array *tp_restart_fail_sig; |
810 | +GBLDEF boolean_t tp_restart_fail_sig_used; |
811 | +#else |
812 | +# error "Unsupported Platform" |
813 | +#endif |
814 | + |
815 | +GBLDEF volatile int4 fast_lock_count = 0; /* Used in wcs_stale */ |
816 | + |
817 | +/* REPLICATION RELATED GLOBALS */ |
818 | +GBLDEF gtmsource_options_t gtmsource_options; |
819 | +GBLDEF gtmrecv_options_t gtmrecv_options; |
820 | + |
821 | +GBLDEF unsigned char *profstack_base, *profstack_top, *prof_msp, *profstack_warn; |
822 | +GBLDEF unsigned char *prof_stackptr; |
823 | +GBLDEF boolean_t is_tracing_on; |
824 | +GBLDEF stack_frame_prof *prof_fp; |
825 | +GBLDEF void (*tp_timeout_start_timer_ptr)(int4 tmout_sec) = tp_start_timer_dummy; |
826 | +GBLDEF void (*tp_timeout_clear_ptr)(void) = tp_clear_timeout_dummy; |
827 | +GBLDEF void (*tp_timeout_action_ptr)(void) = tp_timeout_action_dummy; |
828 | +GBLDEF void (*ctrlc_handler_ptr)() = ctrlc_handler_dummy; |
829 | +GBLDEF int (*op_open_ptr)(mval *v, mval *p, int t, mval *mspace) = op_open_dummy; |
830 | +GBLDEF void (*unw_prof_frame_ptr)(void) = unw_prof_frame_dummy; |
831 | +GBLDEF boolean_t mu_reorg_process = FALSE; /* set to TRUE by MUPIP REORG */ |
832 | +GBLDEF boolean_t mu_reorg_in_swap_blk = FALSE; /* set to TRUE for the duration of the call to "mu_swap_blk" */ |
833 | +GBLDEF boolean_t mu_rndwn_process = FALSE; |
834 | +GBLDEF gv_key *gv_currkey_next_reorg; |
835 | +GBLDEF gv_namehead *reorg_gv_target; |
836 | + |
837 | +#ifdef UNIX |
838 | +GBLDEF struct sockaddr_un gtmsecshr_sock_name; |
839 | +GBLDEF struct sockaddr_un gtmsecshr_cli_sock_name; |
840 | +GBLDEF key_t gtmsecshr_key; |
841 | +#endif |
842 | +GBLDEF int gtmsecshr_sockpath_len; |
843 | +GBLDEF int gtmsecshr_cli_sockpath_len; |
844 | +GBLDEF mstr gtmsecshr_pathname; |
845 | +GBLDEF int server_start_tries; |
846 | +GBLDEF int gtmsecshr_log_file; |
847 | +GBLDEF int gtmsecshr_sockfd = -1; |
848 | +GBLDEF boolean_t gtmsecshr_sock_init_done = FALSE; |
849 | +GBLDEF char muext_code[MUEXT_MAX_TYPES][2] = |
850 | + { {'0', '0'}, |
851 | + {'0', '1'}, |
852 | + {'0', '2'}, |
853 | + {'0', '3'}, |
854 | + {'0', '4'}, |
855 | + {'0', '5'}, |
856 | + {'0', '6'}, |
857 | + {'0', '7'}, |
858 | + {'0', '8'}, |
859 | + {'0', '9'}, |
860 | + {'1', '0'} |
861 | + }; |
862 | +GBLDEF int patch_is_fdmp; |
863 | +GBLDEF int patch_fdmp_recs; |
864 | +GBLDEF boolean_t horiz_growth = FALSE; |
865 | +GBLDEF int4 prev_first_off, prev_next_off; |
866 | + /* these two globals store the values of first_off and next_off in cse, |
867 | + * when there is a blk split at index level. This is to permit rollback |
868 | + * to intermediate states */ |
869 | +GBLDEF sm_uc_ptr_t min_mmseg; |
870 | +GBLDEF sm_uc_ptr_t max_mmseg; |
871 | +GBLDEF mmseg *mmseg_head; |
872 | +GBLDEF ua_list *first_ua, *curr_ua; |
873 | +GBLDEF char *update_array, *update_array_ptr; |
874 | +GBLDEF int gv_fillfactor = 100, |
875 | + rc_set_fragment; /* Contains offset within data at which data fragment starts */ |
876 | +GBLDEF uint4 update_array_size = 0, |
877 | + cumul_update_array_size = 0; /* the current total size of the update array */ |
878 | +GBLDEF kill_set *kill_set_tail; |
879 | +GBLDEF boolean_t pool_init = FALSE; |
880 | +GBLDEF boolean_t is_src_server = FALSE; |
881 | +GBLDEF boolean_t is_rcvr_server = FALSE; |
882 | +GBLDEF jnl_format_buffer *non_tp_jfb_ptr = NULL; |
883 | +GBLDEF unsigned char *non_tp_jfb_buff_ptr; |
884 | +GBLDEF boolean_t dse_running = FALSE; |
885 | +GBLDEF jnlpool_addrs jnlpool; |
886 | +GBLDEF jnlpool_ctl_ptr_t jnlpool_ctl; |
887 | +GBLDEF jnlpool_ctl_struct temp_jnlpool_ctl_struct; |
888 | +GBLDEF jnlpool_ctl_ptr_t temp_jnlpool_ctl = &temp_jnlpool_ctl_struct; |
889 | +GBLDEF sm_uc_ptr_t jnldata_base; |
890 | +GBLDEF int4 jnlpool_shmid = INVALID_SHMID; |
891 | +GBLDEF recvpool_addrs recvpool; |
892 | +GBLDEF int recvpool_shmid = INVALID_SHMID; |
893 | +GBLDEF int gtmsource_srv_count = 0; |
894 | +GBLDEF int gtmrecv_srv_count = 0; |
895 | + |
896 | +/* The following _in_prog counters are needed to prevent deadlocks while doing jnl-qio (timer & non-timer). */ |
897 | +GBLDEF volatile int4 db_fsync_in_prog; |
898 | +GBLDEF volatile int4 jnl_qio_in_prog; |
899 | +#ifdef UNIX |
900 | +GBLDEF gtmsiginfo_t signal_info; |
901 | +#ifndef MUTEX_MSEM_WAKE |
902 | +GBLDEF int mutex_sock_fd = -1; |
903 | +GBLDEF struct sockaddr_un mutex_sock_address; |
904 | +GBLDEF struct sockaddr_un mutex_wake_this_proc; |
905 | +GBLDEF int mutex_wake_this_proc_len; |
906 | +GBLDEF int mutex_wake_this_proc_prefix_len; |
907 | +GBLDEF fd_set mutex_wait_on_descs; |
908 | +#endif |
909 | +#endif |
910 | +GBLDEF void (*call_on_signal)(); |
911 | +GBLDEF gtmImageName gtmImageNames[n_image_types] = |
912 | +{ |
913 | +#define IMAGE_TABLE_ENTRY(A,B) {LIT_AND_LEN(B)}, |
914 | +#include "gtmimagetable.h" |
915 | +#undef IMAGE_TABLE_ENTRY |
916 | +}; |
917 | +GBLDEF enum gtmImageTypes image_type; /* initialized at startup i.e. in dse.c, lke.c, gtm.c, mupip.c, gtmsecshr.c etc. */ |
918 | +GBLDEF volatile boolean_t semwt2long; |
919 | + |
920 | +#ifdef UNIX |
921 | +GBLDEF parmblk_struct *param_list; /* call-in parameters block (defined in unix/fgncalsp.h)*/ |
922 | +GBLDEF unsigned int invocation_mode = MUMPS_COMPILE; /* how mumps has been invoked */ |
923 | +GBLDEF char cli_err_str[MAX_CLI_ERR_STR] = ""; /* Parse Error message buffer */ |
924 | +GBLDEF char *cli_err_str_ptr = NULL; |
925 | +#endif |
926 | + |
927 | +/* this array is indexed by file descriptor */ |
928 | +GBLDEF boolean_t *lseekIoInProgress_flags = (boolean_t *)0; |
929 | + |
930 | +#if defined(UNIX) |
931 | +/* Latch variable for Unix implementations. Used in SUN and HP */ |
932 | +GBLDEF global_latch_t defer_latch; |
933 | +#endif |
934 | + |
935 | +GBLDEF int num_additional_processors; |
936 | +GBLDEF int gtm_errno = -1; /* holds the errno (unix) in case of an rts_error */ |
937 | +GBLDEF int4 error_condition = 0; |
938 | +GBLDEF global_tlvl_info *global_tlvl_info_head; |
939 | +GBLDEF buddy_list *global_tlvl_info_list; |
940 | +GBLDEF boolean_t job_try_again; |
941 | +GBLDEF volatile int4 gtmMallocDepth; /* Recursion indicator */ |
942 | +GBLDEF d_socket_struct *socket_pool; |
943 | +GBLDEF boolean_t disable_sigcont = FALSE; |
944 | +GBLDEF boolean_t mu_star_specified; |
945 | +GBLDEF backup_reg_list *mu_repl_inst_reg_list; |
946 | + |
947 | +#ifndef VMS |
948 | +GBLDEF volatile int suspend_status = NO_SUSPEND; |
949 | +#endif |
950 | + |
951 | +GBLDEF gv_namehead *reset_gv_target = INVALID_GV_TARGET; |
952 | +GBLDEF VSIG_ATOMIC_T util_interrupt = 0; |
953 | +GBLDEF boolean_t kip_incremented; |
954 | +GBLDEF boolean_t need_kip_incr; |
955 | +GBLDEF int merge_args = 0; |
956 | +GBLDEF merge_glvn_ptr mglvnp = NULL; |
957 | +GBLDEF int ztrap_form; |
958 | +GBLDEF boolean_t ztrap_new; |
959 | +GBLDEF int4 wtfini_in_prog; |
960 | +/* items for $piece stats */ |
961 | +#ifdef DEBUG |
962 | +GBLDEF int c_miss; /* cache misses (debug) */ |
963 | +GBLDEF int c_hit; /* cache hits (debug) */ |
964 | +GBLDEF int c_small; /* scanned small string brute force */ |
965 | +GBLDEF int c_small_pcs; /* chars scanned by small scan */ |
966 | +GBLDEF int c_pskip; /* number of pieces "skipped" */ |
967 | +GBLDEF int c_pscan; /* number of pieces "scanned" */ |
968 | +GBLDEF int c_parscan; /* number of partial scans (partial cache hits) */ |
969 | +GBLDEF int cs_miss; /* cache misses (debug) */ |
970 | +GBLDEF int cs_hit; /* cache hits (debug) */ |
971 | +GBLDEF int cs_small; /* scanned small string brute force */ |
972 | +GBLDEF int cs_small_pcs; /* chars scanned by small scan */ |
973 | +GBLDEF int cs_pskip; /* number of pieces "skipped" */ |
974 | +GBLDEF int cs_pscan; /* number of pieces "scanned" */ |
975 | +GBLDEF int cs_parscan; /* number of partial scans (partial cache hits) */ |
976 | +GBLDEF int c_clear; /* cleared due to (possible) value change */ |
977 | +GBLDEF boolean_t setp_work; |
978 | +#endif |
979 | +GBLDEF z_records zbrk_recs = {NULL, NULL, NULL}; |
980 | + |
981 | +#ifdef UNIX |
982 | +GBLDEF ipcs_mesg db_ipcs; /* For requesting gtmsecshr to update ipc fields */ |
983 | +GBLDEF gd_region *ftok_sem_reg = NULL; /* Last region for which ftok semaphore is grabbed */ |
984 | +GBLDEF gd_region *standalone_reg = NULL; /* We have standalone access for this region */ |
985 | +GBLDEF int gtm_non_blocked_write_retries; /* number of retries for non-blocked write to pipe */ |
986 | +#endif |
987 | + |
988 | +#ifdef VMS |
989 | +/* Following global variables store the state of an erroring sys$qio just before a GTMASSERT in the CHECK_CHANNEL_STATUS macro */ |
990 | +GBLDEF uint4 check_channel_status = 0; /* stores the qio return status */ |
991 | +GBLDEF uint4 check_channel_id = 0; /* stores the qio channel id */ |
992 | +#endif |
993 | + |
994 | +GBLDEF boolean_t write_after_image = FALSE; /* true for after-image jnlrecord writing by recover/rollback */ |
995 | +GBLDEF int iott_write_error; |
996 | +GBLDEF boolean_t recovery_success = FALSE; /* To Indicate successful recovery */ |
997 | +GBLDEF int4 write_filter; |
998 | +GBLDEF int4 zdate_form = 0; |
999 | +GBLDEF boolean_t need_no_standalone = FALSE; |
1000 | + |
1001 | +GBLDEF int4 zdir_form = ZDIR_FORM_FULLPATH; /* $ZDIR shows full path including DEVICE and DIRECTORY */ |
1002 | +GBLDEF mval dollar_zdir = DEFINE_MVAL_LITERAL(MV_STR, 0, 0, 0, NULL, 0, 0); |
1003 | + |
1004 | +GBLDEF int * volatile var_on_cstack_ptr = NULL; /* volatile pointer to int; volatile so that nothing gets optimized out */ |
1005 | +GBLDEF boolean_t gtm_environment_init = FALSE; |
1006 | +GBLDEF hash_table_int4 cw_stagnate; |
1007 | +GBLDEF boolean_t cw_stagnate_reinitialized = FALSE; |
1008 | + |
1009 | +GBLDEF uint4 pat_everything[] = { 0, 2, PATM_E, 1, 0, PAT_MAX_REPEAT, 0, PAT_MAX_REPEAT, 1 }; /* pattern = ".e" */ |
1010 | +GBLDEF mstr_len_t sizeof_pat_everything = SIZEOF(pat_everything); |
1011 | + |
1012 | +GBLDEF uint4 *pattern_typemask; |
1013 | +GBLDEF pattern *pattern_list; |
1014 | +GBLDEF pattern *curr_pattern; |
1015 | + |
1016 | +/* Unicode related data */ |
1017 | +GBLDEF boolean_t gtm_utf8_mode; /* Is GT.M running with Unicode Character Set; Set only after ICU initialization */ |
1018 | +GBLDEF boolean_t is_gtm_chset_utf8; /* Is gtm_chset environment variable set to UTF8 */ |
1019 | +GBLDEF boolean_t utf8_patnumeric; /* Should patcode N match non-ASCII numbers in pattern match ? */ |
1020 | +GBLDEF boolean_t badchar_inhibit = FALSE;/* Suppress malformed UTF-8 characters by default */ |
1021 | +GBLDEF MSTR_DEF(dollar_zchset, 1, "M"); |
1022 | +GBLDEF MSTR_DEF(dollar_zpatnumeric, 1, "M"); |
1023 | + |
1024 | +/* Standard MUMPS pattern-match table. |
1025 | + * This table holds the current pattern-matching attributes of each ASCII character. |
1026 | + * Bits 0..23 of each entry correspond with the pattern-match characters, A..X. |
1027 | + */ |
1028 | +GBLDEF pattern mumps_pattern = { |
1029 | + (void *) 0, /* flink */ |
1030 | + (void *) 0, /* typemask */ |
1031 | + (void *) 0, /* pat YZ name array */ |
1032 | + (void *) 0, /* pat YZ name-length array */ |
1033 | + -1, /* number of YZ patcodes */ |
1034 | + 1, /* namlen */ |
1035 | + {'M', '\0'} /* name */ |
1036 | +}; |
1037 | + |
1038 | +/* mapbit is used by pattab.c and patstr.c. Note that patstr.c uses only entries until PATM_X */ |
1039 | +GBLDEF readonly uint4 mapbit[] = |
1040 | +{ |
1041 | + PATM_A, PATM_B, PATM_C, PATM_D, PATM_E, PATM_F, PATM_G, PATM_H, |
1042 | + PATM_I, PATM_J, PATM_K, PATM_L, PATM_M, PATM_N, PATM_O, PATM_P, |
1043 | + PATM_Q, PATM_R, PATM_S, PATM_T, PATM_U, PATM_V, PATM_W, PATM_X, |
1044 | + PATM_YZ1, PATM_YZ2, PATM_YZ3, PATM_YZ4 |
1045 | +}; |
1046 | + |
1047 | +LITDEF uint4 typemask[PATENTS] = |
1048 | +{ |
1049 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 00-07 : ASCII characters */ |
1050 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 08-0F : ASCII characters */ |
1051 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 10-17 : ASCII characters */ |
1052 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 18-1F : ASCII characters */ |
1053 | + PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex 20-27 : ASCII characters */ |
1054 | + PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex 28-2F : ASCII characters */ |
1055 | + PATM_N, PATM_N, PATM_N, PATM_N, PATM_N, PATM_N, PATM_N, PATM_N, /* hex 30-37 : ASCII characters */ |
1056 | + PATM_N, PATM_N, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex 38-3F : ASCII characters */ |
1057 | + PATM_P, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex 40-47 : ASCII characters */ |
1058 | + PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex 48-4F : ASCII characters */ |
1059 | + PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex 50-57 : ASCII characters */ |
1060 | + PATM_U, PATM_U, PATM_U, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex 58-5F : ASCII characters */ |
1061 | + PATM_P, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex 60-67 : ASCII characters */ |
1062 | + PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex 68-6F : ASCII characters */ |
1063 | + PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex 70-77 : ASCII characters */ |
1064 | + PATM_L, PATM_L, PATM_L, PATM_P, PATM_P, PATM_P, PATM_P, PATM_C, /* hex 78-7F : ASCII characters */ |
1065 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 80-87 : non-ASCII characters */ |
1066 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 88-8F : non-ASCII characters */ |
1067 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 90-97 : non-ASCII characters */ |
1068 | + PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, PATM_C, /* hex 98-9F : non-ASCII characters */ |
1069 | + PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex A0-A7 : non-ASCII characters */ |
1070 | + PATM_P, PATM_P, PATM_L, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex A8-AF : non-ASCII characters */ |
1071 | + PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex B0-B7 : non-ASCII characters */ |
1072 | + PATM_P, PATM_P, PATM_L, PATM_P, PATM_P, PATM_P, PATM_P, PATM_P, /* hex B8-BF : non-ASCII characters */ |
1073 | + PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex C0-C7 : non-ASCII characters */ |
1074 | + PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex C8-CF : non-ASCII characters */ |
1075 | + PATM_P, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, /* hex D0-D7 : non-ASCII characters */ |
1076 | + PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_U, PATM_P, PATM_L, /* hex D8-DF : non-ASCII characters */ |
1077 | + PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex E0-E7 : non-ASCII characters */ |
1078 | + PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex E8-EF : non-ASCII characters */ |
1079 | + PATM_P, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, /* hex F0-F7 : non-ASCII characters */ |
1080 | + PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_L, PATM_P, PATM_C /* hex F8-FF : non-ASCII characters */ |
1081 | +}; |
1082 | + |
1083 | +GBLDEF uint4 pat_allmaskbits; /* universal set of valid pattern bit codes for currently active pattern table */ |
1084 | + |
1085 | +/* globals related to caching of pattern evaluation match result. |
1086 | + * for a given <strptr, strlen, patptr, depth> tuple, we store the evaluation result. |
1087 | + * in the above, |
1088 | + * <strptr, strlen> uniquely identifies a substring of the input string. |
1089 | + * <patptr> identifies the pattern atom that we are matching with |
1090 | + * <depth> identifies the recursion depth of do_patalt() for this pattern atom ("repcnt" in code) |
1091 | + * note that <depth> is a necessity in the above because the same alternation pattern atom can have different |
1092 | + * match or not-match status for the same input string depending on the repetition count usage of the pattern atom |
1093 | + * after a series of thoughts on an efficient structure for storing pattern evaluation, finally arrived at a simple |
1094 | + * array of structures wherein for a given length (strlen) we have a fixed number of structures available. |
1095 | + * we allocate an array of structures, say, 1024 structures. |
1096 | + * this is a simple 1-1 mapping, wherein |
1097 | + * for length 0, the available structures are the first 32 structures of the array, |
1098 | + * for length 1, the available structures are the second 32 structures of the array. |
1099 | + * ... |
1100 | + * for length 47, the available structures are the 47th 32 structures of the array. |
1101 | + * for length 48 and above, the available structures are all the remaining structures of the array. |
1102 | + * whenever any new entry needs to be cached and there is no room among the available structures, we preempt the |
1103 | + * most unfrequently used cache entry (to do this we do keep a count of every entry's frequency of usage) |
1104 | + * the assumption is that substrings of length > 48 (an arbitrary reasonable small number) won't be used |
1105 | + * so frequently so that they have lesser entries to fight for among themselves than lower values of length. |
1106 | + * with the above caching in place, the program segment below took 15 seconds. |
1107 | + * it was found that if the array size is increased to 16384 (as opposed to 1024 as above) and the available |
1108 | + * structures for each length increased proportionally (i.e. 16 times = 16*32 structures instead of 32 as above) |
1109 | + * the performance improved to the extent of taking 3 seconds. |
1110 | + * but this raised an interesting question, that of "size" vs. "time" tradeoff. |
1111 | + * with increasing array size, we get better "time" performance due to better caching. |
1112 | + * but that has an overhead of increased "size" (memory) usage. |
1113 | + * to arrive at a compromise, a dynamic algorithm emerged. the process will allocate a small array |
1114 | + * beginning at 1024 entries and grow to a max of 16384 entries as and when it deems the hit ratio is not good. |
1115 | + * the array only grows, i.e. there is no downsizing algorithm at play. |
1116 | + * the dynamic algorithm addresses to an extent both the "size" and "time" issues and finishes the below in 1 second. |
1117 | + * #defines for the dynamic algorithm growth can be found in patcode.h |
1118 | + */ |
1119 | +GBLDEF int4 curalt_depth = -1; /* depth of alternation nesting */ |
1120 | +GBLDEF int4 do_patalt_calls[PTE_MAX_CURALT_DEPTH]; /* number of calls to do_patalt() */ |
1121 | +GBLDEF int4 do_patalt_hits[PTE_MAX_CURALT_DEPTH]; /* number of pte_csh hits in do_patalt() */ |
1122 | +GBLDEF int4 do_patalt_maxed_out[PTE_MAX_CURALT_DEPTH]; /* no. of pte_csh misses after maxing on allocation size */ |
1123 | + |
1124 | +GBLDEF pte_csh *pte_csh_array[PTE_MAX_CURALT_DEPTH]; /* pte_csh array (per curalt_depth) */ |
1125 | +GBLDEF int4 pte_csh_cur_size[PTE_MAX_CURALT_DEPTH]; /* current pte_csh size (per curalt_depth) */ |
1126 | +GBLDEF int4 pte_csh_alloc_size[PTE_MAX_CURALT_DEPTH]; /* current allocated pte_csh size (per curalt_depth) */ |
1127 | +GBLDEF int4 pte_csh_entries_per_len[PTE_MAX_CURALT_DEPTH]; /* current number of entries per len */ |
1128 | +GBLDEF int4 pte_csh_tail_count[PTE_MAX_CURALT_DEPTH]; /* count of non 1-1 corresponding pte_csh_array members */ |
1129 | + |
1130 | +GBLDEF pte_csh *cur_pte_csh_array; /* copy of pte_csh_array corresponding to curalt_depth */ |
1131 | +GBLDEF int4 cur_pte_csh_size; /* copy of pte_csh_cur_size corresponding to curalt_depth */ |
1132 | +GBLDEF int4 cur_pte_csh_entries_per_len; /* copy of pte_csh_entries_per_len corresponding to curalt_depth */ |
1133 | +GBLDEF int4 cur_pte_csh_tail_count; /* copy of pte_csh_tail_count corresponding to curalt_depth */ |
1134 | + |
1135 | +GBLDEF readonly char *before_image_lit[] = {"NOBEFORE_IMAGES", "BEFORE_IMAGES"}; |
1136 | +GBLDEF readonly char *jnl_state_lit[] = {"DISABLED", "OFF", "ON"}; |
1137 | +GBLDEF readonly char *repl_state_lit[] = {"OFF", "ON", "WAS_ON"}; |
1138 | + |
1139 | +GBLDEF boolean_t crit_sleep_expired; /* mutex.mar: signals that a timer waiting for crit has expired */ |
1140 | +GBLDEF uint4 crit_deadlock_check_cycle; /* compared to csa->crit_check_cycle to determine if a given region |
1141 | + in a transaction legitimately has crit or not */ |
1142 | +GBLDEF node_local_ptr_t locknl; /* if non-NULL, indicates node-local of interest to the LOCK_HIST macro */ |
1143 | +GBLDEF boolean_t in_mutex_deadlock_check; /* if TRUE, mutex_deadlock_check() is part of our current C-stack trace */ |
1144 | +/* $ECODE and $STACK related variables. |
1145 | + * error_frame and skip_error_ret should ideally be part of dollar_ecode structure. since sr_avms/opp_ret.m64 uses these |
1146 | + * global variables and it was felt risky changing it to access a member of a structure, they are kept as separate globals */ |
1147 | +GBLDEF stack_frame *error_frame; /* ptr to frame where last error occurred or was rethrown */ |
1148 | +GBLDEF boolean_t skip_error_ret; /* set to TRUE by golevel(), used and reset by op_unwind() */ |
1149 | +GBLDEF dollar_ecode_type dollar_ecode; /* structure containing $ECODE related information */ |
1150 | +GBLDEF dollar_stack_type dollar_stack; /* structure containing $STACK related information */ |
1151 | +GBLDEF boolean_t ztrap_explicit_null; /* whether $ZTRAP was explicitly set to NULL in the current frame */ |
1152 | +GBLDEF int4 gtm_object_size; /* Size of entire gtm object for compiler use */ |
1153 | +GBLDEF int4 linkage_size; /* Size of linkage section during compile */ |
1154 | +GBLDEF uint4 lnkrel_cnt; /* number of entries in linkage Psect to relocate */ |
1155 | +GBLDEF int4 sym_table_size; /* size of the symbol table during compilation */ |
1156 | +GBLDEF boolean_t disallow_forced_expansion, forced_expansion; /* Used in stringpool managment */ |
1157 | +GBLDEF jnl_fence_control jnl_fence_ctl; |
1158 | +GBLDEF jnl_process_vector *prc_vec = NULL; /* for current process */ |
1159 | +GBLDEF jnl_process_vector *originator_prc_vec = NULL; /* for client/originator */ |
1160 | +LITDEF char *jrt_label[JRT_RECTYPES] = |
1161 | +{ |
1162 | +#define JNL_TABLE_ENTRY(rectype, extract_rtn, label, update, fixed_size, is_replicated) label, |
1163 | +#include "jnl_rec_table.h" |
1164 | +#undef JNL_TABLE_ENTRY |
1165 | +}; |
1166 | +LITDEF int jrt_update[JRT_RECTYPES] = |
1167 | +{ |
1168 | +#define JNL_TABLE_ENTRY(rectype, extract_rtn, label, update, fixed_size, is_replicated) update, |
1169 | +#include "jnl_rec_table.h" |
1170 | +#undef JNL_TABLE_ENTRY |
1171 | +}; |
1172 | +LITDEF boolean_t jrt_fixed_size[JRT_RECTYPES] = |
1173 | +{ |
1174 | +#define JNL_TABLE_ENTRY(rectype, extract_rtn, label, update, fixed_size, is_replicated) fixed_size, |
1175 | +#include "jnl_rec_table.h" |
1176 | +#undef JNL_TABLE_ENTRY |
1177 | +}; |
1178 | +LITDEF boolean_t jrt_is_replicated[JRT_RECTYPES] = |
1179 | +{ |
1180 | +#define JNL_TABLE_ENTRY(rectype, extract_rtn, label, update, fixed_size, is_replicated) is_replicated, |
1181 | +#include "jnl_rec_table.h" |
1182 | +#undef JNL_TABLE_ENTRY |
1183 | +}; |
1184 | +/* Change the initialization if struct_jrec_tcom in jnl.h changes */ |
1185 | +GBLDEF struct_jrec_tcom tcom_record = {{JRT_TCOM, TCOM_RECLEN, 0, 0, 0}, |
1186 | + 0, "", 0, {TCOM_RECLEN, JNL_REC_SUFFIX_CODE}}; |
1187 | +GBLDEF jnl_gbls_t jgbl; |
1188 | +GBLDEF short crash_count; |
1189 | +GBLDEF trans_num start_tn; |
1190 | +GBLDEF cw_set_element cw_set[CDB_CW_SET_SIZE]; |
1191 | +GBLDEF unsigned char cw_set_depth, cw_map_depth; |
1192 | +GBLDEF unsigned int t_tries; |
1193 | +GBLDEF uint4 t_err; |
1194 | +GBLDEF int4 update_trans; /* TRUE whenever a non-TP transaction needs to increment the database transaction number. |
1195 | + * usually TRUE if cw_set_depth/cw_map_depth of the current non-TP transaction is non-zero, |
1196 | + * but additionally TRUE in case of a redundant set in gvcst_put.c |
1197 | + * can take on a special value T_COMMIT_STARTED in t_end/tp_tend hence is not "boolean_t" |
1198 | + */ |
1199 | +GBLDEF boolean_t mu_rndwn_file_dbjnl_flush; /* to indicate standalone access is available to shared memory so |
1200 | + * wcs_recover() need not increment db curr_tn or write inctn record */ |
1201 | + |
1202 | +GBLDEF boolean_t is_uchar_wcs_code[] = /* uppercase failure codes that imply database cache related problem */ |
1203 | +{ /* if any of the following failure codes are seen in the final retry, wc_blocked will be set to trigger cache recovery */ |
1204 | +#define CDB_SC_NUM_ENTRY(code, value) |
1205 | +#define CDB_SC_UCHAR_ENTRY(code, is_wcs_code, value) is_wcs_code, |
1206 | +#define CDB_SC_LCHAR_ENTRY(code, is_wcs_code, value) |
1207 | +#include "cdb_sc_table.h" |
1208 | +#undef CDB_SC_NUM_ENTRY |
1209 | +#undef CDB_SC_UCHAR_ENTRY |
1210 | +#undef CDB_SC_LCHAR_ENTRY |
1211 | +}; |
1212 | + |
1213 | +GBLDEF boolean_t is_lchar_wcs_code[] = /* lowercase failure codes that imply database cache related problem */ |
1214 | +{ /* if any of the following failure codes are seen in the final retry, wc_blocked will be set to trigger cache recovery */ |
1215 | +#define CDB_SC_NUM_ENTRY(code, value) |
1216 | +#define CDB_SC_UCHAR_ENTRY(code, is_wcs_code, value) |
1217 | +#define CDB_SC_LCHAR_ENTRY(code, is_wcs_code, value) is_wcs_code, |
1218 | +#include "cdb_sc_table.h" |
1219 | +#undef CDB_SC_NUM_ENTRY |
1220 | +#undef CDB_SC_UCHAR_ENTRY |
1221 | +#undef CDB_SC_LCHAR_ENTRY |
1222 | +}; |
1223 | + |
1224 | +GBLDEF mval last_fnquery_return_varname; /* Return value of last $QUERY (on stringpool) (varname) */ |
1225 | +GBLDEF mval last_fnquery_return_sub[MAX_LVSUBSCRIPTS]; /* .. (subscripts) */ |
1226 | +GBLDEF int last_fnquery_return_subcnt ; /* .. (count of subscripts) */ |
1227 | + |
1228 | +GBLDEF boolean_t gvdupsetnoop = FALSE; /* if TRUE, duplicate SETs do not change GDS block (and therefore no PBLK journal |
1229 | + * records will be written) although the database transaction number will be |
1230 | + * incremented and logical SET journal records will be written. |
1231 | + */ |
1232 | +GBLDEF boolean_t gtm_fullblockwrites; /* Do full (not partial) database block writes T/F */ |
1233 | +UNIX_ONLY(GBLDEF int4 gtm_shmflags;) /* Extra flags for shmat */ |
1234 | +#ifdef VMS |
1235 | +GBLDEF uint4 gtm_memory_noaccess_defined; /* count of the number of GTM_MEMORY_NOACCESS_ADDR logicals which are defined */ |
1236 | +GBLDEF uint4 gtm_memory_noaccess[GTM_MEMORY_NOACCESS_COUNT]; /* see VMS gtm_env_init_sp.c */ |
1237 | +#endif |
1238 | + |
1239 | +GBLDEF volatile boolean_t in_wcs_recover = FALSE; /* TRUE if in wcs_recover(), used by "bt_put" and "generic_exit_handler" */ |
1240 | + |
1241 | +/* Following definitions are related to white_box testing */ |
1242 | +GBLDEF boolean_t gtm_white_box_test_case_enabled = FALSE; |
1243 | +GBLDEF int gtm_white_box_test_case_number = 0; |
1244 | +GBLDEF int gtm_white_box_test_case_count = 0; |
1245 | +GBLDEF int gtm_wbox_input_test_case_count = 0; /* VMS allows maximum 31 characters for external identifer */ |
1246 | + |
1247 | +GBLDEF boolean_t in_gvcst_incr = FALSE; /* set to TRUE by gvcst_incr, set to FALSE by gvcst_put |
1248 | + * distinguishes to gvcst_put, if the current db operation is a SET or $INCR */ |
1249 | +GBLDEF mval *post_incr_mval; /* mval pointing to the post-$INCR value */ |
1250 | +GBLDEF mval increment_delta_mval; /* mval holding the INTEGER increment value, set by gvcst_incr, |
1251 | + * used by gvcst_put/gvincr_recompute_upd_array which is invoked by t_end */ |
1252 | +GBLDEF boolean_t is_dollar_incr = FALSE; /* valid only if gvcst_put is in the call-stack (i.e. t_err == ERR_GVPUTFAIL); |
1253 | + * is a copy of "in_gvcst_incr" just before it got reset to FALSE */ |
1254 | +GBLDEF boolean_t pre_incr_update_trans; /* copy of "sgm_info_ptr->update_trans" before the $INCR */ |
1255 | +GBLDEF int indir_cache_mem_size; /* Amount of memory currently in use by indirect cache */ |
1256 | +GBLDEF hash_table_mname rt_name_tbl; |
1257 | +GBLDEF hash_table_objcode cache_table; |
1258 | +GBLDEF int cache_hits, cache_fails; |
1259 | + |
1260 | +/* The alignment feature is disabled due to some issues in stringpool garbage collection. |
1261 | + * TODO: When we sort out stringpool issues, change mstr_native_align to TRUE below */ |
1262 | +GBLDEF boolean_t mstr_native_align = FALSE; |
1263 | +GBLDEF boolean_t save_mstr_native_align; |
1264 | + |
1265 | +GBLDEF mvar *mvartab; |
1266 | +GBLDEF mvax *mvaxtab,*mvaxtab_end; |
1267 | +GBLDEF mlabel *mlabtab; |
1268 | +GBLDEF mline mline_root; |
1269 | +GBLDEF mline *mline_tail; |
1270 | +GBLDEF short int block_level; |
1271 | +GBLDEF triple t_orig; |
1272 | +GBLDEF int mvmax, mlmax, mlitmax; |
1273 | +static char routine_name_buff[sizeof(mident_fixed)], module_name_buff[sizeof(mident_fixed)]; |
1274 | +GBLDEF MIDENT_DEF(routine_name, 0, &routine_name_buff[0]); |
1275 | +GBLDEF MIDENT_DEF(module_name, 0, &module_name_buff[0]); |
1276 | +GBLDEF char rev_time_buf[REV_TIME_BUFF_LEN]; |
1277 | +GBLDEF unsigned short source_name_len; |
1278 | +GBLDEF short object_name_len; |
1279 | +UNIX_ONLY( |
1280 | + GBLDEF unsigned char source_file_name[MAX_FBUFF + 1]; |
1281 | + GBLDEF unsigned char object_file_name[MAX_FBUFF + 1]; |
1282 | + GBLDEF int object_file_des; |
1283 | +) |
1284 | +VMS_ONLY( |
1285 | + GBLDEF char source_file_name[PATH_MAX]; |
1286 | + GBLDEF char object_file_name[256]; |
1287 | + GBLDEF struct FAB obj_fab; /* file access block for the object file */ |
1288 | +) |
1289 | + |
1290 | +GBLDEF int4 curr_addr, code_size; |
1291 | +GBLDEF mident_fixed zlink_mname; |
1292 | +GBLDEF boolean_t in_op_fnnext = FALSE; /* set to TRUE by op_fnnext, set to FALSE by op_fnorder */ |
1293 | + |
1294 | +GBLDEF sm_uc_ptr_t reformat_buffer; |
1295 | +GBLDEF int reformat_buffer_len; |
1296 | +GBLDEF volatile int reformat_buffer_in_use; /* used only in DEBUG mode */ |
1297 | + |
1298 | +GBLDEF boolean_t mu_reorg_upgrd_dwngrd_in_prog; /* TRUE if MUPIP REORG UPGRADE/DOWNGRADE is in progress */ |
1299 | +GBLDEF boolean_t mu_reorg_nosafejnl; /* TRUE if NOSAFEJNL explicitly specified */ |
1300 | +GBLDEF trans_num mu_reorg_upgrd_dwngrd_blktn; /* tn in blkhdr of current block processed by MUPIP REORG {UP,DOWN}GRADE */ |
1301 | + |
1302 | +GBLDEF inctn_opcode_t inctn_opcode = inctn_invalid_op; |
1303 | +GBLDEF inctn_detail_t inctn_detail; /* holds detail to fill in to inctn jnl record */ |
1304 | +GBLDEF uint4 region_open_count; /* Number of region "opens" we have executed */ |
1305 | + |
1306 | +GBLDEF uint4 gtm_blkupgrade_flag = UPGRADE_IF_NEEDED; /* by default upgrade only if necessary */ |
1307 | +GBLDEF boolean_t disk_blk_read; |
1308 | + |
1309 | +GBLDEF boolean_t gtm_dbfilext_syslog_disable = FALSE; /* by default, log every file extension message */ |
1310 | + |
1311 | +GBLDEF int4 cws_reorg_remove_index; /* see mu_swap_blk.c for comments on the need for these two */ |
1312 | +GBLDEF block_id cws_reorg_remove_array[CWS_REORG_REMOVE_ARRAYSIZE]; |
1313 | + |
1314 | +GBLDEF uint4 log_interval; |
1315 | + |
1316 | +#ifdef UNIX |
1317 | +GBLDEF uint4 gtm_principal_editing_defaults; /* ext_cap flags if tt */ |
1318 | +GBLDEF boolean_t in_repl_inst_edit = FALSE; /* used by an assert in repl_inst_read/repl_inst_write */ |
1319 | +GBLDEF boolean_t in_repl_inst_create; /* used by repl_inst_read/repl_inst_write */ |
1320 | +GBLDEF boolean_t holds_sem[NUM_SEM_SETS][NUM_SRC_SEMS]; /* whether a particular replication semaphore is being held |
1321 | + * by the current process or not. */ |
1322 | +GBLDEF boolean_t print_offset; /* Set to TRUE if -DETAIL is specified in MUPIP REPLIC -JNLPOOL or -EDITINST */ |
1323 | +GBLDEF boolean_t in_mupip_ftok; /* Used by an assert in repl_inst_read */ |
1324 | +GBLDEF uint4 section_offset; /* Used by PRINT_OFFSET_PREFIX macro in repl_inst_dump.c */ |
1325 | + |
1326 | +GBLDEF uint4 mutex_per_process_init_pid; /* pid that invoked "mutex_per_process_init" */ |
1327 | +GBLDEF boolean_t gtm_quiet_halt; /* Suppress FORCEDHALT message */ |
1328 | +#endif |
1329 | + |
1330 | +#ifdef UNICODE_SUPPORTED |
1331 | +/* Unicode line terminators. In addition to the following |
1332 | + * codepoints, the sequence CR LF is considered a single |
1333 | + * line terminator. |
1334 | + */ |
1335 | +LITDEF UChar32 u32_line_term[] = |
1336 | +{ |
1337 | + 0x000A, /* Line Feed */ |
1338 | + 0x000D, /* Carraige Return */ |
1339 | + 0x0085, /* Next Line - EBCDIC mostly */ |
1340 | + 0x000C, /* Form Feed */ |
1341 | + UTF_LINE_SEPARATOR, /* Line Separator */ |
1342 | + UTF_PARA_SEPARATOR, /* Paragraph Separator */ |
1343 | + 0x0000 |
1344 | +}; |
1345 | + |
1346 | +/* Given the first byte in a UTF-8 representation, the following array returns the total number of bytes in the encoding |
1347 | + * 00-7F : 1 byte |
1348 | + * C2-DF : 2 bytes |
1349 | + * E0-EF : 3 bytes |
1350 | + * F0-F4 : 4 bytes |
1351 | + * All others: 1 byte |
1352 | + * For details on the UTF-8 encoding see gtm_utf8.h |
1353 | + */ |
1354 | +LITDEF unsigned int utf8_bytelen[] = |
1355 | +{ |
1356 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00-1F */ |
1357 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 20-3F */ |
1358 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 40-5F */ |
1359 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 60-7F */ |
1360 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 80-9F */ |
1361 | + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* A0-BF */ |
1362 | + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* C0-DF */ |
1363 | + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* E0-FF */ |
1364 | +}; |
1365 | + |
1366 | +/* Given the first byte in a UTF-8 representation, the following array returns the number of bytes to follow |
1367 | + * 00-7F : 0 byte |
1368 | + * C2-DF : 1 byte |
1369 | + * E0-EF : 2 bytes |
1370 | + * F0-F4 : 3 bytes |
1371 | + * All others: -1 bytes |
1372 | + * For details on the UTF-8 encoding see gtm_utf8.h |
1373 | + */ |
1374 | +LITDEF signed int utf8_followlen[] = |
1375 | +{ |
1376 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 00-1F */ |
1377 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20-3F */ |
1378 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40-5F */ |
1379 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60-7F */ |
1380 | + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* 80-9F */ |
1381 | + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* A0-BF */ |
1382 | + -1,-1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* C0-DF */ |
1383 | + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, /* E0-FF */ |
1384 | +}; |
1385 | + |
1386 | +GBLDEF gtm_wcswidth_fnptr_t gtm_wcswidth_fnptr; /* see comment in gtm_utf8.h about this typedef */ |
1387 | +#endif |
1388 | + |
1389 | +GBLDEF uint4 gtm_max_sockets; /* Maximum sockets per socket device supported by this process */ |
1390 | +GBLDEF d_socket_struct *newdsocket; /* Commonly used temp socket area */ |
1391 | + |
1392 | +GBLDEF boolean_t dse_all_dump; /* TRUE if DSE ALL -DUMP is specified */ |
1393 | +GBLDEF int socketus_interruptus; /* How many times socket reads have been interrutped */ |
1394 | + |
1395 | +GBLDEF int4 pending_errtriplecode; /* if non-zero contains the error code to invoke ins_errtriple with */ |
1396 | + |
1397 | +GBLDEF uint4 process_id; |
1398 | +GBLDEF uint4 image_count; /* not used in UNIX but defined to preserve VMS compatibility */ |
1399 | + |
1400 | +GBLDEF size_t totalRmalloc; /* Total storage currently (real) malloc'd (includes extent blocks) */ |
1401 | +GBLDEF size_t totalAlloc; /* Total allocated (includes allocation overhead but not free space */ |
1402 | +GBLDEF size_t totalUsed; /* Sum of user allocated portions (totalAlloc - overhead) */ |
1403 | + |
1404 | +GBLDEF size_t totalRallocGta; /* Total storage currently (real) mmap alloc'd */ |
1405 | +GBLDEF size_t totalAllocGta; /* Total mmap allocated (includes allocation overhead but not free space */ |
1406 | +GBLDEF size_t totalUsedGta; /* Sum of "in-use" portions (totalAllocGta - overhead) */ |
1407 | + |
1408 | +GBLDEF volatile char *outOfMemoryMitigation; /* Cache that we will freed to help cleanup if run out of memory */ |
1409 | +GBLDEF uint4 outOfMemoryMitigateSize;/* Size of above cache (in Kbytes) */ |
1410 | + |
1411 | +GBLDEF int mcavail; |
1412 | +GBLDEF mcalloc_hdr *mcavailptr, *mcavailbase; |
1413 | + |
1414 | +GBLDEF uint4 max_cache_memsize; /* Maximum bytes used for indirect cache object code */ |
1415 | +GBLDEF uint4 max_cache_entries; /* Maximum number of cached indirect compilations */ |
1416 | + |
1417 | +GBLDEF void (*cache_table_relobjs)(void); /* Function pointer to call cache_table_rebuild() */ |
1418 | +UNIX_ONLY(GBLDEF ch_ret_type (*ht_rhash_ch)();) /* Function pointer to hashtab_rehash_ch */ |
1419 | +UNIX_ONLY(GBLDEF ch_ret_type (*jbxm_dump_ch)();) /* Function pointer to jobexam_dump_ch */ |
1420 | + |
1421 | +#ifdef VMS |
1422 | +GBLDEF boolean_t tp_has_kill_t_cse; /* cse->mode of kill_t_write or kill_t_create got created in this transaction */ |
1423 | +#endif |
1424 | + |
1425 | +#ifdef DEBUG |
1426 | +/* Set to TRUE in a few selected places before wcs_recover is called. Any other place that calls wcs_recover in the final |
1427 | + * retry will fail an assert as we dont want to call cache recovery while in the middle of a transaction and confuse ourselves |
1428 | + * enough to cause further restarts (which is an out-of-design situation while in the final retry). |
1429 | + */ |
1430 | +GBLDEF boolean_t ok_to_call_wcs_recover; |
1431 | +GBLDEF uint4 donot_commit; /* see gdsfhead.h for purpose of this debug-only global */ |
1432 | +#endif |
1433 | + |
1434 | +GBLDEF cache_rec_ptr_t pin_fail_cr; /* Pointer to the cache-record that we failed while pinning */ |
1435 | +GBLDEF cache_rec pin_fail_cr_contents; /* Contents of the cache-record that we failed while pinning */ |
1436 | +GBLDEF cache_rec_ptr_t pin_fail_twin_cr; /* Pointer to twin of the cache-record that we failed to pin */ |
1437 | +GBLDEF cache_rec pin_fail_twin_cr_contents; /* Contents of twin of the cache-record that we failed to pin */ |
1438 | +GBLDEF bt_rec_ptr_t pin_fail_bt; /* Pointer to bt of the cache-record that we failed to pin */ |
1439 | +GBLDEF bt_rec pin_fail_bt_contents; /* Contents of bt of the cache-record that we failed to pin */ |
1440 | +GBLDEF int4 pin_fail_in_crit; /* Holder of crit at the time we failed to pin */ |
1441 | +GBLDEF int4 pin_fail_wc_in_free; /* Number of write cache records in free queue when we failed to pin */ |
1442 | +GBLDEF int4 pin_fail_wcs_active_lvl; /* Number of entries in active queue when we failed to pin */ |
1443 | +GBLDEF int4 pin_fail_ref_cnt; /* Reference count when we failed to pin */ |
1444 | +GBLDEF int4 pin_fail_in_wtstart; /* Count of processes in wcs_wtstart when we failed to pin */ |
1445 | +GBLDEF int4 pin_fail_phase2_commit_pidcnt; /* Number of processes in phase2 commit when we failed to pin */ |
1446 | + |
1447 | +#ifdef DEBUG |
1448 | +GBLDEF boolean_t gtm_gvundef_fatal; |
1449 | +GBLDEF boolean_t in_op_gvget; /* TRUE if op_gvget() is a call ancestor in the C-stack */ |
1450 | +GBLDEF boolean_t ready2signal_gvundef; /* TRUE if GET operation is about to signal a GVUNDEF */ |
1451 | +#endif |
1452 | + |
1453 | +GBLDEF boolean_t gtm_tp_allocation_clue; /* block# hint to start allocation for created blocks in TP */ |
1454 | + |
1455 | +#ifdef UNIX |
1456 | +GBLDEF int4 gtm_zlib_cmp_level; /* zlib compression level specified at process startup */ |
1457 | +GBLDEF int4 repl_zlib_cmp_level; /* zlib compression level currently in use in replication pipe. |
1458 | + * This is a source-server specific variable and is non-zero only |
1459 | + * if compression is enabled and works in the receiver server as well. |
1460 | + */ |
1461 | +GBLDEF zlib_cmp_func_t zlib_compress_fnptr; |
1462 | +GBLDEF zlib_uncmp_func_t zlib_uncompress_fnptr; |
1463 | +#endif |
1464 | + |
1465 | +GBLDEF mlk_stats_t mlk_stats; /* Process-private M-lock statistics */ |
1466 | + |
1467 | +#ifdef UNIX |
1468 | +/* Initialized blockalrm and block_sigsent can be used by all */ |
1469 | +GBLDEF boolean_t blocksig_initialized = FALSE; /* set to TRUE when blockalrm and block_sigsent are initialized */ |
1470 | +GBLDEF sigset_t blockalrm; |
1471 | +GBLDEF sigset_t block_sigsent; /* block all signals that can be sent externally |
1472 | + (SIGINT, SIGQUIT, SIGTERM, SIGTSTP, SIGCONT) */ |
1473 | +#endif |
1474 | + |
1475 | |
1476 | === added file 'src/gtm/sr_port/gtm_env_init.c' |
1477 | --- src/gtm/sr_port/gtm_env_init.c 1970-01-01 00:00:00 +0000 |
1478 | +++ src/gtm/sr_port/gtm_env_init.c 2009-04-07 01:13:36 +0000 |
1479 | @@ -0,0 +1,216 @@ |
1480 | +/**************************************************************** |
1481 | + * * |
1482 | + * Copyright 2004, 2008 Fidelity Information Services, Inc * |
1483 | + * * |
1484 | + * This source code contains the intellectual property * |
1485 | + * of its copyright holder(s), and is made available * |
1486 | + * under a license. If you do not know the terms of * |
1487 | + * the license, please stop and do not read further. * |
1488 | + * * |
1489 | + ****************************************************************/ |
1490 | + |
1491 | +#include "mdef.h" |
1492 | + |
1493 | +#include "gtm_logicals.h" |
1494 | +#include "gtm_stdlib.h" |
1495 | +#include "gtm_string.h" |
1496 | +#include "logical_truth_value.h" |
1497 | +#include "trans_numeric.h" |
1498 | +#include "gtmdbglvl.h" |
1499 | +#include "iosp.h" |
1500 | +#include "wbox_test_init.h" |
1501 | +#include "gtm_env_init.h" /* for gtm_env_init() and gtm_env_init_sp() prototype */ |
1502 | +#include "gt_timer.h" |
1503 | +#include "io.h" |
1504 | +#include "iotcpdef.h" |
1505 | +#include "iosocketdef.h" |
1506 | +#include "gtm_malloc.h" |
1507 | +#include "cache.h" |
1508 | +#include "gdsroot.h" /* needed for gdsfhead.h */ |
1509 | +#include "gdskill.h" /* needed for gdsfhead.h */ |
1510 | +#include "gdsbt.h" /* needed for gdsfhead.h */ |
1511 | +#include "gdsfhead.h" /* needed for MAXTOTALBLKS_MAX macro */ |
1512 | +#include "trans_log_name.h" |
1513 | +#include "op.h" |
1514 | +#include "svnames.h" |
1515 | + |
1516 | +#ifdef DEBUG |
1517 | +# define INITIAL_DEBUG_LEVEL GDL_Simple |
1518 | +GBLDEF boolean_t gtmdbglvl_inited; /* gtmDebugLevel has been initialized */ |
1519 | +#else |
1520 | +# define INITIAL_DEBUG_LEVEL GDL_None |
1521 | +#endif |
1522 | + |
1523 | +#ifdef FULLBLOCKWRITES |
1524 | +# define DEFAULT_FBW_FLAG TRUE |
1525 | +#else |
1526 | +# define DEFAULT_FBW_FLAG FALSE |
1527 | +#endif |
1528 | + |
1529 | +GBLREF boolean_t dollar_zquit_anyway; /* if TRUE compile QUITs to not care whether or not they're from an extrinsic */ |
1530 | +GBLREF boolean_t gvdupsetnoop; /* if TRUE, duplicate SETs update journal but not database (except |
1531 | + for curr_tn++) */ |
1532 | +GBLREF uint4 gtmDebugLevel; /* Debug level (0 = using default sm module so with |
1533 | + a DEBUG build, even level 0 implies basic debugging) */ |
1534 | +GBLREF boolean_t gtm_fullblockwrites; /* Do full (not partial) database block writes T/F */ |
1535 | +GBLREF boolean_t certify_all_blocks; |
1536 | +GBLREF boolean_t local_collseq_stdnull; /* If true, standard null subscript collation will be used for local variables */ |
1537 | +GBLREF uint4 gtm_blkupgrade_flag; /* controls whether dynamic block upgrade is attempted or not */ |
1538 | +GBLREF boolean_t gtm_dbfilext_syslog_disable; /* control whether db file extension message is logged or not */ |
1539 | +GBLREF uint4 gtm_max_sockets; /* Maximum sockets in a socket device that can be created by this process */ |
1540 | +GBLREF bool undef_inhibit; |
1541 | +GBLREF uint4 outOfMemoryMitigateSize; /* Reserve that we will freed to help cleanup if run out of memory */ |
1542 | +GBLREF uint4 max_cache_memsize; /* Maximum bytes used for indirect cache object code */ |
1543 | +GBLREF uint4 max_cache_entries; /* Maximum number of cached indirect compilations */ |
1544 | +GBLREF boolean_t gtm_tp_allocation_clue; /* block# hint to start allocation for created blocks in TP */ |
1545 | + |
1546 | +GBLREF char prombuf[MAX_MIDENT_LEN]; |
1547 | +GBLREF mstr gtmprompt; |
1548 | + |
1549 | +#ifdef DEBUG |
1550 | +GBLREF boolean_t gtm_gvundef_fatal; |
1551 | +#endif |
1552 | + |
1553 | +void gtm_env_init(void) |
1554 | +{ |
1555 | + static boolean_t gtm_env_init_done = FALSE; |
1556 | + mstr val; |
1557 | + boolean_t ret, is_defined; |
1558 | + uint4 tdbglvl, tmsock, reservesize, memsize, cachent; |
1559 | + char* prompt_env_val; |
1560 | + |
1561 | + if (!gtm_env_init_done) |
1562 | + { |
1563 | + /* See if a debug level has been specified. Do this first since gtmDebugLevel needs |
1564 | + to be initialized before any mallocs are done in the system. |
1565 | + */ |
1566 | + gtmDebugLevel = INITIAL_DEBUG_LEVEL; |
1567 | + val.addr = GTM_DEBUG_LEVEL_ENVLOG; |
1568 | + val.len = sizeof(GTM_DEBUG_LEVEL_ENVLOG) - 1; |
1569 | + if (tdbglvl = trans_numeric(&val, &is_defined, TRUE)) /* Note assignment!! */ |
1570 | + { /* Some kind of debugging was asked for.. */ |
1571 | + tdbglvl |= GDL_Simple; /* Make sure simple debugging turned on if any is */ |
1572 | + if ((GDL_SmChkFreeBackfill | GDL_SmChkAllocBackfill) & tdbglvl) |
1573 | + tdbglvl |= GDL_SmBackfill; /* Can't check it unless it's filled in */ |
1574 | + if (GDL_SmStorHog & tdbglvl) |
1575 | + tdbglvl |= GDL_SmBackfill | GDL_SmChkAllocBackfill; |
1576 | + gtmDebugLevel |= tdbglvl; |
1577 | + } |
1578 | + DEBUG_ONLY(gtmdbglvl_inited = TRUE); |
1579 | + |
1580 | + /* Duplicate Set Noop environment/logical */ |
1581 | + val.addr = GTM_GVDUPSETNOOP; |
1582 | + val.len = sizeof(GTM_GVDUPSETNOOP) - 1; |
1583 | + assert(FALSE == gvdupsetnoop); /* should have been set to FALSE in gbldefs.c */ |
1584 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1585 | + if (is_defined) |
1586 | + gvdupsetnoop = ret; /* if the logical is not defined, we want gvdupsetnoop to take its default value */ |
1587 | + |
1588 | + /* NOUNDEF environment/logical */ |
1589 | + val.addr = GTM_NOUNDEF; |
1590 | + val.len = sizeof(GTM_NOUNDEF) - 1; |
1591 | + assert(FALSE == undef_inhibit); /* should have been set to FALSE at global variable definition time */ |
1592 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1593 | + if (is_defined) |
1594 | + undef_inhibit = ret; /* if the logical is not defined, we want undef_inhibit to take its default value */ |
1595 | + |
1596 | +# ifdef DEBUG |
1597 | + /* GTM_GVUNDEF_FATAL environment/logical */ |
1598 | + val.addr = GTM_GVUNDEF_FATAL; |
1599 | + val.len = sizeof(GTM_GVUNDEF_FATAL) - 1; |
1600 | + assert(FALSE == gtm_gvundef_fatal); /* should have been set to FALSE in gbldefs.c */ |
1601 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1602 | + if (is_defined) |
1603 | + gtm_gvundef_fatal = ret; /* if logical is not defined, we want gtm_gvundef_fatal to take default value */ |
1604 | +# endif |
1605 | + |
1606 | + /* Initialize variable that controls TP allocation clue (for created blocks) */ |
1607 | + val.addr = GTM_TP_ALLOCATION_CLUE; |
1608 | + val.len = sizeof(GTM_TP_ALLOCATION_CLUE) - 1; |
1609 | + gtm_tp_allocation_clue = trans_numeric(&val, &is_defined, TRUE); |
1610 | + if (!is_defined) |
1611 | + gtm_tp_allocation_clue = MAXTOTALBLKS_MAX; |
1612 | + |
1613 | + /* Full Database-block Write mode */ |
1614 | + val.addr = GTM_FULLBLOCKWRITES; |
1615 | + val.len = sizeof(GTM_FULLBLOCKWRITES) - 1; |
1616 | + gtm_fullblockwrites = logical_truth_value(&val, FALSE, &is_defined); |
1617 | + if (!is_defined) |
1618 | + gtm_fullblockwrites = DEFAULT_FBW_FLAG; |
1619 | + |
1620 | + /* GDS Block certification */ |
1621 | + val.addr = GTM_GDSCERT; |
1622 | + val.len = sizeof(GTM_GDSCERT) - 1; |
1623 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1624 | + if (is_defined) |
1625 | + certify_all_blocks = ret; /* if the logical is not defined, we want to take default value */ |
1626 | + |
1627 | + /* Initialize null subscript's collation order */ |
1628 | + val.addr = LCT_STDNULL; |
1629 | + val.len = sizeof(LCT_STDNULL) - 1; |
1630 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1631 | + if (is_defined) |
1632 | + local_collseq_stdnull = ret; |
1633 | + |
1634 | + /* Initialize variables for white box testing. Even though these white-box test variables only control the |
1635 | + * flow of the DBG builds, the PRO builds check on these variables (for example, in tp_restart.c to decide |
1636 | + * whether to fork_n_core or not) so need to do this initialization for PRO builds as well. |
1637 | + */ |
1638 | + wbox_test_init(); |
1639 | + |
1640 | + /* Initialize variable that controls dynamic GT.M block upgrade */ |
1641 | + val.addr = GTM_BLKUPGRADE_FLAG; |
1642 | + val.len = sizeof(GTM_BLKUPGRADE_FLAG) - 1; |
1643 | + gtm_blkupgrade_flag = trans_numeric(&val, &is_defined, TRUE); |
1644 | + |
1645 | + /* Initialize whether database file extensions need to be logged in the operator log */ |
1646 | + val.addr = GTM_DBFILEXT_SYSLOG_DISABLE; |
1647 | + val.len = sizeof(GTM_DBFILEXT_SYSLOG_DISABLE) - 1; |
1648 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1649 | + if (is_defined) |
1650 | + gtm_dbfilext_syslog_disable = ret; /* if the logical is not defined, we want to take default value */ |
1651 | + |
1652 | + /* Initialize maximum sockets in a single socket device createable by this process */ |
1653 | + gtm_max_sockets = MAX_N_SOCKET; |
1654 | + val.addr = GTM_MAX_SOCKETS; |
1655 | + val.len = sizeof(GTM_MAX_SOCKETS) - 1; |
1656 | + if ((tmsock = trans_numeric(&val, &is_defined, TRUE)) && MAX_MAX_N_SOCKET > tmsock) /* Note assignment!! */ |
1657 | + gtm_max_sockets = tmsock; |
1658 | + |
1659 | + /* Initialize storage to allocate and keep in our back pocket in case run out of memory */ |
1660 | + outOfMemoryMitigateSize = GTM_MEMORY_RESERVE_DEFAULT; |
1661 | + val.addr = GTM_MEMORY_RESERVE; |
1662 | + val.len = sizeof(GTM_MEMORY_RESERVE) - 1; |
1663 | + if (reservesize = trans_numeric(&val, &is_defined, TRUE)) /* Note assignment!! */ |
1664 | + outOfMemoryMitigateSize = reservesize; |
1665 | + |
1666 | + /* Initialize indirect cache limits (max memory, max entries) */ |
1667 | + max_cache_memsize = MAX_CACHE_MEMSIZE * 1024; |
1668 | + val.addr = GTM_MAX_INDRCACHE_MEMORY; |
1669 | + val.len = sizeof(GTM_MAX_INDRCACHE_MEMORY) - 1; |
1670 | + if (memsize = trans_numeric(&val, &is_defined, TRUE)) /* Note assignment!! */ |
1671 | + max_cache_memsize = memsize * 1024; |
1672 | + max_cache_entries = MAX_CACHE_ENTRIES; |
1673 | + val.addr = GTM_MAX_INDRCACHE_COUNT; |
1674 | + val.len = sizeof(GTM_MAX_INDRCACHE_COUNT) - 1; |
1675 | + if (cachent = trans_numeric(&val, &is_defined, TRUE)) /* Note assignment!! */ |
1676 | + max_cache_entries = cachent; |
1677 | + |
1678 | + /* Initialize ZQUIT to control funky QUIT compilation */ |
1679 | + val.addr = GTM_ZQUIT_ANYWAY; |
1680 | + val.len = sizeof(GTM_ZQUIT_ANYWAY) - 1; |
1681 | + ret = logical_truth_value(&val, FALSE, &is_defined); |
1682 | + if (is_defined) |
1683 | + dollar_zquit_anyway = ret; |
1684 | + |
1685 | + if (NULL!=(prompt_env_val=GETENV(GTM_PROMPT+1)) && strlen(prompt_env_val)<sizeof(prombuf)) { |
1686 | + val.addr = GTM_PROMPT; |
1687 | + val.len = sizeof(GTM_PROMPT) - 1; |
1688 | + TRANS_LOG_NAME(&val, >mprompt, prombuf, sizeof(prombuf), do_sendmsg_on_log2long); |
1689 | + } |
1690 | + |
1691 | + /* Platform specific initializations */ |
1692 | + gtm_env_init_sp(); |
1693 | + gtm_env_init_done = TRUE; |
1694 | + } |
1695 | +} |
1696 | |
1697 | === added file 'src/gtm/sr_port/op_svput.c' |
1698 | --- src/gtm/sr_port/op_svput.c 1970-01-01 00:00:00 +0000 |
1699 | +++ src/gtm/sr_port/op_svput.c 2009-04-07 01:13:36 +0000 |
1700 | @@ -0,0 +1,314 @@ |
1701 | +/**************************************************************** |
1702 | + * * |
1703 | + * Copyright 2001, 2008 Fidelity Information Services, Inc * |
1704 | + * * |
1705 | + * This source code contains the intellectual property * |
1706 | + * of its copyright holder(s), and is made available * |
1707 | + * under a license. If you do not know the terms of * |
1708 | + * the license, please stop and do not read further. * |
1709 | + * * |
1710 | + ****************************************************************/ |
1711 | + |
1712 | +#include "mdef.h" |
1713 | + |
1714 | +#include "gtm_stdlib.h" |
1715 | +#include "gtm_string.h" |
1716 | + |
1717 | +#include "svnames.h" |
1718 | +#include "io.h" |
1719 | +#include "gdsroot.h" |
1720 | +#include "gtm_facility.h" |
1721 | +#include "fileinfo.h" |
1722 | +#include "gdsbt.h" |
1723 | +#include "gdsfhead.h" |
1724 | +#include "indir_enum.h" |
1725 | +#include "error.h" |
1726 | +#include "stringpool.h" |
1727 | +#include "op.h" |
1728 | +#include "mvalconv.h" |
1729 | +#include "zroutines.h" |
1730 | +#include "dpgbldir.h" |
1731 | +#include "dpgbldir_sysops.h" |
1732 | +#include "gtmmsg.h" |
1733 | +#include "ztrap_save_ctxt.h" |
1734 | +#include "dollar_zlevel.h" |
1735 | +#include "error_trap.h" |
1736 | +#include "gtm_ctype.h" |
1737 | +#include "setzdir.h" |
1738 | +#include "rtnhdr.h" |
1739 | +#include "stack_frame.h" |
1740 | +#include "getzdir.h" |
1741 | +#include "gtm_newintrinsic.h" |
1742 | + |
1743 | +GBLREF char prombuf[MAX_MIDENT_LEN]; |
1744 | +GBLREF mstr gtmprompt; |
1745 | + |
1746 | +GBLREF gv_key *gv_currkey; |
1747 | +GBLREF gv_namehead *gv_target; |
1748 | +GBLREF gd_addr *gd_header; |
1749 | +GBLREF gd_addr *gd_targ_addr; |
1750 | +GBLREF gd_binding *gd_map; |
1751 | +GBLREF gd_binding *gd_map_top; |
1752 | +GBLREF io_pair io_curr_device; |
1753 | +GBLREF mval dollar_ztrap; |
1754 | +GBLREF mval dollar_zstatus; |
1755 | +GBLREF mval dollar_zgbldir; |
1756 | +GBLREF mval dollar_zstep; |
1757 | +GBLREF mstr dollar_zcompile; |
1758 | +GBLREF mstr dollar_zroutines; |
1759 | +GBLREF mstr dollar_zsource; |
1760 | +GBLREF int dollar_zmaxtptime; |
1761 | +GBLREF int ztrap_form; |
1762 | +GBLREF mval dollar_etrap; |
1763 | +GBLREF mval dollar_zerror; |
1764 | +GBLREF mval dollar_zyerror; |
1765 | +GBLREF mval dollar_system; |
1766 | +GBLREF mval dollar_zinterrupt; |
1767 | +GBLREF boolean_t ztrap_new; |
1768 | +GBLREF stack_frame *error_frame; |
1769 | +GBLREF boolean_t ztrap_explicit_null; /* whether $ZTRAP was explicitly set to NULL in this frame */ |
1770 | +GBLREF int4 zdate_form; |
1771 | +GBLREF mval dollar_ztexit; |
1772 | +GBLREF boolean_t dollar_ztexit_bool; |
1773 | +GBLREF boolean_t dollar_zquit_anyway; |
1774 | + |
1775 | +void op_svput(int varnum, mval *v) |
1776 | +{ |
1777 | + int i, ok, state; |
1778 | + char *vptr; |
1779 | + error_def(ERR_INVECODEVAL); |
1780 | + error_def(ERR_SETECODE); |
1781 | + error_def(ERR_SYSTEMVALUE); |
1782 | + |
1783 | + switch (varnum) |
1784 | + { |
1785 | + case SV_X: |
1786 | + MV_FORCE_NUM(v); |
1787 | + io_curr_device.out->dollar.x = (short)MV_FORCE_INT(v); |
1788 | + if ((short)(io_curr_device.out->dollar.x) < 0) |
1789 | + io_curr_device.out->dollar.x = 0; |
1790 | + break; |
1791 | + case SV_Y: |
1792 | + MV_FORCE_NUM(v); |
1793 | + io_curr_device.out->dollar.y = (short)MV_FORCE_INT(v); |
1794 | + if ((short)(io_curr_device.out->dollar.y) < 0) |
1795 | + io_curr_device.out->dollar.y = 0; |
1796 | + break; |
1797 | + case SV_ZCOMPILE: |
1798 | + MV_FORCE_STR(v); |
1799 | + if (dollar_zcompile.addr) |
1800 | + free (dollar_zcompile.addr); |
1801 | + dollar_zcompile.addr = (char *)malloc(v->str.len); |
1802 | + memcpy (dollar_zcompile.addr, v->str.addr, v->str.len); |
1803 | + dollar_zcompile.len = v->str.len; |
1804 | + break; |
1805 | + case SV_ZSTEP: |
1806 | + MV_FORCE_STR(v); |
1807 | + op_commarg(v,indir_linetail); |
1808 | + op_unwind(); |
1809 | + dollar_zstep = *v; |
1810 | + break; |
1811 | + case SV_ZGBLDIR: |
1812 | + MV_FORCE_STR(v); |
1813 | + if ((dollar_zgbldir.str.len != v->str.len) || memcmp(dollar_zgbldir.str.addr, v->str.addr, dollar_zgbldir.str.len)) |
1814 | + { |
1815 | + if (0 == v->str.len) |
1816 | + { |
1817 | + /* set $zgbldir="" */ |
1818 | + dpzgbini(); |
1819 | + gd_header = NULL; |
1820 | + } else |
1821 | + { |
1822 | + gd_header = zgbldir(v); |
1823 | + /* update the gd_map */ |
1824 | + SET_GD_MAP; |
1825 | + dollar_zgbldir.str.len = v->str.len; |
1826 | + dollar_zgbldir.str.addr = v->str.addr; |
1827 | + s2pool(&dollar_zgbldir.str); |
1828 | + } |
1829 | + if (NULL != gv_currkey) |
1830 | + { |
1831 | + gv_currkey->base[0] = '\0'; |
1832 | + gv_currkey->prev = gv_currkey->end = 0; |
1833 | + } else if (NULL != gd_header) |
1834 | + gvinit(); |
1835 | + if (NULL != gv_target) |
1836 | + gv_target->clue.end = 0; |
1837 | + } |
1838 | + break; |
1839 | + case SV_ZMAXTPTIME: |
1840 | + dollar_zmaxtptime = mval2i(v); |
1841 | + break; |
1842 | + case SV_ZROUTINES: |
1843 | + MV_FORCE_STR(v); |
1844 | + /* The string(v) should be parsed and loaded before setting $zroutines |
1845 | + * to retain the old value in case errors occur while loading */ |
1846 | + zro_load(&v->str); |
1847 | + if (dollar_zroutines.addr) |
1848 | + free (dollar_zroutines.addr); |
1849 | + dollar_zroutines.addr = (char *)malloc(v->str.len); |
1850 | + memcpy (dollar_zroutines.addr, v->str.addr, v->str.len); |
1851 | + dollar_zroutines.len = v->str.len; |
1852 | + break; |
1853 | + case SV_ZSOURCE: |
1854 | + MV_FORCE_STR(v); |
1855 | + dollar_zsource = v->str; |
1856 | + break; |
1857 | + case SV_ZTRAP: |
1858 | + MV_FORCE_STR(v); |
1859 | + if (ztrap_new) |
1860 | + op_newintrinsic(SV_ZTRAP); |
1861 | + dollar_ztrap.mvtype = MV_STR; |
1862 | + dollar_ztrap.str = v->str; |
1863 | + /* Setting either $ZTRAP or $ETRAP to empty causes any current error trapping to be canceled */ |
1864 | + if (!v->str.len) |
1865 | + { |
1866 | + dollar_etrap.mvtype = MV_STR; |
1867 | + dollar_etrap.str = v->str; |
1868 | + ztrap_explicit_null = TRUE; |
1869 | + } else /* Ensure that $ETRAP and $ZTRAP are not both active at the same time */ |
1870 | + { |
1871 | + ztrap_explicit_null = FALSE; |
1872 | + if (dollar_etrap.str.len > 0) |
1873 | + gtm_newintrinsic(&dollar_etrap); |
1874 | + } |
1875 | + if (ztrap_form & ZTRAP_POP) |
1876 | + ztrap_save_ctxt(); |
1877 | + break; |
1878 | + case SV_ZSTATUS: |
1879 | + MV_FORCE_STR(v); |
1880 | + dollar_zstatus.mvtype = MV_STR; |
1881 | + dollar_zstatus.str = v->str; |
1882 | + break; |
1883 | + case SV_PROMPT: |
1884 | + MV_FORCE_STR(v); |
1885 | + MV_FORCE_LEN_STRICT(v); /* Ensure that direct mode prompt will not have BADCHARs, |
1886 | + otherwise the BADCHAR error may fill up the filesystem */ |
1887 | + if (v->str.len <= sizeof(prombuf)) |
1888 | + gtmprompt.len = v->str.len; |
1889 | + else if (!gtm_utf8_mode) |
1890 | + gtmprompt.len = sizeof(prombuf); |
1891 | +#ifdef UNICODE_SUPPORTED |
1892 | + else |
1893 | + { |
1894 | + UTF8_LEADING_BYTE(v->str.addr + sizeof(prombuf), v->str.addr, vptr); |
1895 | + gtmprompt.len = INTCAST(vptr - v->str.addr); |
1896 | + } |
1897 | +#endif |
1898 | + memcpy(gtmprompt.addr, v->str.addr, gtmprompt.len); |
1899 | + break; |
1900 | + case SV_ECODE: |
1901 | + MV_FORCE_STR(v); |
1902 | + if (v->str.len) |
1903 | + { |
1904 | + /* Format must be like ,Mnnn,Mnnn,Zxxx,Uxxx, |
1905 | + * Mnnn are ANSI standard error codes |
1906 | + * Zxxx are implementation-specific codes |
1907 | + * Uxxx are end-user defined codes |
1908 | + * Note that there must be commas at the start and at the end |
1909 | + */ |
1910 | + for (state = 2, i = 0; (i < v->str.len) && (state <= 2); i++) |
1911 | + { |
1912 | + switch(state) |
1913 | + { |
1914 | + case 2: state = (v->str.addr[i] == ',') ? 1 : 101; |
1915 | + break; |
1916 | + case 1: state = ((v->str.addr[i] == 'M') || |
1917 | + (v->str.addr[i] == 'U') || |
1918 | + (v->str.addr[i] == 'Z')) ? 0 : 101; |
1919 | + break; |
1920 | + case 0: state = (v->str.addr[i] == ',') ? 1 : 0; |
1921 | + break; |
1922 | + } |
1923 | + } |
1924 | + /* The above check would pass strings like "," |
1925 | + * so double-check that there are at least three characters |
1926 | + * (starting comma, ending comma, and something in between) |
1927 | + */ |
1928 | + if ((state != 1) || (v->str.len < 3)) |
1929 | + { |
1930 | + /* error, ecode = M101 */ |
1931 | + rts_error(VARLSTCNT(4) ERR_INVECODEVAL, 2, v->str.len, v->str.addr); |
1932 | + } |
1933 | + } |
1934 | + if (v->str.len > 0) |
1935 | + { |
1936 | + ecode_add(&v->str); |
1937 | + rts_error(VARLSTCNT(2) ERR_SETECODE, 0); |
1938 | + } else |
1939 | + { |
1940 | + NULLIFY_DOLLAR_ECODE; /* reset $ECODE related variables to correspond to $ECODE = NULL state */ |
1941 | + NULLIFY_ERROR_FRAME; /* we are no more in error-handling mode */ |
1942 | + } |
1943 | + break; |
1944 | + case SV_ETRAP: |
1945 | + MV_FORCE_STR(v); |
1946 | + dollar_etrap.mvtype = MV_STR; |
1947 | + dollar_etrap.str = v->str; |
1948 | + /* Setting either $ZTRAP or $ETRAP to empty causes any current error trapping to be canceled */ |
1949 | + if (!v->str.len) |
1950 | + { |
1951 | + dollar_ztrap.mvtype = MV_STR; |
1952 | + dollar_ztrap.str = v->str; |
1953 | + } else if (dollar_ztrap.str.len > 0) |
1954 | + { /* Ensure that $ETRAP and $ZTRAP are not both active at the same time */ |
1955 | + assert(FALSE == ztrap_explicit_null); |
1956 | + gtm_newintrinsic(&dollar_ztrap); |
1957 | + } |
1958 | + ztrap_explicit_null = FALSE; |
1959 | + break; |
1960 | + case SV_ZERROR: |
1961 | + MV_FORCE_STR(v); |
1962 | + dollar_zerror.mvtype = MV_STR; |
1963 | + dollar_zerror.str = v->str; |
1964 | + break; |
1965 | + case SV_ZYERROR: |
1966 | + MV_FORCE_STR(v); |
1967 | + dollar_zyerror.mvtype = MV_STR; |
1968 | + dollar_zyerror.str = v->str; |
1969 | + break; |
1970 | + case SV_SYSTEM: |
1971 | + ok = 1; |
1972 | + if (!(v->mvtype & MV_STR)) |
1973 | + ok = 0; |
1974 | + if (ok && v->str.addr[0] != '4') |
1975 | + ok = 0; |
1976 | + if (ok && v->str.addr[1] != '7') |
1977 | + ok = 0; |
1978 | + if ((' ' != v->str.addr[2]) && !ispunct(v->str.addr[2])) |
1979 | + ok = 0; |
1980 | + if (ok) |
1981 | + dollar_system.str = v->str; |
1982 | + else |
1983 | + rts_error(VARLSTCNT(4) ERR_SYSTEMVALUE, 2, v->str.len, v->str.addr); |
1984 | + break; |
1985 | + case SV_ZDIR: |
1986 | + setzdir(v, NULL); /* change directory to v */ |
1987 | + getzdir(); /* update dollar_zdir with current working directory */ |
1988 | + break; |
1989 | + case SV_ZINTERRUPT: |
1990 | + MV_FORCE_STR(v); |
1991 | + dollar_zinterrupt.mvtype = MV_STR; |
1992 | + dollar_zinterrupt.str = v->str; |
1993 | + break; |
1994 | + case SV_ZDATE_FORM: |
1995 | + MV_FORCE_NUM(v); |
1996 | + zdate_form = (short)MV_FORCE_INT(v); |
1997 | + break; |
1998 | + case SV_ZTEXIT: |
1999 | + MV_FORCE_STR(v); |
2000 | + dollar_ztexit.mvtype = MV_STR; |
2001 | + dollar_ztexit.str = v->str; |
2002 | + /* Coercing $ZTEXIT to boolean at SET command is more efficient than coercing before each |
2003 | + * rethrow at TR/TRO. Since we want to maintain dollar_ztexit as a string, coercion should |
2004 | + * not be performed on dollar_ztext, but on a temporary (i.e. parameter v) */ |
2005 | + dollar_ztexit_bool = MV_FORCE_BOOL(v); |
2006 | + break; |
2007 | + case SV_ZQUIT: |
2008 | + dollar_zquit_anyway = MV_FORCE_BOOL(v); |
2009 | + break; |
2010 | + default: |
2011 | + GTMASSERT; |
2012 | + } |
2013 | + return; |
2014 | +} |
2015 | |
2016 | === added directory 'src/gtm/sr_unix' |
2017 | === added file 'src/gtm/sr_unix/gtm_logicals.h' |
2018 | --- src/gtm/sr_unix/gtm_logicals.h 1970-01-01 00:00:00 +0000 |
2019 | +++ src/gtm/sr_unix/gtm_logicals.h 2009-02-13 06:21:27 +0000 |
2020 | @@ -0,0 +1,94 @@ |
2021 | +/**************************************************************** |
2022 | + * * |
2023 | + * Copyright 2001, 2008 Fidelity Information Services, Inc * |
2024 | + * * |
2025 | + * This source code contains the intellectual property * |
2026 | + * of its copyright holder(s), and is made available * |
2027 | + * under a license. If you do not know the terms of * |
2028 | + * the license, please stop and do not read further. * |
2029 | + * * |
2030 | + ****************************************************************/ |
2031 | + |
2032 | +/* gtm_logicals.h - Environment variables used by GT.M. */ |
2033 | + |
2034 | +/* -------------------------- Common to Unix and VMS -------------------------- */ |
2035 | + |
2036 | +#define GTM_DIST_LOG "$gtm_dist" |
2037 | + |
2038 | +/* Database */ |
2039 | +#define GTM_GBLDIR "$gtmgbldir" |
2040 | +#define GTM_ENV_XLATE "$gtm_env_translate" |
2041 | +#define GTM_GVDUPSETNOOP "$gtm_gvdupsetnoop" |
2042 | +#define GTM_GVUNDEF_FATAL "$gtm_gvundef_fatal" |
2043 | +#define GTM_GDSCERT "$gtm_gdscert" |
2044 | +#define GTM_BLKUPGRADE_FLAG "$gtm_blkupgrade_flag" |
2045 | +#define GTM_DBFILEXT_SYSLOG_DISABLE "$gtm_dbfilext_syslog_disable" |
2046 | +#define GTM_TP_ALLOCATION_CLUE "$gtm_tp_allocation_clue" |
2047 | +#define GTM_TPRESTART_LOG_DELTA "$gtm_tprestart_log_delta" |
2048 | +#define GTM_TPRESTART_LOG_LIMIT "$gtm_tprestart_log_first" |
2049 | +#define GTM_FULLBLOCKWRITES "$gtm_fullblockwrites" |
2050 | + |
2051 | +/* White-box testing */ |
2052 | +#define GTM_WHITE_BOX_TEST_CASE_ENABLE "$gtm_white_box_test_case_enable" |
2053 | +#define GTM_WHITE_BOX_TEST_CASE_NUMBER "$gtm_white_box_test_case_number" |
2054 | +#define GTM_WHITE_BOX_TEST_CASE_COUNT "$gtm_white_box_test_case_count" |
2055 | + |
2056 | +/* Indirection-cache */ |
2057 | +#define GTM_MAX_INDRCACHE_MEMORY "$gtm_max_indrcache_memory" |
2058 | +#define GTM_MAX_INDRCACHE_COUNT "$gtm_max_indrcache_count" |
2059 | + |
2060 | +/* MUPIP BACKUP */ |
2061 | +# define GTM_BAK_TEMPDIR_LOG_NAME "$GTM_BAKTMPDIR" |
2062 | + |
2063 | +/* Pattern match operator */ |
2064 | +#define PAT_FILE "$gtm_pattern_file" |
2065 | +#define PAT_TABLE "$gtm_pattern_table" |
2066 | + |
2067 | +/* Alternative Collation */ |
2068 | +#define CT_PREFIX "$gtm_collate_" |
2069 | +#define LCT_PREFIX "$gtm_local_collate" |
2070 | +#define LCT_STDNULL "$gtm_lct_stdnull" |
2071 | + |
2072 | +/* Miscellaneous */ |
2073 | +#define GTM_DEBUG_LEVEL_ENVLOG "$gtmdbglvl" |
2074 | +#define GTM_PRINCIPAL "$gtm_principal" |
2075 | +#define GTM_ZINTERRUPT "$gtm_zinterrupt" |
2076 | +#define SYSID "$gtm_sysid" |
2077 | +#define ZCOMPILE "$gtmcompile" |
2078 | +#define GTM_ZROUTINES "$gtmroutines" |
2079 | +#define ZYERROR "$gtm_zyerror" |
2080 | +#define ZTRAP_FORM "$gtm_ztrap_form" |
2081 | +#define ZTRAP_NEW "$gtm_ztrap_new" |
2082 | +#define ZDATE_FORM "$gtm_zdate_form" |
2083 | +#define DISABLE_ALIGN_STRINGS "$gtm_disable_alignstr" |
2084 | +#define GTM_MAX_SOCKETS "$gtm_max_sockets" |
2085 | +#define GTM_MEMORY_RESERVE "$gtm_memory_reserve" |
2086 | +#define GTM_ZQUIT_ANYWAY "$gtm_zquit_anyway" |
2087 | +#define GTM_NOUNDEF "$gtm_noundef" |
2088 | +#define GTM_PROMPT "$gtm_prompt" |
2089 | + |
2090 | +/* -------------------------- Unix only -------------------------- */ |
2091 | + |
2092 | +/* Database */ |
2093 | +#define GTM_TMP_ENV "$gtm_tmp" |
2094 | +#define GTM_SHMFLAGS "$gtm_shmatflags" |
2095 | + |
2096 | +/* Replication */ |
2097 | +#define GTM_REPL_INSTANCE "$gtm_repl_instance" |
2098 | +#define GTM_REPL_INSTNAME "$gtm_repl_instname" |
2099 | +#define GTM_REPL_INSTSECONDARY "$gtm_repl_instsecondary" |
2100 | +#define GTM_ZLIB_CMP_LEVEL "$gtm_zlib_cmp_level" |
2101 | +#define GTM_EVENT_LOG_LIB_ENV "$gtm_event_log_libpath" |
2102 | +#define GTM_EVENT_LOG_RTN_ENV "$gtm_event_log_rtn" |
2103 | + |
2104 | +/* Unicode */ |
2105 | +#define GTM_CHSET_ENV "$gtm_chset" |
2106 | +#define GTM_PATNUMERIC_ENV "$gtm_patnumeric" |
2107 | +#define GTM_BADCHAR_ENV "$gtm_badchar" |
2108 | +#define GTM_ICU_MINOR_ENV "$gtm_icu_minorver" |
2109 | + |
2110 | +/* Miscellaneous */ |
2111 | +#define GTM_LOG_ENV "$gtm_log" |
2112 | +#define GTM_PRINCIPAL_EDITING "$gtm_principal_editing" |
2113 | +#define GTM_QUIET_HALT "$gtm_quiet_halt" |
2114 | +#define GTM_NON_BLOCKED_WRITE_RETRIES "$gtm_non_blocked_write_retries" |
This branch includes Jeff's work on bug #327480. It also includes all the necessary infrastructure to build RPMs that include Jeff's patch, plus some work on the surrounding scripts.