File: gvcmz_error.c

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (119 lines) | stat: -rwxr-xr-x 2,610 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/****************************************************************
 *								*
 *	Copyright 2001, 2007 Fidelity Information Services, Inc	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

#include "mdef.h"
#include "cmidef.h"
#include "hashtab_mname.h"	/* needed for cmmdef.h */
#include "cmmdef.h"
#include "gdsroot.h"
#include "gdsblk.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "gtm_string.h"
#include "gvcmz.h"

GBLREF gd_region *gv_cur_region;
GBLREF gv_key *gv_currkey;

void gvcmz_error(char code, uint4 status)
{
	INTPTR_T	err[6], *ptr;
	bool		gv_error;

	error_def(ERR_GVDATAFAIL);
	error_def(ERR_GVGETFAIL);
	error_def(ERR_GVKILLFAIL);
	error_def(ERR_GVORDERFAIL);
	error_def(ERR_GVQUERYFAIL);
	error_def(ERR_GVPUTFAIL);
	error_def(ERR_GVZPREVFAIL);
	error_def(ERR_NETLCKFAIL);
	error_def(ERR_NETFAIL);

	switch(code)
	{
		case CMMS_L_LKCANALL:
		case CMMS_L_LKCANCEL:
		case CMMS_L_LKDELETE:
		case CMMS_L_LKREQIMMED:
		case CMMS_L_LKREQNODE:
		case CMMS_L_LKREQUEST:
		case CMMS_L_LKRESUME:
		case CMMS_L_LKACQUIRE:
		case CMMS_L_LKSUSPEND:
		case CMMS_U_LKEDELETE:
		case CMMS_U_LKESHOW:
			break;
		default:
			gv_cur_region->open = FALSE;
			gv_cur_region->dyn.addr->acc_meth = dba_bg;
			memset(gv_currkey->base,0,gv_currkey->end + 1);
			break;
	}
	ptr = &err[1];
	gv_error = TRUE;
	switch(code)
	{
	case CMMS_Q_DATA:
		*ptr++ = ERR_GVDATAFAIL;
		break;
	case CMMS_Q_GET:
		*ptr++ = ERR_GVGETFAIL;
		break;
	case CMMS_Q_ZWITHDRAW:
	case CMMS_Q_KILL:
		*ptr++ = ERR_GVKILLFAIL;
		break;
	case CMMS_Q_ORDER:
		*ptr++ = ERR_GVORDERFAIL;
		break;
	case CMMS_Q_PUT:
		*ptr++ = ERR_GVPUTFAIL;
		break;
	case CMMS_Q_QUERY:
		*ptr++ = ERR_GVQUERYFAIL;
		break;
	case CMMS_Q_PREV:
		*ptr++ = ERR_GVZPREVFAIL;
		break;
	case CMMS_L_LKCANALL:
	case CMMS_L_LKCANCEL:
	case CMMS_L_LKDELETE:
	case CMMS_L_LKREQIMMED:
	case CMMS_L_LKREQNODE:
	case CMMS_L_LKREQUEST:
	case CMMS_L_LKRESUME:
	case CMMS_L_LKACQUIRE:
	case CMMS_L_LKSUSPEND:
	case CMMS_U_LKEDELETE:
	case CMMS_U_LKESHOW:
		*ptr++ = ERR_NETLCKFAIL;
		*ptr++ = 0;
		gv_error = FALSE;
		break;
	default:
		*ptr++ = ERR_NETFAIL;
		*ptr++ = 0;
		gv_error = FALSE;
		break;
	}
	if (gv_error)
	{
		*ptr++ = 2;
		*ptr++ = 9;
		*ptr++ = (INTPTR_T)"Net error";
	}
	*ptr++  = status;
	err[0] = ptr - err - 1;
	gvcmz_neterr(&err[0]);
}