summaryrefslogtreecommitdiff
path: root/env/env_init.c
blob: d3de33718acc918facca004dd58558db07547a3b (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
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2008-2010 WiredTiger, Inc.
 *	All rights reserved.
 *
 * $Id$
 */

#include "wt_internal.h"

/*
 * wiredtiger_env_init --
 *	Initialize the library, creating an ENV handle.
 */
int
wiredtiger_env_init(ENV **envp, u_int32_t flags)
{
	static int library_init = 0;
	ENV *env;

	*envp = NULL;

	/*
	 * We end up here before we do any real work.   Check the build itself,
	 * and do some global stuff.
	 */
	if (library_init == 0) {
		WT_RET(__wt_library_init());
		library_init = 1;
	}

	WT_ENV_FCHK(NULL,
	    "wiredtiger_env_init", flags, WT_APIMASK_WIREDTIGER_ENV_INIT);

	/* Create the ENV handle. */
	WT_RET(__wt_env_create(flags, &env));

	*envp = env;
	return (0);
}