os/ossrv/genericopenlibs/openenvcore/libc/src/fdatasync.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/libc/src/fdatasync.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,55 @@
     1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Name        : fdatasync.cpp
    1.18 +// Part of     : LIBC
    1.19 +// Contains the source for fchdir
    1.20 +// Version     : 1.0
    1.21 +//
    1.22 +
    1.23 +
    1.24 + 
    1.25 +#include <unistd.h>
    1.26 +
    1.27 +/*
    1.28 +The fdatasync() function shall force all currently queued I/O operations associated
    1.29 +with the file indicated by file descriptor fildes to the synchronized I/O completion
    1.30 +state.The functionality shall be equivalent to fsync() with the symbol  -> 
    1.31 +_POSIX_SYNCHRONIZED_IO defined, with the exception that all I/O operations shall be
    1.32 +completed as defined for synchronized I/O data integrity completion.If successful, 
    1.33 +the fdatasync() function shall return the value 0; otherwise, the function shall
    1.34 +return the value -1 and set errno to indicate the error.
    1.35 +*/
    1.36 +
    1.37 +extern "C" {
    1.38 +
    1.39 +EXPORT_C int fdatasync(int filedesc)
    1.40 +	{
    1.41 +	int retVal = -1;
    1.42 +	#ifndef _POSIX_SYNCHRONIZED_IO
    1.43 +	#define _POSIX_SYNCHRONIZED_IO
    1.44 + 	#define FLAG_FOR_FSYNC 1
    1.45 + 	#endif
    1.46 +	//Calls fsync that provides equivalent functionality.	
    1.47 +	retVal =  fsync(filedesc);
    1.48 +	
    1.49 +	#ifdef FLAG_FOR_FSYNC
    1.50 +	#undef _POSIX_SYNCHRONIZED_IO;
    1.51 +	#undef FLAG_FOR_FSYNC
    1.52 +	#endif 
    1.53 +	
    1.54 +	return retVal;
    1.55 +	}
    1.56 +
    1.57 +} //extern "C"
    1.58 +