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