Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

os_fsync.c

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 1997-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: os_fsync.c,v 12.2 2005/08/10 15:47:27 bostic Exp $
00008  */
00009 
00010 #include "db_config.h"
00011 
00012 #ifndef NO_SYSTEM_INCLUDES
00013 #include <sys/types.h>
00014 
00015 #include <fcntl.h>                      /* XXX: Required by __hp3000s900 */
00016 #include <string.h>
00017 #endif
00018 
00019 #include "db_int.h"
00020 
00021 /*
00022  * __os_fsync --
00023  *      Flush a file descriptor.
00024  */
00025 int
00026 __os_fsync(dbenv, fhp)
00027         DB_ENV *dbenv;
00028         DB_FH *fhp;
00029 {
00030         int ret;
00031 
00032         /*
00033          * Do nothing if the file descriptor has been marked as not requiring
00034          * any sync to disk.
00035          */
00036         if (F_ISSET(fhp, DB_FH_NOSYNC))
00037                 return (0);
00038 
00039         if (DB_GLOBAL(j_fsync) != NULL)
00040                 ret = DB_GLOBAL(j_fsync)(fhp->fd);
00041         else
00042                 RETRY_CHK((!FlushFileBuffers(fhp->handle)), ret);
00043 
00044         if (ret != 0)
00045                 __db_err(dbenv, "fsync %s", strerror(ret));
00046         return (ret);
00047 }

Generated on Sun Dec 25 12:14:42 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2