void mupip_freeze(void) { int4 status; bool record; tp_region *rptr, *rptr1; boolean_t freeze, override; uint4 online; freeze_status freeze_ret; int dummy_errno; const char *msg1[] = { "unfreeze", "freeze" } ; const char *msg2[] = { "UNFROZEN", "FROZEN" } ; const char *msg3[] = { "unfrozen", "frozen" } ; status = SS_NORMAL; in_mupip_freeze = TRUE; UNIX_ONLY(jnlpool_init_needed = TRUE); mu_outofband_setup(); gvinit(); freeze = (CLI_PRESENT == cli_present("ON")); online = (CLI_PRESENT == cli_present("ONLINE")); if (online) online |= ((!cli_negated("AUTORELEASE")) ? CHILLED_AUTORELEASE_MASK : 0); if (CLI_PRESENT == cli_present("OFF")) { if (TRUE == freeze) { util_out_print("The /ON qualifier is invalid with the /OFF qualifier", TRUE); mupip_exit(ERR_MUPCLIERR); } } if (CLI_PRESENT == cli_present("RECORD")) { record = TRUE; if (FALSE == freeze) { util_out_print("The /RECORD qualifier is invalid with the /OFF qualifier", TRUE); mupip_exit(ERR_MUPCLIERR); } } else record = FALSE; if (CLI_PRESENT == cli_present("OVERRIDE")) { override = TRUE; if (freeze) { util_out_print("The /OVERRIDE qualifier is invalid with the /ON qualifier", TRUE); mupip_exit(ERR_MUPCLIERR); } } else
void mupip_restore(void) { static readonly char label[] = GDS_LABEL; char db_name[MAX_FN_LEN + 1], *inbuf, *p; inc_list_struct *ptr; inc_header *inhead; sgmnt_data *old_data; short iosb[4]; unsigned short n_len; int4 status, vbn, rsize, temp, save_errno; uint4 rest_blks, totblks; trans_num curr_tn; uint4 ii; block_id blk_num; bool extend; uint4 cli_status; BFILE *in; int i, db_fd; uint4 old_blk_size, old_tot_blks, bplmap; short old_start_vbn; off_t new_eof; char buff[DISK_BLOCK_SIZE]; char msg_buffer[1024], *newmap, *newmap_bptr; mstr msg_string; char addr[SA_MAXLEN+1]; unsigned char tcp[5]; backup_type type; unsigned short port; int4 timeout, cut, match; char debug_info[256]; void (*common_read)(); char *errptr; pid_t waitpid_res; error_def(ERR_MUPRESTERR); error_def(ERR_MUPCLIERR); error_def(ERR_IOEOF); extend = TRUE; if (CLI_NEGATED == (cli_status = cli_present("EXTEND"))) extend = FALSE; mu_outofband_setup(); mu_gv_cur_reg_init(); n_len = sizeof(db_name); if (cli_get_str("DATABASE", db_name, &n_len) == FALSE) mupip_exit(ERR_MUPCLIERR); strcpy((char *)gv_cur_region->dyn.addr->fname, db_name); gv_cur_region->dyn.addr->fname_len = n_len; if (!mu_rndwn_file(gv_cur_region, TRUE)) { util_out_print("Error securing stand alone access to output file !AD. Aborting restore.", TRUE, n_len, db_name); mupip_exit(ERR_MUPRESTERR); } OPENFILE(db_name, O_RDWR, db_fd); if (-1 == db_fd) { save_errno = errno; util_out_print("Error accessing output file !AD. Aborting restore.", TRUE, n_len, db_name); errptr = (char *)STRERROR(save_errno); util_out_print("open : !AZ", TRUE, errptr); mupip_exit(save_errno); } murgetlst(); inbuf = (char*)malloc(INC_BACKUP_CHUNK_SIZE); old_data = (sgmnt_data*)malloc(sizeof(sgmnt_data)); LSEEKREAD(db_fd, 0, old_data, sizeof(sgmnt_data), save_errno); if (0 != save_errno) { util_out_print("Error accessing output file !AD. Aborting restore.", TRUE, n_len, db_name); if (-1 != save_errno) { errptr = (char *)STRERROR(save_errno); util_out_print("read : !AZ", TRUE, errptr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(save_errno); } else { db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_IOEOF); } } if (memcmp(&old_data->label[0], &label[0], GDS_LABEL_SZ)) { util_out_print("Output file !AD has an unrecognizable format", TRUE, n_len, db_name); free(old_data); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } curr_tn = old_data->trans_hist.curr_tn; old_blk_size = old_data->blk_size; old_tot_blks = old_data->trans_hist.total_blks; old_start_vbn = old_data->start_vbn; bplmap = old_data->bplmap; free(old_data); msg_string.addr = msg_buffer; msg_string.len = sizeof(msg_buffer); inhead = (inc_header *)malloc(sizeof(inc_header) + 8); inhead = (inc_header *)((((int4)inhead) + 7) & -8); rest_blks = 0; for (ptr = in_files.next; ptr; ptr = ptr->next) { /* --- determine source type --- */ type = backup_to_file; if (0 == ptr->input_file.len) continue; else if ('|' == *(ptr->input_file.addr + ptr->input_file.len - 1)) { type = backup_to_exec; ptr->input_file.len--; *(ptr->input_file.addr + ptr->input_file.len) = '\0'; } else if (ptr->input_file.len > 5) { lower_to_upper(tcp, (uchar_ptr_t)ptr->input_file.addr, 5); if (0 == memcmp(tcp, "TCP:/", 5)) { type = backup_to_tcp; cut = 5; while ('/' == *(ptr->input_file.addr + cut)) cut++; ptr->input_file.len -= cut; p = ptr->input_file.addr; while (p < ptr->input_file.addr + ptr->input_file.len) { *p = *(p + cut); p++; } *p = '\0'; } } /* --- open the input stream --- */ restore_read_errno = 0; switch(type) { case backup_to_file: common_read = iob_read; if ((in = iob_open_rd(ptr->input_file.addr, DISK_BLOCK_SIZE, BLOCKING_FACTOR)) == NULL) { save_errno = errno; util_out_print("Error accessing input file !AD. Aborting restore.", TRUE, ptr->input_file.len, ptr->input_file.addr); errptr = (char *)STRERROR(save_errno); util_out_print("open : !AZ", TRUE, errptr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(save_errno); } ESTABLISH(iob_io_error); break; case backup_to_exec: pipe_child = 0; common_read = exec_read; in = (BFILE *)malloc(sizeof(BFILE)); if (0 > (in->fd = gtm_pipe(ptr->input_file.addr, input_from_comm))) { util_out_print("Error creating input pipe from !AD.", TRUE, ptr->input_file.len, ptr->input_file.addr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } #ifdef DEBUG_ONLINE PRINTF("file descriptor for the openned pipe is %d.\n", in->fd); PRINTF("the command passed to gtm_pipe is %s.\n", ptr->input_file.addr); #endif break; case backup_to_tcp: common_read = tcp_read; /* parse the input */ switch (match = SSCANF(ptr->input_file.addr, "%[^:]:%hu", addr, &port)) { case 1 : port = DEFAULT_BKRS_PORT; case 2 : break; default : util_out_print("Error : A hostname has to be specified.", TRUE); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } if ((0 == cli_get_int("NETTIMEOUT", &timeout)) || (0 > timeout)) timeout = DEFAULT_BKRS_TIMEOUT; in = (BFILE *)malloc(sizeof(BFILE)); iotcp_fillroutine(); if (0 > (in->fd = tcp_open(addr, port, timeout, TRUE))) { util_out_print("Error establishing TCP connection to !AD.", TRUE, ptr->input_file.len, ptr->input_file.addr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } break; default: util_out_print("Aborting restore!/", TRUE); util_out_print("Unrecognized input format !AD", TRUE, ptr->input_file.len, ptr->input_file.addr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } COMMON_READ(in, inhead, sizeof(inc_header)); if (memcmp(&inhead->label[0], INC_HEADER_LABEL, INC_HDR_LABEL_SZ)) { util_out_print("Input file !AD has an unrecognizable format", TRUE, ptr->input_file.len, ptr->input_file.addr); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } if (curr_tn != inhead->start_tn) { util_out_print("Transaction in input file !AD does not align with database TN.!/DB: !XL!_Input file: !XL", TRUE, ptr->input_file.len, ptr->input_file.addr, curr_tn, inhead->start_tn); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } if (old_blk_size != inhead->blk_size) { util_out_print("Incompatable block size. Output file !AD has block size !XL,", TRUE, n_len, db_name); util_out_print("while input file !AD is from a database with block size !XL,", TRUE, ptr->input_file.len, ptr->input_file.addr, inhead->blk_size); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } if (old_tot_blks != inhead->db_total_blks) { if (old_tot_blks > inhead->db_total_blks || !extend) { totblks = old_tot_blks - DIVIDE_ROUND_UP(old_tot_blks, DISK_BLOCK_SIZE); util_out_print("Incompatable database sizes. Output file !AD has!/ !UL (!XL hex) total blocks,", TRUE, n_len, db_name, totblks, totblks); totblks = inhead->db_total_blks - DIVIDE_ROUND_UP(inhead->db_total_blks, DISK_BLOCK_SIZE); util_out_print("while input file !AD is from a database with!/ !UL (!XL hex) total blocks", TRUE, ptr->input_file.len, ptr->input_file.addr, totblks, totblks); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } else { /* this part of the code is similar to gdsfilext except that you don't need to do * most of the work that gdsfilext does. However, for situations where the database * extended since the last backup (the beginning of this incremental backup), and * there are new bitmaps that are never touched later on by GT.M, these bitmaps * will have tn == 0, which prevents the backup process to pick up these blocks, * so, we need to initialize these bitmaps here */ new_eof = ((off_t)(old_start_vbn - 1) * DISK_BLOCK_SIZE) + ((off_t)inhead->db_total_blks * old_blk_size); memset(buff, 0, DISK_BLOCK_SIZE); LSEEKWRITE(db_fd, new_eof, buff, DISK_BLOCK_SIZE, status); if (0 != status) { util_out_print("Aborting restore!/", TRUE); util_out_print("lseek or write error : Unable to extend output file !AD!/", TRUE, n_len, db_name); util_out_print(" from !UL (!XL hex) total blocks to !UL (!XL hex) total blocks.!/", TRUE, old_tot_blks, old_tot_blks, inhead->db_total_blks, inhead->db_total_blks); util_out_print(" Current input file is !AD with !UL (!XL hex) total blocks!/", TRUE, ptr->input_file.len, ptr->input_file.addr, inhead->db_total_blks, inhead->db_total_blks); gtm_putmsg(VARLSTCNT(1) status); free(inbuf); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } /* --- initialize all new bitmaps, just in case they are not touched later --- */ if (DIVIDE_ROUND_DOWN(inhead->db_total_blks, bplmap) > DIVIDE_ROUND_DOWN(old_tot_blks, bplmap)) { /* -- similar logic exist in bml_newmap.c, which need to pick up any new updates here -- */ newmap = (char *)malloc(old_blk_size); ((blk_hdr *)newmap)->bsiz = BM_SIZE(bplmap); ((blk_hdr *)newmap)->levl = LCL_MAP_LEVL; ((blk_hdr *)newmap)->tn = curr_tn; newmap_bptr = newmap + sizeof(blk_hdr); *newmap_bptr++ = THREE_BLKS_FREE; memset(newmap_bptr, FOUR_BLKS_FREE, BM_SIZE(bplmap) - sizeof(blk_hdr) - 1); for (ii = ROUND_UP(old_tot_blks, bplmap); ii <= inhead->db_total_blks; ii += bplmap) { new_eof = (off_t)(old_start_vbn - 1) * DISK_BLOCK_SIZE + (off_t)ii * old_blk_size; LSEEKWRITE(db_fd, new_eof, newmap, old_blk_size, status); if (0 != status) { util_out_print("Aborting restore!/", TRUE); util_out_print("Bitmap 0x!XL initialization error!", TRUE, ii); gtm_putmsg(VARLSTCNT(1) status); free(inbuf); free(newmap); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } } free(newmap); } old_tot_blks = inhead->db_total_blks; } } COMMON_READ(in, &rsize, sizeof(int4)); for ( ; ;) { /* rsize is the size of the record, including the size, but, since the size has already been read in, this will read in the current record and the size for the next record */ /* ensure we have a reasonable record size, at least */ if (rsize - sizeof(int4) - sizeof(block_id) > old_blk_size) { util_out_print("Invalid information in restore file !AD. Aborting restore.", TRUE, ptr->input_file.len, ptr->input_file.addr); iob_close(in); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(ERR_MUPRESTERR); } COMMON_READ(in, inbuf, rsize); if (!memcmp(inbuf, &end_msg[0], sizeof end_msg - 1)) break; rest_blks++; blk_num = *(block_id*)inbuf; vbn = old_start_vbn - 1 + (old_blk_size / DISK_BLOCK_SIZE * blk_num); LSEEKWRITE(db_fd, (off_t)vbn * DISK_BLOCK_SIZE, inbuf + sizeof(block_id), rsize - sizeof(block_id) - sizeof(int4), save_errno); if (0 != save_errno) { util_out_print("Error accessing output file !AD. Aborting restore.", TRUE, n_len, db_name); errptr = (char *)STRERROR(save_errno); util_out_print("write : !AZ", TRUE, errptr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(save_errno); } GET_LONG(temp, (inbuf + rsize - sizeof(int4))); rsize = temp; } GET_LONG(temp, (inbuf + rsize - sizeof(int4))); rsize = temp; vbn = 0; for (i = 0; ; i++) /* Restore file header */ { COMMON_READ(in, inbuf, rsize); if (!memcmp(inbuf, &hdr_msg[0], sizeof hdr_msg - 1)) break; LSEEKWRITE(db_fd, vbn, inbuf, rsize - sizeof(int4), save_errno); if (0 != save_errno) { util_out_print("Error accessing output file !AD. Aborting restore.", TRUE, n_len, db_name); errptr = (char *)STRERROR(save_errno); util_out_print("write : !AZ", TRUE, errptr); db_ipcs_reset(gv_cur_region, TRUE); mu_gv_cur_reg_free(); mupip_exit(save_errno); } vbn += rsize - sizeof(int4); GET_LONG(temp, (inbuf + rsize - sizeof(int4))); rsize = temp; } curr_tn = inhead->end_tn; switch (type) { case backup_to_file: REVERT; iob_close(in); break; case backup_to_exec: close(in->fd); if ((pipe_child > 0) && (FALSE != is_proc_alive(pipe_child, 0))) WAITPID(pipe_child, (int *)&status, 0, waitpid_res); break; case backup_to_tcp: break; } } util_out_print("!/RESTORE COMPLETED", TRUE); util_out_print("!UL blocks restored", TRUE, rest_blks); free(inbuf); db_ipcs_reset(gv_cur_region, FALSE); mu_gv_cur_reg_free(); mupip_exit(SS_NORMAL); }
void mupip_cvtgbl(void) { unsigned short fn_len, len; char fn[256]; unsigned char buff[7]; uint4 begin, end; int i, format; uint4 cli_status; gtm_int64_t begin_i8, end_i8; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; /* If an online rollback occurs when we are loading up the database with new globals and takes us back to a prior logical * state, then we should not continue with the load. The reason being that the application might rely on certain globals to * be present before loading others and that property could be voilated if online rollback takes the database back to a * completely different logical state. Set the variable issue_DBROLLEDBACK_anyways that forces the restart logic to issue * an rts_error the first time it detects an online rollback (that takes the database to a prior logical state). */ TREF(issue_DBROLLEDBACK_anyways) = TRUE; is_replicator = TRUE; skip_dbtriggers = TRUE; fn_len = SIZEOF(fn); if (cli_present("STDIN")) { /* User wants to load from standard input */ assert(SIZEOF(fn) > sys_input.len); memcpy(fn, sys_input.addr, sys_input.len); fn_len = sys_input.len; assert(-1 != fcntl(fileno(stdin), F_GETFD)); /* Check if both file name and -STDIN specified. */ if (cli_get_str("FILE", fn, &fn_len)) mupip_exit(ERR_MUPCLIERR); } else if (!cli_get_str("FILE", fn, &fn_len)) /* User wants to read from a file. */ mupip_exit(ERR_MUPCLIERR); /* Neither -STDIN nor file name specified. */ if (mupip_error_occurred) exit(-1); file_input_init(fn, fn_len); mu_outofband_setup(); if ((cli_status = cli_present("BEGIN")) == CLI_PRESENT) { if (!cli_get_int64("BEGIN", &begin_i8)) mupip_exit(ERR_MUPCLIERR); if (1 > begin_i8) mupip_exit(ERR_LOADBGSZ); else if (MAXUINT4 < begin_i8) mupip_exit(ERR_LOADBGSZ2); begin = (uint4) begin_i8; } else { begin = 1; begin_i8 = 1; } if ((cli_status = cli_present("END")) == CLI_PRESENT) { if (!cli_get_int64("END", &end_i8)) mupip_exit(ERR_MUPCLIERR); if (1 > end_i8) mupip_exit(ERR_LOADEDSZ); else if (MAXUINT4 < end_i8) mupip_exit(ERR_LOADEDSZ2); if (end_i8 < begin_i8) mupip_exit(ERR_LOADEDBG); end = (uint4) end_i8; } else end = MAXUINT4; if ((cli_status = cli_present("FILL_FACTOR")) == CLI_PRESENT) { assert(SIZEOF(gv_fillfactor) == SIZEOF(int4)); if (!cli_get_int("FILL_FACTOR", (int4 *)&gv_fillfactor)) gv_fillfactor = MAX_FILLFACTOR; if (gv_fillfactor < MIN_FILLFACTOR) gv_fillfactor = MIN_FILLFACTOR; else if (gv_fillfactor > MAX_FILLFACTOR) gv_fillfactor = MAX_FILLFACTOR; } else gv_fillfactor = MAX_FILLFACTOR; if (cli_present("FORMAT") == CLI_PRESENT) { len = SIZEOF("FORMAT"); if (!cli_get_str("FORMAT", (char *)buff, &len)) go_load(begin, end); else { lower_to_upper(buff, buff, len); if (!memcmp(buff, "ZWR", len)) go_load(begin, end); else if (!memcmp(buff, "BINARY", len)) bin_load(begin, end); else if (!memcmp(buff, "GO", len)) go_load(begin, end); else if (!memcmp(buff, "GOQ", len)) goq_load(); else { util_out_print("Illegal format for load",TRUE); mupip_exit(ERR_MUPCLIERR); } } } else go_load(begin, end); if (mupip_error_occurred) { util_out_print("Error occurred during loading",TRUE); exit(-1); } else mupip_exit(SS_NORMAL); }
/* * This function reads command line parameters and forms a configuration for mupip size invocation. * It later executes mupip size on each global based on the configuration * * MUPIP SIZE interface is described in GTM-7292 */ void mupip_size(void) { boolean_t restrict_reg = FALSE; char buff[MAX_LINE], cli_buff[MAX_LINE]; char *p_end; /* used for strtol validation */ glist exclude_gl_head, gl_head, *gl_ptr; int4 reg_max_rec, reg_max_key, reg_max_blk; mupip_size_cfg_t mupip_size_cfg = { impsample, 1000, 1, 0 }; /* configuration default values */ uint4 status = EXIT_NRM; unsigned short BUFF_LEN = SIZEOF(buff), n_len; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; mu_outofband_setup(); error_mupip = FALSE; memset(mu_int_adj, 0, ARRAYSIZE(mu_int_adj)); memset(mu_int_adj_prev, 0, ARRAYSIZE(mu_int_adj_prev)); /* Region qualifier */ grlist = NULL; if (CLI_PRESENT == cli_present("REGION")) { restrict_reg = TRUE; gvinit(); /* init gd_header (needed to call mu_getlst) */ mu_getlst("REGION", SIZEOF(tp_region)); } mupip_size_check_error(); /* SELECT qualifier */ memset(cli_buff, 0, SIZEOF(cli_buff)); n_len = SIZEOF(cli_buff); if (CLI_PRESENT != cli_present("SELECT")) { n_len = 1; cli_buff[0] = '*'; } else if (FALSE == cli_get_str("SELECT", cli_buff, &n_len)) { n_len = 1; cli_buff[0] = '*'; } /* gv_select will select globals for this clause*/ gv_select(cli_buff, n_len, FALSE, "SELECT", &gl_head, ®_max_rec, ®_max_key, ®_max_blk, restrict_reg); if (!gl_head.next) { error_mupip = TRUE; gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_NOSELECT); } mupip_size_check_error(); if (CLI_PRESENT == cli_present("ADJACENCY")) { assert(SIZEOF(muint_adj) == SIZEOF(int4)); if (0 == cli_get_int("ADJACENCY", (int4 *)&muint_adj)) { error_mupip = TRUE; gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_MUPCLIERR); } } else muint_adj = DEFAULT_ADJACENCY; /* HEURISTIC qualifier */ if (cli_present("HEURISTIC.SCAN") == CLI_PRESENT) { mupip_size_cfg.heuristic = scan; if (cli_present("HEURISTIC.LEVEL")) { boolean_t valid = TRUE; if (cli_get_str("HEURISTIC.LEVEL", buff, &BUFF_LEN)) { mupip_size_cfg.level = strtol(buff, &p_end, 10); valid = (*p_end == '\0'); } else valid = FALSE; if (!valid || mupip_size_cfg.level <= -MAX_BT_DEPTH || MAX_BT_DEPTH <= mupip_size_cfg.level) { error_mupip = TRUE; gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_MUSIZEINVARG, 2, LEN_AND_LIT("HEURISTIC.LEVEL")); } } /* else level is already initialized with default value */ } else if (cli_present("HEURISTIC.ARSAMPLE") == CLI_PRESENT || cli_present("HEURISTIC.IMPSAMPLE") == CLI_PRESENT) { if (cli_present("HEURISTIC.ARSAMPLE") == CLI_PRESENT) mupip_size_cfg.heuristic = arsample; else if (cli_present("HEURISTIC.IMPSAMPLE") == CLI_PRESENT) mupip_size_cfg.heuristic = impsample; if (cli_present("HEURISTIC.SAMPLES")) { boolean_t valid = cli_get_int("HEURISTIC.SAMPLES", &(mupip_size_cfg.samples)); if (!valid || mupip_size_cfg.samples <= 0){ error_mupip = TRUE; gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_MUSIZEINVARG, 2, LEN_AND_LIT("HEURISTIC.SAMPLES")); } } /* else samples is already initialized with default value */ /* undocumented SEED parameter used for testing sampling method */ if (cli_present("HEURISTIC.SEED")) { boolean_t valid = cli_get_int("HEURISTIC.SEED", &(mupip_size_cfg.seed)); if (!valid){ error_mupip = TRUE; gtm_putmsg_csa(CSA_ARG(NULL) VARLSTCNT(4) ERR_MUSIZEINVARG, 2, LEN_AND_LIT("HEURISTIC.SEED")); } } /* else seed will be based on the time */ } mupip_size_check_error(); /* run mupip size on each global */ for (gl_ptr = gl_head.next; gl_ptr; gl_ptr = gl_ptr->next) { util_out_print("!/Global: !AD (region !AD)", FLUSH, GNAME(gl_ptr).len, GNAME(gl_ptr).addr, REG_LEN_STR(gl_ptr->reg)); switch (mupip_size_cfg.heuristic) { case scan: status |= mu_size_scan(gl_ptr, mupip_size_cfg.level); break; case arsample: status |= mu_size_arsample(gl_ptr, mupip_size_cfg.samples, mupip_size_cfg.seed); break; case impsample: status |= mu_size_impsample(gl_ptr, mupip_size_cfg.samples, mupip_size_cfg.seed); break; default: assertpro(FALSE && mupip_size_cfg.heuristic); break; } if (mu_ctrlc_occurred || mu_ctrly_occurred) mupip_exit(ERR_MUNOFINISH); } mupip_exit(status == EXIT_NRM ? SS_NORMAL : ERR_MUNOFINISH); }
void mu_extract(void) { int stat_res, truncate_res; int reg_max_rec, reg_max_key, reg_max_blk, reg_std_null_coll; int iter, format, local_errno, int_nlen; boolean_t freeze = FALSE, logqualifier, success; char format_buffer[FORMAT_STR_MAX_SIZE], ch_set_name[MAX_CHSET_NAME], cli_buff[MAX_LINE], label_buff[LABEL_STR_MAX_SIZE], gbl_name_buff[MAX_MIDENT_LEN + 2]; /* 2 for null and '^' */ glist gl_head, *gl_ptr; gd_region *reg, *region_top; mu_extr_stats global_total, grand_total; uint4 item_code, devbufsiz, maxfield; unsigned short label_len, n_len, ch_set_len, buflen; unsigned char *outbuf, *outptr, *chptr, *leadptr; struct stat statbuf; mval val, curr_gbl_name, op_val, op_pars; mstr chset_mstr; gtm_chset_t saved_out_set; static unsigned char ochset_set = FALSE; static readonly unsigned char open_params_list[] = { (unsigned char)iop_noreadonly, (unsigned char)iop_nowrap, (unsigned char)iop_stream, (unsigned char)iop_eol }; static readonly unsigned char no_param = (unsigned char)iop_eol; coll_hdr extr_collhdr; error_def(ERR_NOSELECT); error_def(ERR_GTMASSERT); error_def(ERR_EXTRACTCTRLY); error_def(ERR_EXTRACTFILERR); error_def(ERR_MUPCLIERR); error_def(ERR_MUNOACTION); error_def(ERR_MUNOFINISH); error_def(ERR_RECORDSTAT); error_def(ERR_NULLCOLLDIFF); /* Initialize all local character arrays to zero before using */ memset(cli_buff, 0, sizeof(cli_buff)); memset(outfilename, 0, sizeof(outfilename)); memset(label_buff, 0, sizeof(label_buff)); memset(format_buffer, 0, sizeof(format_buffer)); active_device = io_curr_device.out; mu_outofband_setup(); if (CLI_PRESENT == cli_present("OCHSET")) { ch_set_len = sizeof(ch_set_name); if (cli_get_str("OCHSET", ch_set_name, &ch_set_len)) { if (0 == ch_set_len) mupip_exit(ERR_MUNOACTION); /* need to change to OPCHSET error when added */ ch_set_name[ch_set_len] = '\0'; #ifdef KEEP_zOS_EBCDIC if ( (iconv_t)0 != active_device->output_conv_cd) ICONV_CLOSE_CD(active_device->output_conv_cd); if (DEFAULT_CODE_SET != active_device->out_code_set) ICONV_OPEN_CD(active_device->output_conv_cd, INSIDE_CH_SET, ch_set_name); #else chset_mstr.addr = ch_set_name; chset_mstr.len = ch_set_len; SET_ENCODING(active_device->ochset, &chset_mstr); get_chset_desc(&chset_names[active_device->ochset]); #endif ochset_set = TRUE; } } logqualifier = (CLI_NEGATED != cli_present("LOG")); if (CLI_PRESENT == cli_present("FREEZE")) freeze = TRUE; n_len = sizeof(format_buffer); if (FALSE == cli_get_str("FORMAT", format_buffer, &n_len)) { n_len = sizeof("ZWR") - 1; memcpy(format_buffer, "ZWR", n_len); } int_nlen = n_len; lower_to_upper((uchar_ptr_t)format_buffer, (uchar_ptr_t)format_buffer, int_nlen); if (0 == memcmp(format_buffer, "ZWR", n_len)) format = MU_FMT_ZWR; else if (0 == memcmp(format_buffer, "GO", n_len)) { if (gtm_utf8_mode) { util_out_print("Extract error: GO format is not supported in UTF-8 mode. Use ZWR format.", TRUE); mupip_exit(ERR_MUPCLIERR); } format = MU_FMT_GO; } else if (0 == memcmp(format_buffer, "BINARY", n_len)) format = MU_FMT_BINARY; else { util_out_print("Extract error: bad format type", TRUE); mupip_exit(ERR_MUPCLIERR); } n_len = sizeof(cli_buff); if (FALSE == cli_get_str((char *)select_text, cli_buff, &n_len)) { n_len = 1; cli_buff[0] = '*'; } /* gv_select will select globals */ gv_select(cli_buff, n_len, freeze, (char *)select_text, &gl_head, ®_max_rec, ®_max_key, ®_max_blk); if (!gl_head.next) { rts_error(VARLSTCNT(1) ERR_NOSELECT); mupip_exit(ERR_NOSELECT); } /* For binary format, check whether all regions have same null collation order */ if (MU_FMT_BINARY == format) { for (reg = gd_header->regions, region_top = gd_header->regions + gd_header->n_regions, reg_std_null_coll = -1; reg < region_top ; reg++) { if (reg->open) { if (reg_std_null_coll != reg->std_null_coll) { if (reg_std_null_coll == -1) reg_std_null_coll = reg->std_null_coll; else { rts_error(VARLSTCNT(1) ERR_NULLCOLLDIFF); mupip_exit(ERR_NULLCOLLDIFF); } } } } assert(-1 != reg_std_null_coll); } grand_total.recknt = grand_total.reclen = grand_total.keylen = grand_total.datalen = 0; global_total.recknt = global_total.reclen = global_total.keylen = global_total.datalen = 0; n_len = sizeof(outfilename); if (FALSE == cli_get_str("FILE", outfilename, &n_len)) { rts_error(VARLSTCNT(1) ERR_MUPCLIERR); mupip_exit(ERR_MUPCLIERR); } if (-1 == Stat((char *)outfilename, &statbuf)) { if (ENOENT != errno) { local_errno = errno; perror("Error opening output file"); mupip_exit(local_errno); } } else { util_out_print("Error opening output file: !AD -- File exists", TRUE, n_len, outfilename); mupip_exit(ERR_MUNOACTION); } op_pars.mvtype = MV_STR; op_pars.str.len = sizeof(open_params_list); op_pars.str.addr = (char *)open_params_list; op_val.mvtype = MV_STR; op_val.str.len = filename_len = n_len; op_val.str.addr = (char *)outfilename; (*op_open_ptr)(&op_val, &op_pars, 0, 0); ESTABLISH(mu_extract_handler); op_use(&op_val, &op_pars); if (MU_FMT_BINARY == format) { /* binary header label format: * fixed length text, fixed length date & time, * fixed length max blk size, fixed length max rec size, fixed length max key size, fixed length std_null_coll * 32-byte padded user-supplied string */ outbuf = (unsigned char *)malloc(sizeof(BIN_HEADER_LABEL) + sizeof(BIN_HEADER_DATEFMT) - 1 + 4 * BIN_HEADER_NUMSZ + BIN_HEADER_LABELSZ); outptr = outbuf; MEMCPY_LIT(outptr, BIN_HEADER_LABEL); outptr += STR_LIT_LEN(BIN_HEADER_LABEL); stringpool.free = stringpool.base; op_horolog(&val); stringpool.free = stringpool.base; op_fnzdate(&val, (mval *)&mu_bin_datefmt, &null_str, &null_str, &val); memcpy(outptr, val.str.addr, val.str.len); outptr += val.str.len; WRITE_NUMERIC(reg_max_blk); WRITE_NUMERIC(reg_max_rec); WRITE_NUMERIC(reg_max_key); WRITE_NUMERIC(reg_std_null_coll); if (gtm_utf8_mode) { MEMCPY_LIT(outptr, UTF8_NAME); label_len = STR_LIT_LEN(UTF8_NAME); outptr[label_len++] = ' '; } else label_len = 0; buflen = sizeof(label_buff); if (FALSE == cli_get_str("LABEL", label_buff, &buflen)) { MEMCPY_LIT(&outptr[label_len], EXTR_DEFAULT_LABEL); buflen = STR_LIT_LEN(EXTR_DEFAULT_LABEL); } else memcpy(&outptr[label_len], label_buff, buflen); label_len += buflen; if (label_len > BIN_HEADER_LABELSZ) { /* Label size exceeds the space, so truncate the label and back off to the valid beginning (i.e. to the leading byte) of the last character that can entirely fit in the space */ label_len = BIN_HEADER_LABELSZ; chptr = &outptr[BIN_HEADER_LABELSZ]; UTF8_LEADING_BYTE(chptr, outptr, leadptr); assert(chptr - leadptr < 4); if (leadptr < chptr) label_len -= (chptr - leadptr); } outptr += label_len; for (iter = label_len; iter < BIN_HEADER_LABELSZ; iter++) *outptr++ = ' '; label_len = outptr - outbuf; if (!ochset_set) { #ifdef KEEP_zOS_EBCDIC /* extract ascii header for binary by default */ /* Do we need to restore it somewhere? */ saved_out_set = (io_curr_device.out)->out_code_set; (io_curr_device.out)->out_code_set = DEFAULT_CODE_SET; #else saved_out_set = (io_curr_device.out)->ochset; (io_curr_device.out)->ochset = CHSET_M; #endif } op_val.str.addr = (char *)(&label_len); op_val.str.len = sizeof(label_len); op_write(&op_val); op_val.str.addr = (char *)outbuf; op_val.str.len = label_len; op_write(&op_val); } else { assert((MU_FMT_GO == format) || (MU_FMT_ZWR == format)); label_len = sizeof(label_buff); if (FALSE == cli_get_str("LABEL", label_buff, &label_len)) { MEMCPY_LIT(label_buff, EXTR_DEFAULT_LABEL); label_len = STR_LIT_LEN(EXTR_DEFAULT_LABEL); } if (gtm_utf8_mode) { label_buff[label_len++] = ' '; MEMCPY_LIT(&label_buff[label_len], UTF8_NAME); label_len += STR_LIT_LEN(UTF8_NAME); } label_buff[label_len++] = '\n'; op_val.mvtype = MV_STR; op_val.str.len = label_len; op_val.str.addr = label_buff; op_write(&op_val); stringpool.free = stringpool.base; op_horolog(&val); stringpool.free = stringpool.base; op_fnzdate(&val, &datefmt, &null_str, &null_str, &val); op_val = val; op_val.mvtype = MV_STR; op_write(&op_val); if (MU_FMT_ZWR == format) { op_val.str.addr = " ZWR"; op_val.str.len = sizeof(" ZWR") - 1; op_write(&op_val); } op_wteol(1); } REVERT; ESTABLISH(mu_extract_handler1); success = TRUE; for (gl_ptr = gl_head.next; gl_ptr; gl_ptr = gl_ptr->next) { if (mu_ctrly_occurred) break; if (mu_ctrlc_occurred) { gbl_name_buff[0]='^'; memcpy(&gbl_name_buff[1], gl_ptr->name.str.addr, gl_ptr->name.str.len); gtm_putmsg(VARLSTCNT(8) ERR_RECORDSTAT, 6, gl_ptr->name.str.len + 1, gbl_name_buff, global_total.recknt, global_total.keylen, global_total.datalen, global_total.reclen); mu_ctrlc_occurred = FALSE; } gv_bind_name(gd_header, &gl_ptr->name.str); if (MU_FMT_BINARY == format) { label_len = sizeof(extr_collhdr); op_val.mvtype = MV_STR; op_val.str.addr = (char *)(&label_len); op_val.str.len = sizeof(label_len); op_write(&op_val); extr_collhdr.act = gv_target->act; extr_collhdr.nct = gv_target->nct; extr_collhdr.ver = gv_target->ver; op_val.str.addr = (char *)(&extr_collhdr); op_val.str.len = sizeof(extr_collhdr); op_write(&op_val); } /* Note: Do not change the order of the expression below. * Otherwise if success is FALSE, mu_extr_gblout() will not be called at all. * We want mu_extr_gblout() to be called irrespective of the value of success */ success = mu_extr_gblout(&gl_ptr->name, &global_total, format) && success; if (logqualifier) { gbl_name_buff[0]='^'; memcpy(&gbl_name_buff[1], gl_ptr->name.str.addr, gl_ptr->name.str.len); gtm_putmsg(VARLSTCNT(8) ERR_RECORDSTAT, 6, gl_ptr->name.str.len + 1, gbl_name_buff, global_total.recknt, global_total.keylen, global_total.datalen, global_total.reclen); mu_ctrlc_occurred = FALSE; } grand_total.recknt += global_total.recknt; if (grand_total.reclen < global_total.reclen) grand_total.reclen = global_total.reclen; if (grand_total.keylen < global_total.keylen) grand_total.keylen = global_total.keylen; if (grand_total.datalen < global_total.datalen) grand_total.datalen = global_total.datalen; } op_val.mvtype = op_pars.mvtype = MV_STR; op_val.str.addr = (char *)outfilename;; op_val.str.len = filename_len; op_pars.str.len = sizeof(no_param); op_pars.str.addr = (char *)&no_param; op_close(&op_val, &op_pars); REVERT; if (mu_ctrly_occurred) { gtm_putmsg(VARLSTCNT(1) ERR_EXTRACTCTRLY); mupip_exit(ERR_MUNOFINISH); } gtm_putmsg(VARLSTCNT(8) ERR_RECORDSTAT, 6, LEN_AND_LIT(gt_lit), grand_total.recknt, grand_total.keylen, grand_total.datalen, grand_total.reclen); if (MU_FMT_BINARY == format) { /* truncate the last newline charactor flushed by op_close */ STAT_FILE((char *)outfilename, &statbuf, stat_res); if (-1 == stat_res) rts_error(VARLSTCNT(1) errno); TRUNCATE_FILE((const char *)outfilename, statbuf.st_size - 1, truncate_res); if (-1 == truncate_res) rts_error(VARLSTCNT(1) errno); } mupip_exit(success ? SS_NORMAL : ERR_MUNOFINISH); }
void mupip_cvtgbl(void) { char fn[MAX_FN_LEN + 1], *line1_ptr, *line3_ptr; gtm_int64_t begin_i8, end_i8; int dos, i, file_format, line1_len, line3_len, utf8; uint4 begin, cli_status, end, max_rec_size; unsigned char buff[MAX_ONERROR_VALUE_LEN]; unsigned short fn_len, len; DCL_THREADGBL_ACCESS; SETUP_THREADGBL_ACCESS; assert(MAX_ONERROR_VALUE_LEN > MAX_FORMAT_VALUE_LEN); /* so the buff[] definition above is good for FORMAT and ONERROR */ /* If an online rollback occurs when we are loading up the database with new globals and takes us back to a prior logical * state, then we should not continue with the load. The reason being that the application might rely on certain globals to * be present before loading others and that property could be violated if online rollback takes the database back to a * completely different logical state. Set the variable issue_DBROLLEDBACK_anyways that forces the restart logic to issue * an rts_error the first time it detects an online rollback (that takes the database to a prior logical state). */ TREF(issue_DBROLLEDBACK_anyways) = TRUE; is_replicator = TRUE; skip_dbtriggers = TRUE; fn_len = SIZEOF(fn); if (cli_present("STDIN")) { /* User wants to load from standard input */ assert(SIZEOF(fn) > sys_input.len); memcpy(fn, sys_input.addr, sys_input.len); fn_len = sys_input.len; assert(-1 != fcntl(fileno(stdin), F_GETFD)); /* Check if both file name and -STDIN specified. */ if (cli_get_str("FILE", fn, &fn_len)) mupip_exit(ERR_MUPCLIERR); } else if (!cli_get_str("FILE", fn, &fn_len)) /* User wants to read from a file. */ mupip_exit(ERR_MUPCLIERR); /* Neither -STDIN nor file name specified. */ file_input_init(fn, fn_len, IOP_EOL); if (mupip_error_occurred) EXIT(-1); mu_outofband_setup(); if ((cli_status = cli_present("BEGIN")) == CLI_PRESENT) { if (!cli_get_int64("BEGIN", &begin_i8)) mupip_exit(ERR_MUPCLIERR); if (1 > begin_i8) mupip_exit(ERR_LOADBGSZ); else if (MAXUINT4 < begin_i8) mupip_exit(ERR_LOADBGSZ2); begin = (uint4) begin_i8; } else { begin = 1; begin_i8 = 1; } if ((cli_status = cli_present("END")) == CLI_PRESENT) { if (!cli_get_int64("END", &end_i8)) mupip_exit(ERR_MUPCLIERR); if (1 > end_i8) mupip_exit(ERR_LOADEDSZ); else if (MAXUINT4 < end_i8) mupip_exit(ERR_LOADEDSZ2); if (end_i8 < begin_i8) mupip_exit(ERR_LOADEDBG); end = (uint4) end_i8; } else end = MAXUINT4; if ((cli_status = cli_present("FILL_FACTOR")) == CLI_PRESENT) { assert(SIZEOF(gv_fillfactor) == SIZEOF(int4)); if (!cli_get_int("FILL_FACTOR", (int4 *)&gv_fillfactor)) gv_fillfactor = MAX_FILLFACTOR; if (gv_fillfactor < MIN_FILLFACTOR) gv_fillfactor = MIN_FILLFACTOR; else if (gv_fillfactor > MAX_FILLFACTOR) gv_fillfactor = MAX_FILLFACTOR; } else gv_fillfactor = MAX_FILLFACTOR; if (cli_present("ONERROR") == CLI_PRESENT) { len = SIZEOF(buff); if (!cli_get_str("ONERROR", (char *)buff, &len)) { assert(FALSE); onerror = ONERROR_PROCEED; } else { lower_to_upper(buff, buff, len); if (!memcmp(buff, "STOP", len)) onerror = ONERROR_STOP; else if (!memcmp(buff, "PROCEED", len)) onerror = ONERROR_PROCEED; else if (!memcmp(buff, "INTERACTIVE", len)) { if (isatty(0)) /*if stdin is a terminal*/ onerror = ONERROR_INTERACTIVE; else onerror = ONERROR_STOP; } else { util_out_print("Illegal ONERROR parameter for load",TRUE); mupip_exit(ERR_MUPCLIERR); } } } else onerror = ONERROR_PROCEED; /* Default: Proceed on error */ file_format = get_load_format(&line1_ptr, &line3_ptr, &line1_len, &line3_len, &max_rec_size, &utf8, &dos); /* from header */ if (MU_FMT_GOQ == file_format) mupip_exit(ERR_LDBINFMT); if (BADZCHSET == utf8) mupip_exit(ERR_MUNOFINISH); if (cli_present("FORMAT") == CLI_PRESENT) { /* If the command speficies a format see if it matches the label */ len = SIZEOF(buff); if (!cli_get_str("FORMAT", (char *)buff, &len)) go_load(begin, end, (unsigned char *)line1_ptr, line3_ptr, line3_len, max_rec_size, file_format, utf8, dos); else { lower_to_upper(buff, buff, len); if (!memcmp(buff, "ZWR", len)) { /* If the label did not determine a format let them specify ZWR and they can sort out the result */ if ((MU_FMT_ZWR == file_format) || (MU_FMT_UNRECOG == file_format)) go_load(begin, end, (unsigned char *)line1_ptr, line3_ptr, line3_len, max_rec_size, MU_FMT_ZWR, utf8, dos); else mupip_exit(ERR_LDBINFMT); } else if (!memcmp(buff, "BINARY", len)) { if (MU_FMT_BINARY == file_format) bin_load(begin, end, line1_ptr, line1_len); else mupip_exit(ERR_LDBINFMT); } else if (!memcmp(buff, "GO", len)) { /* If the label did not determine a format let them specify GO and they can sort out the result */ if ((MU_FMT_GO == file_format) || (MU_FMT_UNRECOG == file_format)) go_load(begin, end, (unsigned char *)line1_ptr, line3_ptr, line3_len, max_rec_size, MU_FMT_GO, utf8, dos); else mupip_exit(ERR_LDBINFMT); } else if (!memcmp(buff, "GOQ", len)) { /* get_load_format doesn't recognize GOQ labels' */ if (MU_FMT_UNRECOG == file_format) goq_load(); else mupip_exit(ERR_LDBINFMT); } else { util_out_print("Illegal file format for load",TRUE); mupip_exit(ERR_MUPCLIERR); } } } else { if (MU_FMT_BINARY == file_format) bin_load(begin, end, line1_ptr, line1_len); else if ((MU_FMT_ZWR == file_format) || (MU_FMT_GO == file_format)) go_load(begin, end, (unsigned char *)line1_ptr, line3_ptr, line3_len, max_rec_size, file_format, utf8, dos); else { assert(MU_FMT_UNRECOG == file_format); mupip_exit(ERR_LDBINFMT); } } mupip_exit(mupip_error_occurred ? ERR_MUNOFINISH : SS_NORMAL); }
void mupip_backup(void) { bool journal; char *tempdirname, *tempfilename, *ptr; uint4 level, blk, status, ret; unsigned short s_len, length, ntries; int4 size, gds_ratio, buff_size, i, crit_counter; uint4 ustatus; size_t backup_buf_size; trans_num tn; backup_buff_ptr_t bptr; static boolean_t once = TRUE; backup_reg_list *rptr, *clnup_ptr; boolean_t inc_since_inc , inc_since_rec, result, newjnlfiles, gotit, newjnlfiles_specified, keep_prev_link, bkdbjnl_disable_specified, bkdbjnl_off_specified; unsigned char since_buff[50]; jnl_create_info jnl_info; file_control *fc; char tempdir_trans_buffer[MAX_TRANS_NAME_LEN], tempnam_prefix[MAX_FN_LEN], tempdir_full_buffer[MAX_FN_LEN + 1], jnl_file_name[JNL_NAME_SIZE]; char *jnl_str_ptr, rep_str[256], jnl_str[256], entry[256], full_jnl_fn[JNL_NAME_SIZE], prev_jnl_fn[JNL_NAME_SIZE]; int ccnt, index, comparison, num, jnl_fstat; mstr tempdir_log, tempdir_trans, *file, tempdir_full, filestr; uint4 jnl_status, temp_file_name_len, tempdir_trans_len, trans_log_name_status; #if defined(VMS) struct FAB temp_fab; struct NAM temp_nam; struct XABPRO temp_xabpro; short iosb[4]; char def_jnl_fn[MAX_FN_LEN]; GDS_INFO *gds_info; char exp_file_name[MAX_FN_LEN]; uint4 exp_file_name_len; #elif defined(UNIX) struct stat stat_buf; int fstat_res; int sync_io_status; boolean_t sync_io, sync_io_specified; #else # error UNSUPPORTED PLATFORM #endif boolean_t jnl_options[jnl_end_of_list] = {FALSE, FALSE, FALSE}, save_no_prev_link; error_def(ERR_BACKUPCTRL); error_def(ERR_MUPCLIERR); error_def(ERR_FREEZECTRL); error_def(ERR_DBRDONLY); error_def(ERR_DBFILERR); error_def(ERR_MUNOACTION); error_def(ERR_MUNOFINISH); error_def(ERR_BACKUP2MANYKILL); error_def(ERR_MUSELFBKUP); error_def(ERR_JNLNOCREATE); error_def(ERR_JNLCREATE); error_def(ERR_PREVJNLLINKCUT); error_def(ERR_JNLSTATE); error_def(ERR_FILEEXISTS); error_def(ERR_JNLDISABLE); error_def(ERR_FILEPARSE); error_def(ERR_JNLFNF); error_def(ERR_NOTRNDMACC); /* ==================================== STEP 1. Initialization ======================================= */ ret = SS_NORMAL; jnl_str_ptr = &jnl_str[0]; halt_ptr = grlist = NULL; in_backup = TRUE; inc_since_inc = inc_since_rec = file_backed_up = error_mupip = FALSE; debug_mupip = (CLI_PRESENT == cli_present("DBG")); mu_outofband_setup(); jnl_status = 0; if (once) { gvinit(); once = FALSE; } /* ============================ STEP 2. Parse and construct grlist ================================== */ if (incremental = (CLI_PRESENT == cli_present("INCREMENTAL") || CLI_PRESENT == cli_present("BYTESTREAM"))) { int4 temp_tn; if (0 == cli_get_hex("TRANSACTION", &temp_tn)) { temp_tn = 0; s_len = sizeof(since_buff); if (cli_get_str("SINCE", (char *)since_buff, &s_len)) { lower_to_upper(since_buff, since_buff, s_len); if ((0 == memcmp(since_buff, "INCREMENTAL", s_len)) || (0 == memcmp(since_buff, "BYTESTREAM", s_len))) inc_since_inc = TRUE; else if (0 == memcmp(since_buff, "RECORD", s_len)) inc_since_rec = TRUE; } } else if (temp_tn < 1) { util_out_print("The minimum allowable transaction number is one.", TRUE); mupip_exit(ERR_MUNOACTION); } tn = (trans_num)temp_tn; } online = (TRUE != cli_negated("ONLINE")); record = (CLI_PRESENT == cli_present("RECORD")); newjnlfiles_specified = FALSE; newjnlfiles = TRUE; /* by default */ keep_prev_link = TRUE; if (CLI_PRESENT == cli_present("NEWJNLFILES")) { newjnlfiles_specified = newjnlfiles = TRUE; if (CLI_NEGATED == cli_present("NEWJNLFILES.PREVLINK")) keep_prev_link = FALSE; UNIX_ONLY( sync_io_status = cli_present("NEWJNLFILES.SYNC_IO"); sync_io_specified = TRUE; if (CLI_PRESENT == sync_io_status) sync_io = TRUE; else if (CLI_NEGATED == sync_io_status) sync_io = FALSE; else sync_io_specified = FALSE; ) } else if (CLI_NEGATED == cli_present("NEWJNLFILES"))