1 /*-
2  * Copyright (c) 2014-2018 MongoDB, Inc.
3  * Copyright (c) 2008-2014 WiredTiger, Inc.
4  *	All rights reserved.
5  *
6  * See the file LICENSE for redistribution information.
7  */
8 
9 #ifndef __WT_INTERNAL_H
10 #define	__WT_INTERNAL_H
11 
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15 
16 /*******************************************
17  * WiredTiger public include file, and configuration control.
18  *******************************************/
19 #include "wiredtiger_config.h"
20 #include "wiredtiger_ext.h"
21 
22 /*******************************************
23  * WiredTiger system include files.
24  *******************************************/
25 #ifndef _WIN32
26 #include <sys/mman.h>
27 #endif
28 #include <sys/stat.h>
29 #ifndef _WIN32
30 #include <sys/time.h>
31 #include <sys/uio.h>
32 #endif
33 #ifndef _WIN32
34 #include <dlfcn.h>
35 #endif
36 #include <errno.h>
37 #include <fcntl.h>
38 #include <float.h>
39 #include <inttypes.h>
40 #ifdef _WIN32
41 #include <io.h>
42 #endif
43 #include <limits.h>
44 #ifdef _WIN32
45 #include <process.h>
46 #else
47 #include <pthread.h>
48 #endif
49 #include <stdbool.h>
50 #include <stddef.h>
51 #include <stdio.h>
52 #include <stdint.h>
53 #include <stdlib.h>
54 #include <string.h>
55 #ifndef _WIN32
56 #include <unistd.h>
57 #endif
58 #include <time.h>
59 #ifdef _WIN32
60 #define	WIN32_LEAN_AND_MEAN
61 #include <windows.h>
62 #endif
63 
64 /*
65  * DO NOT EDIT: automatically built by dist/s_typedef.
66  * Forward type declarations for internal types: BEGIN
67  */
68 struct __wt_addr;
69     typedef struct __wt_addr WT_ADDR;
70 struct __wt_async;
71     typedef struct __wt_async WT_ASYNC;
72 struct __wt_async_cursor;
73     typedef struct __wt_async_cursor WT_ASYNC_CURSOR;
74 struct __wt_async_format;
75     typedef struct __wt_async_format WT_ASYNC_FORMAT;
76 struct __wt_async_op_impl;
77     typedef struct __wt_async_op_impl WT_ASYNC_OP_IMPL;
78 struct __wt_async_worker_state;
79     typedef struct __wt_async_worker_state WT_ASYNC_WORKER_STATE;
80 struct __wt_block;
81     typedef struct __wt_block WT_BLOCK;
82 struct __wt_block_ckpt;
83     typedef struct __wt_block_ckpt WT_BLOCK_CKPT;
84 struct __wt_block_desc;
85     typedef struct __wt_block_desc WT_BLOCK_DESC;
86 struct __wt_block_header;
87     typedef struct __wt_block_header WT_BLOCK_HEADER;
88 struct __wt_bloom;
89     typedef struct __wt_bloom WT_BLOOM;
90 struct __wt_bloom_hash;
91     typedef struct __wt_bloom_hash WT_BLOOM_HASH;
92 struct __wt_bm;
93     typedef struct __wt_bm WT_BM;
94 struct __wt_btree;
95     typedef struct __wt_btree WT_BTREE;
96 struct __wt_cache;
97     typedef struct __wt_cache WT_CACHE;
98 struct __wt_cache_pool;
99     typedef struct __wt_cache_pool WT_CACHE_POOL;
100 struct __wt_cell;
101     typedef struct __wt_cell WT_CELL;
102 struct __wt_cell_unpack;
103     typedef struct __wt_cell_unpack WT_CELL_UNPACK;
104 struct __wt_ckpt;
105     typedef struct __wt_ckpt WT_CKPT;
106 struct __wt_col;
107     typedef struct __wt_col WT_COL;
108 struct __wt_col_rle;
109     typedef struct __wt_col_rle WT_COL_RLE;
110 struct __wt_col_var_repeat;
111     typedef struct __wt_col_var_repeat WT_COL_VAR_REPEAT;
112 struct __wt_colgroup;
113     typedef struct __wt_colgroup WT_COLGROUP;
114 struct __wt_compact_state;
115     typedef struct __wt_compact_state WT_COMPACT_STATE;
116 struct __wt_condvar;
117     typedef struct __wt_condvar WT_CONDVAR;
118 struct __wt_config;
119     typedef struct __wt_config WT_CONFIG;
120 struct __wt_config_check;
121     typedef struct __wt_config_check WT_CONFIG_CHECK;
122 struct __wt_config_entry;
123     typedef struct __wt_config_entry WT_CONFIG_ENTRY;
124 struct __wt_config_parser_impl;
125     typedef struct __wt_config_parser_impl WT_CONFIG_PARSER_IMPL;
126 struct __wt_connection_impl;
127     typedef struct __wt_connection_impl WT_CONNECTION_IMPL;
128 struct __wt_connection_stats;
129     typedef struct __wt_connection_stats WT_CONNECTION_STATS;
130 struct __wt_cursor_backup;
131     typedef struct __wt_cursor_backup WT_CURSOR_BACKUP;
132 struct __wt_cursor_btree;
133     typedef struct __wt_cursor_btree WT_CURSOR_BTREE;
134 struct __wt_cursor_bulk;
135     typedef struct __wt_cursor_bulk WT_CURSOR_BULK;
136 struct __wt_cursor_config;
137     typedef struct __wt_cursor_config WT_CURSOR_CONFIG;
138 struct __wt_cursor_data_source;
139     typedef struct __wt_cursor_data_source WT_CURSOR_DATA_SOURCE;
140 struct __wt_cursor_dump;
141     typedef struct __wt_cursor_dump WT_CURSOR_DUMP;
142 struct __wt_cursor_index;
143     typedef struct __wt_cursor_index WT_CURSOR_INDEX;
144 struct __wt_cursor_join;
145     typedef struct __wt_cursor_join WT_CURSOR_JOIN;
146 struct __wt_cursor_join_endpoint;
147     typedef struct __wt_cursor_join_endpoint WT_CURSOR_JOIN_ENDPOINT;
148 struct __wt_cursor_join_entry;
149     typedef struct __wt_cursor_join_entry WT_CURSOR_JOIN_ENTRY;
150 struct __wt_cursor_join_iter;
151     typedef struct __wt_cursor_join_iter WT_CURSOR_JOIN_ITER;
152 struct __wt_cursor_json;
153     typedef struct __wt_cursor_json WT_CURSOR_JSON;
154 struct __wt_cursor_log;
155     typedef struct __wt_cursor_log WT_CURSOR_LOG;
156 struct __wt_cursor_lsm;
157     typedef struct __wt_cursor_lsm WT_CURSOR_LSM;
158 struct __wt_cursor_metadata;
159     typedef struct __wt_cursor_metadata WT_CURSOR_METADATA;
160 struct __wt_cursor_stat;
161     typedef struct __wt_cursor_stat WT_CURSOR_STAT;
162 struct __wt_cursor_table;
163     typedef struct __wt_cursor_table WT_CURSOR_TABLE;
164 struct __wt_data_handle;
165     typedef struct __wt_data_handle WT_DATA_HANDLE;
166 struct __wt_data_handle_cache;
167     typedef struct __wt_data_handle_cache WT_DATA_HANDLE_CACHE;
168 struct __wt_dlh;
169     typedef struct __wt_dlh WT_DLH;
170 struct __wt_dsrc_stats;
171     typedef struct __wt_dsrc_stats WT_DSRC_STATS;
172 struct __wt_evict_entry;
173     typedef struct __wt_evict_entry WT_EVICT_ENTRY;
174 struct __wt_evict_queue;
175     typedef struct __wt_evict_queue WT_EVICT_QUEUE;
176 struct __wt_ext;
177     typedef struct __wt_ext WT_EXT;
178 struct __wt_extlist;
179     typedef struct __wt_extlist WT_EXTLIST;
180 struct __wt_fh;
181     typedef struct __wt_fh WT_FH;
182 struct __wt_file_handle_inmem;
183     typedef struct __wt_file_handle_inmem WT_FILE_HANDLE_INMEM;
184 struct __wt_file_handle_posix;
185     typedef struct __wt_file_handle_posix WT_FILE_HANDLE_POSIX;
186 struct __wt_file_handle_win;
187     typedef struct __wt_file_handle_win WT_FILE_HANDLE_WIN;
188 struct __wt_fstream;
189     typedef struct __wt_fstream WT_FSTREAM;
190 struct __wt_hazard;
191     typedef struct __wt_hazard WT_HAZARD;
192 struct __wt_ikey;
193     typedef struct __wt_ikey WT_IKEY;
194 struct __wt_index;
195     typedef struct __wt_index WT_INDEX;
196 struct __wt_insert;
197     typedef struct __wt_insert WT_INSERT;
198 struct __wt_insert_head;
199     typedef struct __wt_insert_head WT_INSERT_HEAD;
200 struct __wt_join_stats;
201     typedef struct __wt_join_stats WT_JOIN_STATS;
202 struct __wt_join_stats_group;
203     typedef struct __wt_join_stats_group WT_JOIN_STATS_GROUP;
204 struct __wt_keyed_encryptor;
205     typedef struct __wt_keyed_encryptor WT_KEYED_ENCRYPTOR;
206 struct __wt_log;
207     typedef struct __wt_log WT_LOG;
208 struct __wt_log_desc;
209     typedef struct __wt_log_desc WT_LOG_DESC;
210 struct __wt_log_op_desc;
211     typedef struct __wt_log_op_desc WT_LOG_OP_DESC;
212 struct __wt_log_rec_desc;
213     typedef struct __wt_log_rec_desc WT_LOG_REC_DESC;
214 struct __wt_log_record;
215     typedef struct __wt_log_record WT_LOG_RECORD;
216 struct __wt_logslot;
217     typedef struct __wt_logslot WT_LOGSLOT;
218 struct __wt_lsm_chunk;
219     typedef struct __wt_lsm_chunk WT_LSM_CHUNK;
220 struct __wt_lsm_cursor_chunk;
221     typedef struct __wt_lsm_cursor_chunk WT_LSM_CURSOR_CHUNK;
222 struct __wt_lsm_data_source;
223     typedef struct __wt_lsm_data_source WT_LSM_DATA_SOURCE;
224 struct __wt_lsm_manager;
225     typedef struct __wt_lsm_manager WT_LSM_MANAGER;
226 struct __wt_lsm_tree;
227     typedef struct __wt_lsm_tree WT_LSM_TREE;
228 struct __wt_lsm_work_unit;
229     typedef struct __wt_lsm_work_unit WT_LSM_WORK_UNIT;
230 struct __wt_lsm_worker_args;
231     typedef struct __wt_lsm_worker_args WT_LSM_WORKER_ARGS;
232 struct __wt_lsm_worker_cookie;
233     typedef struct __wt_lsm_worker_cookie WT_LSM_WORKER_COOKIE;
234 struct __wt_multi;
235     typedef struct __wt_multi WT_MULTI;
236 struct __wt_myslot;
237     typedef struct __wt_myslot WT_MYSLOT;
238 struct __wt_named_collator;
239     typedef struct __wt_named_collator WT_NAMED_COLLATOR;
240 struct __wt_named_compressor;
241     typedef struct __wt_named_compressor WT_NAMED_COMPRESSOR;
242 struct __wt_named_data_source;
243     typedef struct __wt_named_data_source WT_NAMED_DATA_SOURCE;
244 struct __wt_named_encryptor;
245     typedef struct __wt_named_encryptor WT_NAMED_ENCRYPTOR;
246 struct __wt_named_extractor;
247     typedef struct __wt_named_extractor WT_NAMED_EXTRACTOR;
248 struct __wt_named_snapshot;
249     typedef struct __wt_named_snapshot WT_NAMED_SNAPSHOT;
250 struct __wt_optrack_header;
251     typedef struct __wt_optrack_header WT_OPTRACK_HEADER;
252 struct __wt_optrack_record;
253     typedef struct __wt_optrack_record WT_OPTRACK_RECORD;
254 struct __wt_ovfl_reuse;
255     typedef struct __wt_ovfl_reuse WT_OVFL_REUSE;
256 struct __wt_ovfl_track;
257     typedef struct __wt_ovfl_track WT_OVFL_TRACK;
258 struct __wt_page;
259     typedef struct __wt_page WT_PAGE;
260 struct __wt_page_deleted;
261     typedef struct __wt_page_deleted WT_PAGE_DELETED;
262 struct __wt_page_header;
263     typedef struct __wt_page_header WT_PAGE_HEADER;
264 struct __wt_page_index;
265     typedef struct __wt_page_index WT_PAGE_INDEX;
266 struct __wt_page_lookaside;
267     typedef struct __wt_page_lookaside WT_PAGE_LOOKASIDE;
268 struct __wt_page_modify;
269     typedef struct __wt_page_modify WT_PAGE_MODIFY;
270 struct __wt_process;
271     typedef struct __wt_process WT_PROCESS;
272 struct __wt_ref;
273     typedef struct __wt_ref WT_REF;
274 struct __wt_row;
275     typedef struct __wt_row WT_ROW;
276 struct __wt_rwlock;
277     typedef struct __wt_rwlock WT_RWLOCK;
278 struct __wt_salvage_cookie;
279     typedef struct __wt_salvage_cookie WT_SALVAGE_COOKIE;
280 struct __wt_save_upd;
281     typedef struct __wt_save_upd WT_SAVE_UPD;
282 struct __wt_scratch_track;
283     typedef struct __wt_scratch_track WT_SCRATCH_TRACK;
284 struct __wt_session_impl;
285     typedef struct __wt_session_impl WT_SESSION_IMPL;
286 struct __wt_session_stash;
287     typedef struct __wt_session_stash WT_SESSION_STASH;
288 struct __wt_size;
289     typedef struct __wt_size WT_SIZE;
290 struct __wt_spinlock;
291     typedef struct __wt_spinlock WT_SPINLOCK;
292 struct __wt_stash;
293     typedef struct __wt_stash WT_STASH;
294 struct __wt_table;
295     typedef struct __wt_table WT_TABLE;
296 struct __wt_thread;
297     typedef struct __wt_thread WT_THREAD;
298 struct __wt_thread_group;
299     typedef struct __wt_thread_group WT_THREAD_GROUP;
300 struct __wt_timestamp_t;
301     typedef struct __wt_timestamp_t WT_TIMESTAMP_T;
302 struct __wt_txn;
303     typedef struct __wt_txn WT_TXN;
304 struct __wt_txn_global;
305     typedef struct __wt_txn_global WT_TXN_GLOBAL;
306 struct __wt_txn_op;
307     typedef struct __wt_txn_op WT_TXN_OP;
308 struct __wt_txn_state;
309     typedef struct __wt_txn_state WT_TXN_STATE;
310 struct __wt_update;
311     typedef struct __wt_update WT_UPDATE;
312 union __wt_lsn;
313     typedef union __wt_lsn WT_LSN;
314 union __wt_rand_state;
315     typedef union __wt_rand_state WT_RAND_STATE;
316 /*
317  * Forward type declarations for internal types: END
318  * DO NOT EDIT: automatically built by dist/s_typedef.
319  */
320 
321 /*******************************************
322  * WiredTiger internal include files.
323  *******************************************/
324 #if defined(_lint)
325 #include "lint.h"
326 #elif defined(__GNUC__)
327 #include "gcc.h"
328 #elif defined(_MSC_VER)
329 #include "msvc.h"
330 #endif
331 /*
332  * GLIBC 2.26 and later use the openat syscall to implement open.
333  * Set this flag so that our strace tests know to expect this.
334  */
335 #ifdef __GLIBC_PREREQ
336 #if __GLIBC_PREREQ(2, 26)
337 #define	WT_USE_OPENAT 1
338 #endif
339 #endif
340 
341 #include "hardware.h"
342 #include "swap.h"
343 
344 #include "queue.h"
345 
346 #ifdef _WIN32
347 #include "os_windows.h"
348 #else
349 #include "posix.h"
350 #endif
351 
352 #include "misc.h"
353 #include "mutex.h"
354 
355 #include "stat.h"			/* required by dhandle.h */
356 #include "dhandle.h"			/* required by btree.h */
357 
358 #include "api.h"
359 #include "async.h"
360 #include "block.h"
361 #include "bloom.h"
362 #include "btmem.h"
363 #include "btree.h"
364 #include "cache.h"
365 #include "compact.h"
366 #include "config.h"
367 #include "cursor.h"
368 #include "dlh.h"
369 #include "error.h"
370 #include "log.h"
371 #include "lsm.h"
372 #include "meta.h"
373 #include "optrack.h"
374 #include "os.h"
375 #include "schema.h"
376 #include "thread_group.h"
377 #include "txn.h"
378 
379 #include "session.h"			/* required by connection.h */
380 #include "connection.h"
381 
382 #include "extern.h"
383 #ifdef _WIN32
384 #include "extern_win.h"
385 #else
386 #include "extern_posix.h"
387 #endif
388 #include "verify_build.h"
389 
390 #include "ctype.i"			/* required by packing.i */
391 #include "intpack.i"			/* required by cell.i, packing.i */
392 #include "misc.i"			/* required by mutex.i */
393 
394 #include "buf.i"                        /* required by cell.i */
395 #include "cache.i"			/* required by txn.i */
396 #include "cell.i"			/* required by btree.i */
397 #include "mutex.i"			/* required by btree.i */
398 #include "txn.i"			/* required by btree.i */
399 
400 #include "bitstring.i"
401 #include "btree.i"			/* required by cursor.i */
402 #include "btree_cmp.i"
403 #include "column.i"
404 #include "cursor.i"
405 #include "log.i"
406 #include "os_fhandle.i"
407 #include "os_fs.i"
408 #include "os_fstream.i"
409 #include "packing.i"
410 #include "serial.i"
411 
412 #if defined(__cplusplus)
413 }
414 #endif
415 #endif					/* !__WT_INTERNAL_H */
416