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

#include "wt_internal.h"

/*
 * __wt_fsync --
 *	Flush a file handle.
 */
int
__wt_fsync(ENV *env, WT_FH *fh)
{

	WT_STAT_INCR(fh->stats, FSYNC);

	WT_VERBOSE(env, WT_VERB_FILEOPS, (env, "fileops: %s: fsync", fh->name));

	if (fsync(fh->fd) == 0)
		return (0);

	__wt_api_env_err(env, errno, "%s fsync error", fh->name);
	return (WT_ERROR);
}