summaryrefslogtreecommitdiff
path: root/common/os_method.c
blob: 947d005b84ad61a895cec68316cf396ecc1c9e24 (plain)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 1999-2009 Oracle.  All rights reserved.
 *
 * $Id$
 */

#include "db_config.h"

#include "db_int.h"

/*
 * EXTERN: int db_env_set_func_close __P((int (*)(int)));
 */
int
db_env_set_func_close(func_close)
	int (*func_close) __P((int));
{
	DB_GLOBAL(j_close) = func_close;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_dirfree __P((void (*)(char **, int)));
 */
int
db_env_set_func_dirfree(func_dirfree)
	void (*func_dirfree) __P((char **, int));
{
	DB_GLOBAL(j_dirfree) = func_dirfree;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_dirlist
 * EXTERN:     __P((int (*)(const char *, char ***, int *)));
 */
int
db_env_set_func_dirlist(func_dirlist)
	int (*func_dirlist) __P((const char *, char ***, int *));
{
	DB_GLOBAL(j_dirlist) = func_dirlist;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_exists __P((int (*)(const char *, int *)));
 */
int
db_env_set_func_exists(func_exists)
	int (*func_exists) __P((const char *, int *));
{
	DB_GLOBAL(j_exists) = func_exists;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_free __P((void (*)(void *)));
 */
int
db_env_set_func_free(func_free)
	void (*func_free) __P((void *));
{
	DB_GLOBAL(j_free) = func_free;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_fsync __P((int (*)(int)));
 */
int
db_env_set_func_fsync(func_fsync)
	int (*func_fsync) __P((int));
{
	DB_GLOBAL(j_fsync) = func_fsync;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_ftruncate __P((int (*)(int, off_t)));
 */
int
db_env_set_func_ftruncate(func_ftruncate)
	int (*func_ftruncate) __P((int, off_t));
{
	DB_GLOBAL(j_ftruncate) = func_ftruncate;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_ioinfo __P((int (*)(const char *,
 * EXTERN:     int, u_int32_t *, u_int32_t *, u_int32_t *)));
 */
int
db_env_set_func_ioinfo(func_ioinfo)
	int (*func_ioinfo)
	    __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *));
{
	DB_GLOBAL(j_ioinfo) = func_ioinfo;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_malloc __P((void *(*)(size_t)));
 */
int
db_env_set_func_malloc(func_malloc)
	void *(*func_malloc) __P((size_t));
{
	DB_GLOBAL(j_malloc) = func_malloc;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_file_map
 * EXTERN:    __P((int (*)(DB_ENV *, char *, size_t, int, void **),
 * EXTERN:    int (*)(DB_ENV *, void *)));
 */
int
db_env_set_func_file_map(func_file_map, func_file_unmap)
	int (*func_file_map) __P((DB_ENV *, char *, size_t, int, void **));
	int (*func_file_unmap) __P((DB_ENV *, void *));
{
	DB_GLOBAL(j_file_map) = func_file_map;
	DB_GLOBAL(j_file_unmap) = func_file_unmap;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_region_map
 * EXTERN:    __P((int (*)(DB_ENV *, char *, size_t, int *, void **),
 * EXTERN:    int (*)(DB_ENV *, void *)));
 */
int
db_env_set_func_region_map(func_region_map, func_region_unmap)
	int (*func_region_map) __P((DB_ENV *, char *, size_t, int *, void **));
	int (*func_region_unmap) __P((DB_ENV *, void *));
{
	DB_GLOBAL(j_region_map) = func_region_map;
	DB_GLOBAL(j_region_unmap) = func_region_unmap;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_pread
 * EXTERN:    __P((ssize_t (*)(int, void *, size_t, off_t)));
 */
int
db_env_set_func_pread(func_pread)
	ssize_t (*func_pread) __P((int, void *, size_t, off_t));
{
	DB_GLOBAL(j_pread) = func_pread;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_pwrite
 * EXTERN:    __P((ssize_t (*)(int, const void *, size_t, off_t)));
 */
int
db_env_set_func_pwrite(func_pwrite)
	ssize_t (*func_pwrite) __P((int, const void *, size_t, off_t));
{
	DB_GLOBAL(j_pwrite) = func_pwrite;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_open __P((int (*)(const char *, int, ...)));
 */
int
db_env_set_func_open(func_open)
	int (*func_open) __P((const char *, int, ...));
{
	DB_GLOBAL(j_open) = func_open;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_read __P((ssize_t (*)(int, void *, size_t)));
 */
int
db_env_set_func_read(func_read)
	ssize_t (*func_read) __P((int, void *, size_t));
{
	DB_GLOBAL(j_read) = func_read;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_realloc __P((void *(*)(void *, size_t)));
 */
int
db_env_set_func_realloc(func_realloc)
	void *(*func_realloc) __P((void *, size_t));
{
	DB_GLOBAL(j_realloc) = func_realloc;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_rename
 * EXTERN:     __P((int (*)(const char *, const char *)));
 */
int
db_env_set_func_rename(func_rename)
	int (*func_rename) __P((const char *, const char *));
{
	DB_GLOBAL(j_rename) = func_rename;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_seek
 * EXTERN:     __P((int (*)(int, off_t, int)));
 */
int
db_env_set_func_seek(func_seek)
	int (*func_seek) __P((int, off_t, int));
{
	DB_GLOBAL(j_seek) = func_seek;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_unlink __P((int (*)(const char *)));
 */
int
db_env_set_func_unlink(func_unlink)
	int (*func_unlink) __P((const char *));
{
	DB_GLOBAL(j_unlink) = func_unlink;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_write
 * EXTERN:     __P((ssize_t (*)(int, const void *, size_t)));
 */
int
db_env_set_func_write(func_write)
	ssize_t (*func_write) __P((int, const void *, size_t));
{
	DB_GLOBAL(j_write) = func_write;
	return (0);
}

/*
 * EXTERN: int db_env_set_func_yield __P((int (*)(u_long, u_long)));
 */
int
db_env_set_func_yield(func_yield)
	int (*func_yield) __P((u_long, u_long));
{
	DB_GLOBAL(j_yield) = func_yield;
	return (0);
}