forked from huansong/filedump
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmock.c
156 lines (121 loc) · 3.48 KB
/
mock.c
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*-------------------------------------------------------------------------
*
* mock.c
* Mock function calls for filedump
*
* Copyright (c) 2021 VMware, Inc. or its affiliates
* SPDX-License-Identifier: GPL-2.0-or-later
*
*-------------------------------------------------------------------------
*/
#include "pg_filedump.h"
#include "cdb/cdbvars.h"
#include "storage/lwlock.h"
#include "utils/memutils.h"
/****************************************************************************
* src/backend/utils/init/globals.c
***************************************************************************/
int NBuffers = 4096;
/****************************************************************************
* src/backend/storage/lmgr/lwlock.c
***************************************************************************/
bool
LWLockHeldByMe(LWLock *l)
{
return true;
}
/****************************************************************************
* src/backend/storage/buffer/bufmgr.c
***************************************************************************/
bool
BufferLockHeldByMe(Page page)
{
return true;
}
/****************************************************************************
* src/backend/utils/misc/guc.c
***************************************************************************/
bool assert_enabled = true;
/****************************************************************************
* src/backend/utils/misc/guc_gp.c
***************************************************************************/
bool Debug_appendonly_print_storage_headers = false;
bool Debug_appendonly_print_verify_write_block = false;
/****************************************************************************
* src/backend/cdb/cdbvars.c
***************************************************************************/
GpId GpIdentity = {UNINITIALIZED_GP_IDENTITY_VALUE, UNINITIALIZED_GP_IDENTITY_VALUE};
bool gp_reraise_signal = false;
/****************************************************************************
* src/backend/utils/mmgr/mcxt.c
***************************************************************************/
MemoryContext CurrentMemoryContext = NULL;
void
MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
{
}
void
MemoryContextDeleteImpl(MemoryContext context, const char* sfile, const char *func, int sline)
{
}
char *
MemoryContextStrdup(MemoryContext context, const char *string)
{
char *nstr;
Size len = strlen(string) + 1;
nstr = (char *) malloc (len);
memcpy(nstr, string, len);
return nstr;
}
/****************************************************************************
* src/backend/utils/error/elog.c
***************************************************************************/
void
errcode_for_file_access(void)
{
}
bool
errstart(int elevel, const char *domain)
{
return (elevel >= ERROR);
}
void
errfinish(const char *filename, int lineno, const char *funcname)
{
exit(1);
}
int
errprintstack(bool printstack)
{
return 0; /* return value does not matter */
}
void
errcode(int sqlerrcode)
{
}
void
errmsg(const char *fmt,...)
{
fprintf(stderr, "ERROR: %s\n", fmt);
}
void
errmsg_internal(const char *fmt,...)
{
fprintf(stderr, "ERROR: %s\n", fmt);
}
void
errdetail(const char *fmt,...)
{
fprintf(stderr, "DETAIL: %s\n", fmt);
}
void
errdetail_log(const char *fmt,...)
{
fprintf(stderr, "DETAIL: %s\n", fmt);
}
void
errhint(const char *fmt,...)
{
fprintf(stderr, "HINT: %s\n", fmt);
}
/* vi: set ts=4 : */