/* We made this a error seperate function because we did not wanted to do the MAXSTR_BUFF_DECL(buff) declartion in op_lock2, * because MAXSTR_BUFF_DECL macro would allocate a huge stack every time op_lock2 is called. */ STATICFNDCL void level_err(mlk_pvtblk *pvt_ptr); /* This definition is made here because there is no appropriate place to * put this prototype. This will not be used anywhere else so we did not * wanted to create a op_lock2.h just for this function. */ STATICFNDCL void level_err(mlk_pvtblk *pvt_ptr) { MAXSTR_BUFF_DECL(buff); MAXSTR_BUFF_INIT; lock_str_to_buff(pvt_ptr, buff, MAX_STRBUFF_INIT); rts_error(VARLSTCNT(7) ERR_LOCKINCR2HIGH, 1, pvt_ptr->level, ERR_LOCKIS, 2, LEN_AND_STR(buff)); }
void op_zshow(mval *func, int type, lv_val *lvn) { const char *ptr; boolean_t do_all = FALSE, done_a = FALSE, done_b = FALSE, done_c = FALSE, done_d = FALSE, done_g = FALSE, done_i = FALSE, done_l = FALSE, done_r = FALSE, done_s = FALSE, done_v = FALSE; int i; zshow_out output; MAXSTR_BUFF_DECL(buff); MV_FORCE_STR(func); for (i = 0, ptr = func->str.addr; i < func->str.len; i++, ptr++) { switch (*ptr) { case 'A': case 'a': case 'B': case 'b': case 'C': case 'c': case 'D': case 'd': case 'G': case 'g': case 'I': case 'i': case 'L': case 'l': case 'R': case 'r': case 'S': case 's': case 'V': case 'v': continue; case '*': do_all = TRUE; break; default: rts_error_csa(CSA_ARG(NULL) VARLSTCNT(1) ERR_ZSHOWBADFUNC); } } if (do_all) { ptr = ZSHOW_ALL; i = STR_LIT_LEN(ZSHOW_ALL); } else { ptr = func->str.addr; i = func->str.len; } memset(&output, 0, SIZEOF(output)); if (type == ZSHOW_LOCAL) output.out_var.lv.lvar = lvn; else if (type == ZSHOW_GLOBAL) { output.out_var.gv.end = gv_currkey->end; output.out_var.gv.prev = gv_currkey->prev; } MAXSTR_BUFF_INIT; output.type = type; output.buff = &buff[0]; output.size = SIZEOF(buff); output.ptr = output.buff; for ( ; i ; i--, ptr++) { output.line_num = 1; switch (*ptr) { case 'A': case 'a': if (done_a) break; done_a = TRUE; output.code = 'A'; ARLINK_ONLY(zshow_rctldump(&output)); break; case 'B': case 'b': if (done_b) break; done_b = TRUE; output.code = 'B'; zshow_zbreaks(&output); break; case 'C': case 'c': if (done_c) break; done_c = TRUE; output.code = 'C'; zshow_zcalls(&output); break; case 'D': case 'd': if (done_d) break; done_d = TRUE; output.code = 'D'; zshow_devices(&output); break; case 'G': case 'g': if (done_g) break; done_g = TRUE; output.code = 'G'; output.line_num = 0; /* G statistics start at 0 for <*,*> output and not 1 like the others */ zshow_gvstats(&output); break; case 'I': case 'i': if (done_i) break; done_i = TRUE; output.code = 'I'; zshow_svn(&output, SV_ALL); break; case 'L': case 'l': if (done_l) break; done_l = TRUE; output.code = 'L'; output.line_num = 0; /* L statistics start at 0 for <LUS,LUF> output and not 1 like the others */ zshow_locks(&output); break; case 'R': case 'r': if (done_r) break; done_r = TRUE; output.code = 'R'; zshow_stack(&output, TRUE); /* show_checksum = TRUE */ break; case 'S': case 's': if (done_s) break; done_s = TRUE; output.code = 'S'; zshow_stack(&output, FALSE); /* show_checksum = FALSE */ break; case 'V': case 'v': if (done_v) break; done_v = TRUE; output.code = 'V'; zshow_zwrite(&output); break; } } output.code = 0; output.flush = TRUE; zshow_output(&output,0); MAXSTR_BUFF_FINI; /* If ZSHOW was done onto a subscripted lvn but no zshow records got dumped in that lvn, it might have $data = 0. * Kill it in that case as otherwise it will create an out-of-design situation for $query(lvn). */ if ((type == ZSHOW_LOCAL) && (NULL != active_lv) && lcl_arg1_is_desc_of_arg2(active_lv, lvn)) UNDO_ACTIVE_LV(actlv_op_zshow); }